8 Replies Latest reply on Nov 19, 2012 11:45 AM by userc_38487

    How to remove warning

       I have warnings saying "Multiple  call Start/Main Interupt/ISR" what is this warning saying and how to remove this.


      I have this function called 'Start" which I am using in main as well as one of the interrupt routine. What has to be done to remove this warning

        • 1. Re: How to remove warning

          You have at least to declare that function as reentrant. Also take care that you are not accessing any global vars within that routine, if you do, you must disable interrupts during that acce4ss.





          • 2. Re: How to remove warning

            These might help -






            Regards, Dana.

            • 3. Re: How to remove warning

               I did make the function as reentrant but this function calls some other function inturn ....should I make that aswell Reentrant???


              And what happens if I were to use global variables because the functions I call are setting some status/flag kind bit....so if I am not supposed to use these variables how can i proceed

              • 4. Re: How to remove warning

                this might help you in handling interrupt in PSoC



                • 5. Re: How to remove warning

                   I missed the main part of the previous comment...... These functions can also be invoked by some of the critical interupts, i cannot let these interupt just go away or remain pending.... Please advice

                  • 6. Re: How to remove warning

                    Sit down and calm, it is not as complicated.


                    Try to imagine what may happen, when you call that function and while it is working an interrupt occurs and the function is called again. Since read-modify-write instructions are not atomic all of those may (will!) lead to something unpredictable. To help you to overcome these situations there are two helpers: The definition as "reentrant" which does not much in an ARM environment as a PSoC5 but is absolutely needed in a PSoC3 environment with its 8051....


                    Secondly there are the system-APIs CyEnterCriticalSection() and CyExitCriticalSection() which are intended for preventing small(!!!) areas of code beeing accessed simultaneously from different (or the same) pieces of code.


                    As some rules of thumb:


                    Local variables may be accessed without any restriction, they are allocated on the stach at function entry, or on a heap for reentrant 8051.


                    Local static vars should not be accessed in an interupt routine when the interrupt is re-enabled.


                    Global vars that must be accessed frim within an interrupt routine should


                    1. be declared as void


                    2. should be protected by critical sections when write accessed from outside the interrupt handler.




                    And to answer your last question: Yes, the functions you call from your interrupt-routine have to be declared as reentrant as well.




                    Happy interruptings



                    • 7. Re: How to remove warning

                      How to write Cyentercritical section and Cyexit critical section??


                      And what happens to the high priority interrupts ..will they be stopped when I am executing critical section or will they be pending.........If they will be pending then am i not sort of chsnging the priority?????


                      With the crucial info Bob has provided I think i need to redesign my program, .....Thnks for info Bob.....

                      • 8. Re: How to remove warning

                         Refer to Section 12 of the System Reference Guide which provides more details on CyEnterCriticalSection() & CyExitCriticalSection() APIs