11 Replies Latest reply on Oct 6, 2019 3:09 PM by MaKo_1526276

    Cannot wake up from sleep when DieTemp_Start ()

    MaKo_1526276

      I added CyPmSleep () to my program with reference to the sleep timer sample code.

      But did not wakeup.

       

      As a result of investigating the cause, it was found that DieTemp_Start () does not wake up

      Executing DieTemp_Stop () had no effect

       

      I want to measure die temperature and sleep

      Is there a solution

       

       

      device:CY8C5888LTI-LP097

      PSoC Creator 4.2

      DieTemp Ver.2.1

      SleepTimer Ver3.2

       

      I'm sorry.I am inconvenient in English.

        • 1. Re: Cannot wake up from sleep when DieTemp_Start ()
          RuzheZ_36

          Kono-san,

           

          As per my understanding, the question is: after wake-up,  DieTemp can not work. Is it right?

          Could you share the project with using attachment?

          • 2. Re: Cannot wake up from sleep when DieTemp_Start ()
            MaKo_1526276

            Hi Ryan

             

            No, that does n’t mean

            Sorry for the bad explanation

             

             

            This code works

            int main()

            {

                /* Enable global interrupts */

                 CyGlobalIntEnable;

             

                 SleepTimer_Start();

                 CyPmSaveClocks();

                 CyPmSleep(PM_SLEEP_TIME_NONE, PM_SLEEP_SRC_CTW);

                 CyPmRestoreClocks();

             

                 ・・・・・

             

            }

             

             

            But this code doesn't work

            Do not wake up from sleep

            int main()

            {

                /* Enable global interrupts */

                 CyGlobalIntEnable;

             

                 DieTemp_Start() ;

                 DieTemp_Stop() ;

             

                 SleepTimer_Start();

                 CyPmSaveClocks();

                 CyPmSleep(PM_SLEEP_TIME_NONE, PM_SLEEP_SRC_CTW);

                 CyPmRestoreClocks();

             

                 ・・・・・

            }

            • 3. Re: Cannot wake up from sleep when DieTemp_Start ()
              LePo_1062026

              MaKo,

               

              You're missing something:

              int16 temperature;

                   DieTemp_Start() ;

                   DieTemp_GetTemp(&temperature)

                   DieTemp_Stop() ;

               

              // temperature should now have your dietemp.

               

              Unless I misunderstood your question, this should return a dietemp.

               

              Len

              • 4. Re: Cannot wake up from sleep when DieTemp_Start ()
                MaKo_1526276

                HI Len,

                thank you for your comment

                 

                I'm sorry but that doesn't mean that

                 

                The problem is that PSoC cannot wake up

                Execute DieTemp command before sleep command

                 

                 

                I experimented with the following code

                int main()

                {

                 

                    /* Enable global interrupts */

                     CyGlobalIntEnable;

                 

                     Pin_LED_write(0);

                 

                #if 0

                     int16 temperature;

                     DieTemp_Start() ;

                     DieTemp_GetTemp(&temperature)

                     DieTemp_Stop() ;

                #endif

                 

                     SleepTimer_Start();

                     CyPmSaveClocks();

                     CyPmSleep(PM_SLEEP_TIME_NONE, PM_SLEEP_SRC_CTW);

                     CyPmRestoreClocks();

                 

                     Pin_LED_write(1);

                }

                 

                 

                #if 0 : LED Light on  = wake up

                #if 1    : LED Light off  = can't wake up

                 

                If DieTemp_Start()   or  DieTemp_GetTemp(&temperature) is executed Even once before the sleep command

                It becomes impossible to wake up

                • 5. Re: Cannot wake up from sleep when DieTemp_Start ()
                  LePo_1062026

                  MaKo,

                   

                  I now understand your issue.  I'll download your project.  Hopefully I'll have a solution/reason in the morning.

                   

                  Len

                   

                  Update 1: If I program the PSoC with DieTemp active the LED doesn't blink (mode 1).  If I debug the code, the LED blinks (mode 2).

                   

                  Still digging in ...

                   

                  Update 2: In mode 2, I receive a short pulse from the SleepTimer about every 4 ms.  In mode 1, nothing.  No pulses.

                   

                  Update 3:  Hopefully someone from Cypress is monitoring this discussion

                   

                  New information

                  There appears to be an unintended interaction between the following code sequence:

                   

                  DieTemp_1_Start() ;  ... CySpcGetTemp() {

                  ...

                       CY_SPC_CPU_DATA_REG = CY_SPC_KEY_ONE;

                       CY_SPC_CPU_DATA_REG = CY_SPC_KEY_TWO(CY_SPC_CMD_GET_TEMP);

                       CY_SPC_CPU_DATA_REG = CY_SPC_CMD_GET_TEMP;

                  ...

                  };

                   

                  and

                  CyPmSleep() {

                  ...

                       CY_PM_WFI;

                  ...

                  };

                   

                  if DieTemp_1_Start() is removed, the ILO sources to the SleepTimer properly.

                  if DieTemp_1_Start() precedes CyPmSleep(), it appears the ILO is effectively disabled while in CyPmSleep() preventing SleepTimer terminal counts.

                   

                  Len.

                  • 6. Re: Cannot wake up from sleep when DieTemp_Start ()
                    MaKo_1526276

                    Len,

                    Thank you for testing

                     

                    I see!

                    It means that SleepTimer doesn't work

                    rather than not wake up from sleep.

                     

                    Hopefully someone from Cypress is monitoring this discussion

                    me too

                    • 7. Re: Cannot wake up from sleep when DieTemp_Start ()
                      RuzheZ_36

                      Kono-san,

                       

                      Could you refer DieTemp_BasicTest code example in PSoC Creator?

                      DieTemp_Start() should be called pair with DieTemp_QueryDieTemp().

                      If DieTemp_Start()  is called successfuly, SPC(system performance controller, ) will be locked and other resource may not be able to use SPC.

                      So it requires to call DieTemp_QueryDieTemp to unlock SPC to make sure system can work well.

                       

                      So in this case, if you have read the DieTemp_BasicTest code example, you will find it doesn't need to call DieTemp_Start() before while loop(it will be called in DieTemp_GetTemp(&temperature), also the DieTemp_QueryDieTemp()) .

                      • 8. Re: Cannot wake up from sleep when DieTemp_Start ()
                        MaKo_1526276

                        Ryan

                        thank you for your comment

                         

                        I carefully read Die Temperature's Component Datasheet

                        I found this description

                         

                        Note that the device should not enter low power modes during temperature measurements. After calling DieTemp_Start() you should wait for the DieTemp_Query() API to report the status of the request that is different from CYRET_STARTED. For more information see the DieTemp_Query() API description.

                         

                         

                        So if I did the DieTemp code like this, it worked fine

                        After this I was able to wake up from sleep

                        I could get the temperature

                         

                         

                                DieTemp_Start() ;

                                while(CYRET_STARTED == DieTemp_Query(&temperature));

                                DieTemp_Start() ;

                                while(CYRET_STARTED == DieTemp_Query(&temperature));

                         

                         

                        The reason for running twice

                        DieTemp_Query API  Description:

                        The Die Temperature reading returned on the first sequence of DieTemp_Start() followed by DieTemp_Query() can be unreliable, so you must do this sequence twice and use the value returned from the second sequence.

                         

                         

                        Thank you

                        the problem seems to be solved.

                        • 9. Re: Cannot wake up from sleep when DieTemp_Start ()
                          LePo_1062026

                          Ryan,

                           

                          Apparenty ...

                               DieTemp_Start() ;

                               DieTemp_GetTemp(&temperature);

                               DieTemp_Stop() ;

                          ... is not the functional equivalent as:

                                  DieTemp_Start() ;

                                  while(CYRET_STARTED == DieTemp_Query(&temperature));

                                  DieTemp_Start() ;

                                  while(CYRET_STARTED == DieTemp_Query(&temperature));

                          .. regarding access to low-power modes.

                          However ...

                               DieTemp_GetTemp(&temperature);

                          ... does work!!!

                          It appears when using DieTemp_GetTemp(), DieTemp_Start()/DieTemp_Stop() is not necessary.

                          Len

                          • 10. Re: Cannot wake up from sleep when DieTemp_Start ()
                            LePo_1062026

                            Hi,

                             

                            If Ryan answered your question correctly, please select "Correct Answer" on his posting to close this discussion.  This will help others with a similar problem if they are looking for a solution to try.

                             

                            Len

                            • 11. Re: Cannot wake up from sleep when DieTemp_Start ()
                              MaKo_1526276

                              Thank you for the advice.

                              I selected "Correct Answer"

                               

                              Thank you very much for answering