2 Replies Latest reply on May 8, 2015 2:55 AM by davide.urbano

    Why PSoC5LP exit sleep mode causes a reset ?

    davide.urbano

      Hi to all,

         

      I'm facing with a strange problem about my PSoC5LP, trying to put it correctly in sleep mode, using a sleep timer to wake-up. I noted 2 things:

         

      1) even if I use a 4096ms sleep timer, the psoc exits from sleep mode about a little bit more than 1 second;
      2) when the psoc exit from sleep mode, there is a reset.

         

      This is the code to put it in sleep mode:

         

      ==============================================================

         

                  isr_rx_uart_dbg_Stop();
                  UART_DBG_Sleep();
                  I2C_TCA_Sleep();
                  TPS65290_SPI_Sleep();
                 
                  /* Start SleepTimer's operation with the customizer's settings */                           
                  SleepTimer_Start();
                  isr_wake_from_sleep_ClearPending();
                  isr_wake_from_sleep_StartEx(WakeupIsr); /* interrupt sleep timer */
                 
                 
                  Pin_dbg_Write(1u);
                  /* Prepares system clocks for the Sleep mode */
                  CyPmSaveClocks();
                  /*******************************************************************
                  * Switch to the Sleep Mode for the other devices:
                  *  - PM_SLEEP_TIME_NONE: wakeup time is defined by Sleep Timer
                  *  - PM_SLEEP_SRC_CTW :  wakeup on CTW sources is allowed
                  *******************************************************************/
                  CyPmSleep(PM_SLEEP_TIME_NONE, PM_SLEEP_SRC_CTW);
                                             
                  /* Restore clock configuration */
                  CyPmRestoreClocks();
                     
                  isr_rx_uart_dbg_Start();
                  UART_DBG_Wakeup();
                  I2C_TCA_Wakeup();
                  TPS65290_SPI_Wakeup();
                 
                  UART_DBG_PutString("Exit from sleep mode \n");

         

      =================================================================

         

      CY_ISR(WakeupIsr)
      {
          Pin_dbg_Write(0u);
          /***************************************************************************
          * This function must always be called (when the Sleep Timer's interrupt
          * is disabled or enabled) after wake up to clear the ctw_int status bit.
          * It is required to call SleepTimer_GetStatus() within 1 ms (1 clock cycle
          * of the ILO) after CTW event occurred.
          ***************************************************************************/
          SleepTimer_GetStatus();
      }

         

      ================================================================

         

      I read all application notes about this low power mode and I have followed what they have told me, but there are these 2 problems; please, could anyone give me an hand ?

         

      Regards

        • 1. Re: Why PSoC5LP exit sleep mode causes a reset ?
          hima

           Hello,

             

           

             

          Can you use CyPmReadStatus(CY_PM_CTW_INT) for clearing the interrupt as soon as PSoC wakes up? Please let us know if this makes any ipmrovement.

             

          Thanks,

             

          Hima

          • 2. Re: Why PSoC5LP exit sleep mode causes a reset ?
            davide.urbano

            Dear HIMA,

               

            I used the instruction CyPmReadStatus(CY_PM_CTW_INT); in the interrupt routine

               

            CY_ISR(WakeupIsr)
            {
                Pin_dbg_Write(0u);
                /***************************************************************************
                * This function must always be called (when the Sleep Timer's interrupt
                * is disabled or enabled) after wake up to clear the ctw_int status bit.
                * It is required to call SleepTimer_GetStatus() within 1 ms (1 clock cycle
                * of the ILO) after CTW event occurred.
                ***************************************************************************/
                CyPmReadStatus(CY_PM_CTW_INT);
                SleepTimer_GetStatus();
            }

               

            but nothing has changed. Please, could you suggest me another solution ?