4 Replies Latest reply on Feb 12, 2016 1:52 PM by doedelhoch4_1549746

    Interrupt can't get cleared

    doedelhoch4_1549746

      Hi!

         

      I post a lot recently and I hope it's not too much ...

         

      I have an SPI block that requests an interrupt when its FIFO is above 2 bytes. And only under this condition. Sadly the interrupt type I get inside the ISR is SPI done (0x200). This and the fact that the interrupt keeps coming even when the FIFO is completely empty bothers me much because I will be trapped in reoccurring ISR forever without the possibility of leaving it.

         

      I tried like 10 different ways to clear the interrupt and none of them worked. The SPI itself works fine and the first interrupt occurs after the RX FIFO is at 3 bytes which is right. But when I read the 3 bytes and no more bytes get shoved in there (so the count stays 0), The interrupts keep occuring ...

         

      I attached the project and hope someone can give me a tip because it starts to get annoying :(

         

      Peace Noah

        • 1. Re: Interrupt can't get cleared
          user_1377889

          You try to clear the interrupt in a wrong order. Datasheet tells that a I2C_ClearRxInterruptSource() cannot clear a FIFO interrupt under certain conditions (see page 176) So you have to read off the data from FIFO first (until it is empty) then clear the interrupt.

             

          I strongly suggest you not to make changes in the generated files. You may keep your complete interrupt handling in main.c when you use the isr_StartEx() instead of isr_Start().

             

           

             

          Bob

          • 2. Re: Interrupt can't get cleared
            doedelhoch4_1549746

            Hey Bob thanks for the quick answer! Ok I didn't know that one. Guess it applies for SPI too (not using I2C ;) But what datasheet are you talking about? The one I get from PSoC creator SPI component doesn't even list all available functions ... And no DS I find concerning the CYBLE module is really more than 70 pages ... so what Datasheet that has 176 pages do you have? Might also fix further questions if I get that datasheet :S because I really tried finding out by the DS I got.

               

            Also: I just put code where the comments in the generated c file said to put code there. I hope that's ok. I don't like to have all in one main.c. Also: I do use my own isr handle but I use it with isr_SetVector(); and isr_Start(); I will change to what you suggested tho :)

               

            Thanks a ton!

               

            Peace Noah 

            • 3. Re: Interrupt can't get cleared
              user_1377889

              Also: I just put code where the comments in the generated c file said to  That was the "formerly" used way. Because customers complained (justifiably) that all code does not survive component or Creator updates Cypress changed the way to do that.

                 

              1st. Using the StartEx() API for interrupts allows the handlers to be kept in your own sources (not required to be in main.c)

                 

              2nd. Callback macros allow for usercode (yours) to be executed even when not triggered by an interrupt. For the concept look in Creator Help.

                 

               

                 

              Datasheets: The PSoC4 Serial Communication Block (SCB) v 3.0  datasheet has got 200 pages.

                 

              The search function in the forum here gives only a limited help (too many hits). Within your Cypress PSoC installation you can find a "Cypress Document manager" which is able to dig out app notes, datasheets and whatever you ask for in a quite convenient way.

              • 4. Re: Interrupt can't get cleared
                doedelhoch4_1549746

                Thanks very much, your advice worked like a charm! Search function is very awesome, sadly didn't help me on my next problem with the timer because I can't see my difference to the example ... yeah I am bad ...

                   

                I also found where it's written in the Datasheet ... I must have overread it ... because it's explained pretty clearly. What I do not get is why it has this behavior. It is VERY unintuitive. Other than reading the entire 200 pages you wont figure that one I guess.

                   

                Also I don't know what your problems with component updates is :) it doesn't delete my code :)

                   

                Peace Noah