I am working to a project with LPC4337 and I need to wake up processor from deep-sleep using RTC. Most of the time the processor is in deep-sleep mode and wakes up on a preset moment of time, do some jobs and going back in to deep-sleep. To test this I used a modified version of “misc_pmc_states” but in don’t work - my board is very small and I haven’t space for a UART debug interface. The project works if the wake up is trigger by WAKEUP0. If I try to use RTC_ALARM_TIME, not alarm timer peripheral, the processor goes in to deep-sleep mode and don’t wake up – I connected a mA’s on the power line and I can measure the current in real time so I can see in which mode the processor is. I tried everything I found on the Internet, also on this forum, but the result was the same. How I can solve this problem without another chip on the board - a dedicated RTC chip connected to a wakeup pin?
Hi Iordănescu Vasile
Thank you for your interest in NXP Semiconductor products and the opportunity to serve you.
I think there's something wrong with the misc_pmc_states demo in the lpcxpresso_nxp_lpcxpresso_4337.
To provide the fastest possible support, I'd like to recommend you to refer to the misc_pmc_states demo in the lpcxpresso_keil_mcb_4357. It can definitely work well.
Hope it helps.
Have a great day,
TIC
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hi Jeremy Zhou,
I got the same problem. I checked the mis_pmc_states project for lpcxpresso_nxp_lpcxpresso_4337 and lpcxpresso_keil_mcb_4357. It seems no difference between them. Adding delay after Chip_RTC_Enable() can make "wake form ATIMER" work, but not RTC_ALARM in deelp sleep, power down modes. I think the sample codes use both ATIMER and RTC_ALARM events at the same time while selecting RTC for wakeup. And actually, the MCU will be wakeup by ATIMER not RTC_ALARM. If we remove the ATIMER settings and leave the codes for RTC_ALARM, you will find that RTC_ALARM won't work. However, it is ok for sleep mode. Do you have any further suggestion that i can try?
Hi Irving Liu,
Thanks for your sharing.
Please giving a try to use the following code to enable RTC alarm interrupt as the wake-up source.
Chip_RTC_DeInit(LPC_RTC);
/* Configure EVRT_SRC_RTC as wake up signal */
Chip_EVRT_ConfigIntSrcActiveType(EVRT_SRC_RTC, EVRT_SRC_ACTIVE_HIGH_LEVEL);
Chip_EVRT_SetUpIntSrc(EVRT_SRC_ATIMER, ENABLE);
/* Initialize and configure RTC */
Chip_RTC_Init(LPC_RTC);
Chip_RTC_ResetClockTickCounter(LPC_RTC);
Chip_RTC_SetTime(LPC_RTC, RTC_TIMETYPE_SECOND, 0);
/* Set alarm time = RTC_ALARM_TIME seconds.
* So after each RTC_ALARM_TIME seconds, RTC will generate and wake-up system
*/
Chip_RTC_SetAlarmTime(LPC_RTC, RTC_TIMETYPE_SECOND, RTC_ALARM_TIME);
Chip_RTC_CntIncrIntConfig(LPC_RTC, RTC_AMR_CIIR_IMSEC, DISABLE);
Have a great day,
TIC
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hi Jeremy,
It still doesn't work.
Btw, why do we need to call Chip_EVRT_SetUpIntSrc(EVRT_SRC_ATIMER, ENABLE)?
I think it is for enabling ATIMER event routing, not for RTC_ALARM.