5 Replies Latest reply on Feb 21, 2019 8:41 PM by himam_31

    BLE Seems crashing randomly during Low power Mode

    FrPo_1282226

      Hi there,

      I spent the last 2 weeks trying to figure out why sometimes my solution seems crashing.

       

      I have followed as much as possible all the recommendation from Cypress...

       

      My main loop looks like:

       

          for(;;){

              // process the BLE events in the stack

              CyBle_ProcessEvents();

              /***********************************************************************

              *  Put BLE sub system in DeepSleep mode when it is idle

              ***********************************************************************/

              ManageBlePower();

              /***********************************************************************

              *  Run your application specific code here

              ***********************************************************************/

             // if(applicationPower == ACTIVE)

              {

                  RunApplication();

              }

            

               /***********************************************************************

              *  Process application power modes

              ***********************************************************************/

              ManageApplicationPower(); 

            

              /***********************************************************************

              *  Manage system power mode based on application and BLE power modes

              ***********************************************************************/

              ManageSystemPower();

        

          }

       

      the systems has 2 interrupts :

      interrupts # 1 => WDT (every 250 msec)

      Interrupt #2 => external pin (Pin 1.1)

       

      What I notice is that sometimes after I have pressed the button the system seems to crash.

      Most of the time I see an LED  going off (e.g. Green LED is gets on) and then the systems don't respond anymore.

       

      with the oscilloscope I have noticed (in my last test this evening) that when it crashes the 24 MHz is ON for ever, draining all the battery.

       

      Can someone have a look at the code please and tell me what I'm doing wrong please?

       

       

       

      Thank you,

      Francesco

        • 1. Re: BLE Seems crashing randomly during Low power Mode
          FrPo_1282226

          for(;;){

                 

                  // process the BLE events in the stack

                  CyBle_ProcessEvents();

                 

           

                   PWM_OUT_Write(0); 

            

                      RunApplication();

             

                 LowPowerImplementation();

                  PWM_OUT_Write(1); 

                  

             

              }

           

          I'm still struggling in solving this issue... 

          I'm using a pin to understand where we have the "crash", I'm driving this pin High, just after I put the chip in low power mode.

          and when it crashes the pin stays high, indicating that the issue happens inside    CyBle_ProcessEvents();

           

          Any idea ?

          Thanks

          • 2. Re: BLE Seems crashing randomly during Low power Mode
            himam_31

            Hello,

             

            Can you give more details about the issue. I tried to port this code to development kit, I have changed the switch input to P2.7. Now after pressing the switch I'm able to see the device advertising.

             

            1)Can you Attach the device to Running Target and check where exactly its getting stuck.

            2)Did you get a chance to probe PWM_OUT? Is it staying high continuously?

            3)Are you able to recreate the issue on development kit?

             

            Thanks,

            Hima

            • 3. Re: BLE Seems crashing randomly during Low power Mode
              FrPo_1282226

              Hi Hima,

               

              it seems that the firmware is getting "trapped" inside the CyBle_ProcessEvents(); for some reason...

              driving the pin PWM_OUT high and low, I think I have managed to prove that.

               

              the Heap is set to 0x200 and the Stack is 0x1000...

              When this "crash" happens, I have proved that WDT ISR and Button ISR are still working...

               

              I have made one change that maybe has fixed the issue (but it doesn't make sense yet to me)

              I have changed the IMO clock from 3 MHZ to 16 MHz

              Now on 5 units, I'm unable to reproduce the issue.

              Did I fix the issue? why this should make a difference?

               

              • 4. Re: BLE Seems crashing randomly during Low power Mode
                FrPo_1282226

                Still happen!

                for some reason I can't exit from the CyExitCriticalSection()

                the heal is set to 0x200 and the stack size is set to 0x1000

                Any suggestion please?

                 

                • 5. Re: BLE Seems crashing randomly during Low power Mode
                  himam_31

                  Hello,

                   

                  I assume you are using a custom board. Can you try if you are able to recreate the issue on development kit. We would like to see if this is hardware specific issue.

                   

                  Thanks,

                  Hima