4 Replies Latest reply on Apr 4, 2019 3:14 PM by ErGo_3681856

    Help finding lockup


      We are using the CY8C4248 and having an intermittent, irregular lock-up of the main loop. Interrupts are still able to occur, so our WatchDogTimer still fires. After 60 of not running all the way through the main loop, we print the main stack (__get_MSP) and compare memory addresses to the elf file. The main stack trace appears to read:


      InterruptPointer(Same address as _getPSP)

      ll_wait_to_enter_dsm (possibly deep sleep mode?)






      enterLowPowerStateIfPossible (where we call CySysPmDeepSleep())




      1) Is it possible for deep sleep mode to stop waking when our timer is fired?


      2) What tools other than the debugger does cypress have to trace the source of lockups? We are using the bootloader, deep sleep mode, and interrupts. All of which aren't happy with attaching a debug tool.

        • 1. Re: Help finding lockup

          Here is the deep sleep mode code:



          void enterLowPowerStateIfPossible(void) {

              CYBLE_LP_MODE_T bleMode;

              uint8 interruptStatus;



          if((CyBle_GetState() == CYBLE_STATE_ADVERTISING) ||

             (CyBle_GetState() == CYBLE_STATE_CONNECTED)) {

                  bleMode = CyBle_EnterLPM(CYBLE_BLESS_DEEPSLEEP);

                  interruptStatus = CyEnterCriticalSection(); // Disable global interrupts

                  if(bleMode == CYBLE_BLESS_DEEPSLEEP) { // When BLE subsystem has been put into Deep-Sleep mode

          if( (CyBle_GetBleSsState() == CYBLE_BLESS_STATE_ECO_ON) ||

          (CyBle_GetBleSsState() == CYBLE_BLESS_STATE_DEEPSLEEP)) {




          else {

                      // And hardware doesn't finish Tx/Rx opeation - put the CPU into Sleep mode

          if(CyBle_GetBleSsState() != CYBLE_BLESS_STATE_EVENT_CLOSE) {





          CyExitCriticalSection(interruptStatus); // Enable global interrupt





          gblIRQ.watchdogTriggered = false;


          • 2. Re: Help finding lockup



            >>"Is it possible for deep sleep mode to stop waking when our timer is fired?"

            --> You can disable the Watch dog timer interrupt near the NVIC. Please check the IRQ number for Watch dog timer for the device you are using in the device Architecture TRM. Once you find the IRQ number, you can disable the interrupt using NVIC registers. Please refer ARM Cortex Mx Generic user guide for this.


            To debug the issue, I recommend you to remove the bootloader, Watchdog timer as well as DeepSleep API from the project and check if other functionality is working fine. Then you can introduce bootloader and Watchdog timer. Later you can use deep sleep commands and check.


            Please attach your project to understand the firmware flow.




            • 3. Re: Help finding lockup

              Hello Ganesh,


              I do not want to disable the watch dog timer. I am wondering why the watch dog timer stops waking up the device from deep sleep.


              When I remove the deep sleep mode, the device runs fine. With deep sleep, the device locks up randomly every 1-6 hours. The device appear to not leave  "enterLowPowerStateIfPossible()" as writen above, which is in our main loop.




              • 4. Re: Help finding lockup

                1) Is enterLowPowerStateIfPossible() written correctly?

                2) Is there an errata sheet for the CY8C4248? I can not locate one on the product webpage.