LPC4357 : DeepSleep wake-up induce a reset

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

LPC4357 : DeepSleep wake-up induce a reset

1,291 Views
julienbrissard
Contributor II

Hello,

My software goes in DeepSleep mode, but when the Wake-up happens (by wakeup0 pin), micro-controller is reset.I do not understand why ?How can I avoid this reset ?

I used Keil mcb4300 evaluation board and LPCOpen example "pmc_states" (See remark).

With the example I enter in DeepSleep mode, but when I press Wakeup0, the micro reset. I think that reset occurs because UART send the main menu after wakeup, but never send the following debug sentence : "Woken up". This sentence is correctly sent if I used the sleep mode, but not in deep-sleep.

Somebody is able to help me ?

Remark : I must add command "LPC_PMC->PD0_SLEEP0_HW_ENA |=1;" before calling Chip_PMC_Set_PwrState(PMC_DeepSleep), otherwise it is not working. This is explain on the forum.

Labels (2)
0 Kudos
8 Replies

855 Views
jeremyzhou
NXP Employee
NXP Employee

Hi julien brissard

Thank you for your interest in NXP Semiconductor products and 
the opportunity to serve you.
To provide the fastest possible support I want to point you to a 
similar question which has been answered on our NXP community. 
to view the details.
Have a great day,

TIC

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

855 Views
julienbrissard
Contributor II

Hi jeremyzhou,

Thank you for the link. unfortunately this is not solving the problem.

WakeUp occured, that is the first good step, but a reset also occured and this is not what is expected.

0 Kudos

855 Views
jeremyzhou
NXP Employee
NXP Employee

Hi julien brissard

Thanks for your reply.

Whether you can illustrated the steps of testing, then I can replicate the phenomenon.

I'm looking forward to your reply.
Have a great day,
TIC

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

855 Views
julienbrissard
Contributor II

Thank you to trying to help me.

Find here after my steps :

1- Take pmc_states example from LPCOpen

2- Add "LPC_PMC->PD0_SLEEP0_HW_ENA |=1;" before calling Chip_PMC_Set_PwrState(PMC_DeepSleep) in the case '2' of PMC_PwrState_Handler function.

3- Build project for LPC4357 target

4- Download software on mcb4300 evaluation board

4Bis- Open a terminal for UART communication

5- Reset program (Button reset of evalution board)

6- See the menu on terminal

7- Enter in option 2 : DeepSleep (press '2')

8- Choose option wakeup0 (press 'w')

9- Press 'c' to start demo

10- Press button wakeup0 on evaluation board

11- Look at result on terminal

If 'woken up" appears on the screen, followed by the menu, then wakeup as been correctly done.

Otherwise, if the menu direcly appears without 'woken up' sentence before, then wakeup have induced a reset because the next instruction of our program has not been executed.

You can compare the behavior with the option 1 of menu (Sleep mode)

0 Kudos

855 Views
jeremyzhou
NXP Employee
NXP Employee

Hi julien brissard,

Please adding the Chip_Clock_EnableCrystal(); as the following snippet shows, then try again.

case '2':
          DEBUGSTR("Entering 'Deep Sleep' state ...\r\n");
                 Chip_Clock_EnableCrystal(); //Inserting this code
          if (Wake_RTC) {
               DEBUGOUT("Wait for %d seconds, RTC alarm will wake up from 'Deep Sleep' mode \r\n", RTC_ALARM_TIME);
               Chip_RTC_Enable(LPC_RTC, ENABLE);
          }
          else {
               DEBUGSTR("Press WAKEUP0 button/Connect WAKEUP0 pin to 3.3V to exit 'Deep Sleep' mode \r\n");
          }
          Pwr_state = PMC_DeepSleep;
          while ((Chip_UART_ReadLineStatus(DEBUG_UART) & UART_LSR_TEMT) == 0) {}

          /* Call Pre SleepPowerDown function */
          PMC_Pre_SleepPowerDown();
          ‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

      
Have a great day,
TIC

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

855 Views
julienbrissard
Contributor II

Hi,

I have tried and it is not working. Is it working for you ?

Furthermore, I do not understand why I should activate Crystal clock since user manual mentions :

"In Deep-sleep mode the CPU clock and peripheral clocks are shut down"

"Before entering Deep-sleep mode, program the CGU as follows:
• Switch the clock source of all base clocks to the IRC.
• Put the PLLs in power-down mode."

Here the result of test :

==========================================================================
NXP Semiconductors LPC18xx/43xx MCU Power Management Controller example
=============================================================================
Select the power state test to be executed
 - Sleep state & Wake up test           : Press '1' to select
 - Deep Sleep state & Wake up test      : Press '2' to select
 - Power down state & Wake up test      : Press '3' to select
 - Deep power down state & Wake up test : Press '4' to select
 - Exit the demo                        : Press 'X' or 'x' to select
=============================================================================
'Deep Sleep' state test selected

Select the Wake up signal
 - WAKEUP0 pin : Press 'W' or 'w' to select
 - RTC Alarm   : Press 'R' or 'r' to select
WAKEUP0 pin selected

Press 'C' or 'c' to start demo...
Entering 'Deep Sleep' state ...
Press WAKEUP0 button/Connect WAKEUP0 pin to 3.3V to exit 'Deep Sleep' mode

==========================================================================
NXP Semiconductors LPC18xx/43xx MCU Power Management Controller example
=============================================================================
Select the power state test to be executed
 - Sleep state & Wake up test           : Press '1' to select
 - Deep Sleep state & Wake up test      : Press '2' to select
 - Power down state & Wake up test      : Press '3' to select
 - Deep power down state & Wake up test : Press '4' to select
 - Exit the demo                        : Press 'X' or 'x' to select
=============================================================================

You can see that between Deep-Sleep and main menu (after Wake-up), the instruction

DEBUGSTR("\r\nWoken up \r\n");

has not been sent.

0 Kudos

855 Views
jeremyzhou
NXP Employee
NXP Employee

Hi julien brissard,

Thanks for your reply.

The thread indicates that "here is a known bug in software that causes the part to not wake up properly from any low power state other than Sleep mode. To fix the wake-up for Deep-sleep,call "Chip_Clock_EnableCrystal();" upon wake-up from Deep-sleep mode (you can add it on line 347 of pmc_states.c). "

My LPCOpen version is lpcopen_2_20_keil_iar_keil_mcb_4357, the following figure illustrate the testing result.

pastedImage_3.png


Have a great day,
TIC

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

855 Views
julienbrissard
Contributor II

Hi jeremyzhou,

Thanks to you, i finally be able to Wake-up from Deep-Sleep mode.

I have to explain that for getting this result :

1- the call of "Chip_Clock_EnableCrystal();" shall be done just after "

Chip_PMC_Set_PwrState(Pwr_state);". If you do it before it is not working

2- You shall not write PD0_SLEEP0_HW_ENA register, even if it is explained in the user manual !!

(See forum subject "Deep-sleep issue with PD0_SLEEP0_HW_ENA register" / https://community.nxp.com/thread/419958). My mistake was that in the first try, pmc_states example let me locked in deep-sleep mode (or power down?), and by following UserManaul and adding this insctruction (write 1 in PD0_SLEEP0_HW_ENA) I was able to leave this state (but Wake-up induced a reset). And combination of writing PD0_SLEEP0_HW_ENA register and Chip_Clock_EnableCrystal() do not work.

I finally try to start from pmc_states example and just add Chip_Clock_EnableCrystal();" just after "Chip_PMC_Set_PwrState(Pwr_state);" (as you mentioned in your last post), and it works :-).

I hope that User Manual will be updated soon for other users.

Thank you for your support.

Have a good day

0 Kudos