7 Replies Latest reply on Sep 17, 2012 10:56 AM by garrett.marshall

    Program continuously breaks at while(1) even though there is no breakpoint

    garrett.marshall

      I'm having issues with PSoC Designer 5.2 where I have a while(1) loop and when I execute Debug -> Go, PSoC continuously breaks at while(1), even though there is no breakpoint.  I've attached my code and here is the snippit where the issue occurs:

         

       

         

      void main(void){

         

        // M8C_EnableGInt ; // Uncomment this line to enable Global Interrupts

         

       

         

        Configure_SPI();        /* Configure SPI */

         

        Configure_TLC5970();    /* Configure TLC5970 */

         

       

         

        while(1) {

         

          Red();

         

      Delay_ms(32);

         

      Green();

         

      Delay_ms(32);

         

      }

         

      }

         

      Thanks for your help.

        • 1. Re: Program continuously breaks at while(1) even though there is no breakpoint
          content.librarian

           Hi,

             

           

             

          In some cases the ICE can loose track on the M8C which leads to strange behaviour like unwanted breaks and/or disconnecting.

             

          As far as I remember them, I can give you a few items you can check:

             

          - make sure your VCC power is stable and use 100nf bypass caps on VCC/GND near the PSoC.

             

          - watch out for stack usage. If your stack grows too high, this may cause debugging isues.

             

          - Minimize GND-loop currents as much as you can. Keep in mind that the GND of your project is connected to the GND of your PC

             

          - There might be some bad flex-cables out there, contact Technical Support to see if they can help you on this.

             

          - If you write your own SPC calls rather than using the User Modules (like EEprom writes / reset etc.) these can lead to debugging issues too.

             

          - I experienced that swapping the ICE itself somtimes leads to different debugging behaviour.

             

           

             

          This said, I hope Cypress will re-implement the "Invalid Memory Reference" message, to give some idea what is happening rather than just disconnecting or halting.

             

           

             

          Regards,

             

          Rolf

          • 2. Re: Program continuously breaks at while(1) even though there is no breakpoint
            user_2405011

             Hi,

               

             

               

            In some cases the ICE can loose track on the M8C which leads to strange behaviour like unwanted breaks and/or disconnecting.

               

            As far as I remember them, I can give you a few items you can check:

               

            - make sure your VCC power is stable and use 100nf bypass caps on VCC/GND near the PSoC.

               

            - watch out for stack usage. If your stack grows too high, this may cause debugging isues.

               

            - Minimize GND-loop currents as much as you can. Keep in mind that the GND of your project is connected to the GND of your PC

               

            - There might be some bad flex-cables out there, contact Technical Support to see if they can help you on this.

               

            - If you write your own SPC calls rather than using the User Modules (like EEprom writes / reset etc.) these can lead to debugging issues too.

               

            - I experienced that swapping the ICE itself somtimes leads to different debugging behaviour.

               

             

               

            This said, I hope Cypress will re-implement the "Invalid Memory Reference" message, to give some idea what is happening rather than just disconnecting or halting.

               

             

               

            Regards,

               

            Rolf

            • 3. Re: Program continuously breaks at while(1) even though there is no breakpoint
              user_14586677

              This may be irrelevant, but you have a delay(), is it interrupt dependent ?

                 

              If so you have interrupts disabled.

                 

               

                 

              I have seen ICE Cube not behaving when code size approaches limits of FLASH,

                 

              ~ 2 K or less from end of FLASH, in fact I have a design I cannot debug anymore

                 

              with ICE CUBE, code size is 31.5K in a 32,768 sized part.

                 

               

                 

               

                 

              Regards, Dana.

              • 4. Re: Program continuously breaks at while(1) even though there is no breakpoint
                garrett.marshall

                Here is a better description of my setup.  I'm using the ICE and have it connected via ethernet to a CY3664-EXT development kit.  I'm then taking three outputs from this board P0[0], P0[1], and P0[2] and connected them to another LED controller board that is getting its own power.  The ICE is providing power to the CY3664.  I put a scope probe on the RJ45 connector of the CY3664 board and it looks like it is a very stable 5v.  Putting a decoupling cap on the CY3664 didn't help the cause.  When I look at the RAM/FLASH and the Trace it doesn't appear that I'm filling up the memory.  I am new to PSoC so can you guide me through the steps to ensure that this isn't occuring.  

                   

                I'm not using any interrupts.  The delays are nothing more than simple loops:

                   

                 void Delay_ms(int x){

                   

                  int y = 0;

                   

                  int z = 0;

                   

                 

                   

                  while ( y < x ) {

                   

                    while ( z < 62 ) {   // This is is 1ms

                   

                 z++;

                   

                 y++;

                   

                    }

                   

                  }

                   

                }

                • 5. Re: Program continuously breaks at while(1) even though there is no breakpoint
                  user_14586677

                  Doesn'tt this -

                     

                   

                     

                  void Delay_ms(int x){

                     

                  int y = 0;

                     

                  int z = 0;

                     

                   while ( y < x ) {

                     

                        while ( z < 62 ) { // This is is 1ms

                     

                         z++;

                     

                        y++;

                     

                       }

                     

                    }

                     

                  }

                     

                   

                     

                  Want to be this -

                     

                   

                     

                  void Delay_ms(int x){

                     

                  int y = 0;

                     

                  int z = 0;

                     

                  while ( y < x ) {

                     

                           while ( z < 62 ) { // This is is 1ms

                     

                                z++;

                     

                           }

                     

                           y++;

                     

                  }

                     

                   

                     

                  Regards, Dana.

                  • 7. Re: Program continuously breaks at while(1) even though there is no breakpoint
                    garrett.marshall

                    Because of all the odd things that were occuring I finally rebooted my PC and now my program runs continuously like it should.  Gotta love Windows.

                       

                    - Garrett