[SOLVED] Deep-Sleep mode on LPC11C24

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

[SOLVED] Deep-Sleep mode on LPC11C24

1,819 Views
f_fiorini
Contributor III

Hi, 
I am currently working on a project including the LPC11C24 board (in particular, we're testing using LPCXpresso LPC11C24 Rev B board) and I would like to implement deep-sleep mode.
I searched through Internet but I couldn't find some example code, so I tried to write something using the User Manual (UM10398) but I got some problems... In particular, the chip didn't wake up after the watchdog finished. 

Here's the code: 

void enter_sleep_state()

{

   //TODO: comment out all instructions

   LPC_PMU->PCON = 0x00000100;

   LPC_SYSCTL->PDRUNCFG = 0x0000EDBC;

   LPC_SYSCTL->MAINCLKSEL = 0x00000002;

   LPC_SYSCTL->PDSLEEPCFG = 0x000018BF; //WDT on, BOD off

   LPC_SYSCTL->PDWAKECFG = 0x0000ED48;

   Chip_WWDT_Init(LPC_WWDT);

   Chip_WWDT_SetTimeOut(LPC_WWDT, 100000); //Sets WDT timeout (ms?) TODO: check this out

   NVIC_EnableIRQ(WDT_IRQn);

   LPC_SYSCTL->SYSAHBCLKCTRL = 0x00008000 /*<< 1 ??*/;

   SCB->SCR |= (1<<2);

__WFI();

}

After calling this mode I entered LPC_SYSCTL->MAINCLKSEL = 0x00000000 to set the main clock source back to normal.

Apparently there's something that I miss and I'd like to know. 

Thank you in advance :smileywink:


P.S: I also noticed that the deep-sleep mode is not really available for lpc11c24, though it's present as an option in both the user manual and the datasheet. Why is that? 

Labels (3)
11 Replies

1,460 Views
jeremyzhou
NXP Employee
NXP Employee

Hi Federico Fiorini,

Thank you for your interest in NXP Semiconductor products and the opportunity to serve you.
To provide the fastest possible support, I'd recommend you to refer to the attachment for details.
Have a great day,
TIC

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

1,460 Views
f_fiorini
Contributor III

In addition, from when I ran the PMU test onwards I can't get the board working again, I also tried resetting it but apart from LED2 blinking, nothing happened.
This is the error I'm getting (see attached picture)Screenshot 2018-12-12 at 14.11.39.png

0 Kudos

1,460 Views
jeremyzhou
NXP Employee
NXP Employee

Hi Federico Fiorini,

I'd like to share an approach to fix this issue with you, please follow the below steps and you can learn how to use the Flash Magic via the link: https://learn.adafruit.com/getting-started-with-the-lpc810/programming-the-lpc810-with-flash-magic

1. Force the LPC11U35 enter the UART ISP mode.
2. Establish the connection between the MCU and Flash Magic.
3. Erase the full flash area in the MCU.
Have a great day,
TIC

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

1,460 Views
f_fiorini
Contributor III

Another thing: if the board is still in sleep mode, will it go to ISP boot mode without any problems? 
If so, the reason for UART-ISP and CAN-ISP not functioning properly might be some sort of setup misconfiguration or power supply problems

0 Kudos

1,460 Views
jeremyzhou
NXP Employee
NXP Employee

Hi Federico Fiorini,

Thanks for your reply.
To force the MCU enter the ISP mode, it needs to reset the MCU via POR or external reset pin, After that, the loader can execute the ISP command handler or the user application code. A LOW level after reset at the PIO0_1 pin is considered as an external hardware request to start the ISP command handler either via UART or C_CAN, if present. Meanwhile, the state of pin PIO0_3 at reset together with a LOW level on pin PIO0_1 determines whether UART ISP or C_CAN ISP.
So come back to your question, if the board is still in sleep mode, will it go to ISP boot mode without any problems? The answer is the board can enter the ISP regardless of current low power mode.
Have a great day,
TIC

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

1,460 Views
f_fiorini
Contributor III

Hi jeremyzhou‌, 
Many thanks for the time spent answering! :smileyhappy:
Luckily I was able to reset the board (I don't know why previously resetting while asserting ISP didn't work...) and now I can go back to the code and find what's wrong with it. 

I tried to debug the wake-up procedure and the code gets stuck in the section IntDefaultHandler, so probably I didn't set up the Wakeup interrupt handler correctly.

In any case I'll mark this issue as solved as the original question is answered.
Should I open another issue (question) for this other problem or can it be answered down here? 

0 Kudos

1,460 Views
jeremyzhou
NXP Employee
NXP Employee

Hi Federico Fiorini,

Thanks for your reply.
I'd like to suggest that you create another case about this new question.
Thanks for your understand.
Have a great day,
TIC

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

0 Kudos

1,460 Views
f_fiorini
Contributor III

Hi jeremyzhou‌, I tried to use the approach explained in the link but apparently it doesn't work properly for some reason...

I forced the LPC11C24 to ISP mode by connecting PIO0_1 to GND while PIO0_3 was pulled to Vcc (high) to make it working under UART ISP.
I then connected the board to the USBtoUART device we are using and set everything up on Flash Magic, but apparently I got error "Failed to autobaud - step1". 
I searched for it and apparently it could be because of some problems in the MCU... 

Is there another possible way to force the reset? 
I also tried ISP over CAN but that didn't work as well

0 Kudos

1,460 Views
f_fiorini
Contributor III

jeremyzhou‌ I would also like to know something about debugging while in deep sleep mode for LPC11C24. 

As obvious, when I start running the program to go into deep sleep mode, the debug gives me an error and I have to exit it. 
Nevertheless, I know that I can debug a running code using the "Attach Only" option, but how am I sure that such disconnection in the debug probe didn't cause the program to stop? 
Is there a way to know if the program is still running correctly? Or to just flash the code in the board with no debug via USB?

Thank you in advance.

0 Kudos

1,460 Views
jeremyzhou
NXP Employee
NXP Employee

Hi Federico Fiorini,

1) Is there a way to know if the program is still running correctly? Or to just flash the code in the board with no debug via USB?
-- I'm afraid it will lose debug connection when MCU enters the low power mode, and test the current consumption is a good way to validate whether the MCU enter the low power mode successful.

Have a great day,
TIC

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

0 Kudos

1,460 Views
f_fiorini
Contributor III

jeremyzhou‌ thank you for the prompt reply! 

0 Kudos