80 #define RTC_ALARM_TIME 5
91 "\r\n==========================================================================\r\n"
92 "NXP Semiconductors LPC18xx/43xx MCU Power Management Controller example \r\n"
93 "=============================================================================\r\n"
94 "Select the power state test to be executed \r\n"
95 " - Sleep state & Wake up test : Press '1' to select \r\n"
96 " - Deep Sleep state & Wake up test : Press '2' to select \r\n"
97 " - Power down state & Wake up test : Press '3' to select \r\n"
98 " - Deep power down state & Wake up test : Press '4' to select \r\n"
99 " - Exit the demo : Press 'X' or 'x' to select \r\n"
100 "=============================================================================\r\n";
101 static char menu1[] =
"\r\nSelect the Wake up signal \r\n"
102 " - WAKEUP0 pin : Press 'W' or 'w' to select \r\n"
103 " - RTC Alarm : Press 'R' or 'r' to select \r\n";
105 static char menu2[] =
"PMC demo example terimnated \r\n";
106 static char menu3[] =
"\r\nPress 'C' or 'c' to start demo...\r\n";
114 #if defined(CHIP_LPC43XX)
120 #if defined(USE_RMII)
155 while (exitflag ==
RESET) {
160 if ((buffer ==
'W') || (buffer ==
'w')) {
161 DEBUGOUT(
"WAKEUP0 pin selected \r\n");
166 if ((buffer ==
'R') || (buffer ==
'r')) {
167 DEBUGOUT(
"RTC Alarm selected \r\n");
182 #ifndef BOARD_NGX_XPLORER_18304330
184 LPC_EMC->DYNAMICCONTROL |= (1 << 2);
185 while (!(
LPC_EMC->STATUS & (1 << 2))) {}
194 for (i = 0; i < (
sizeof(
InitClkStates) /
sizeof(InitClkStates[0])); i++) {
201 InitClkStates[i].powerdn);
210 #ifdef BOARD_KEIL_MCB_18574357
228 #ifdef BOARD_KEIL_MCB_18574357
244 for (i = 0; i < (
sizeof(
InitClkStates) /
sizeof(InitClkStates[0])); i++) {
250 LPC_CREG->CREG0 &= ~((1 << 3) | (1 << 2));
251 LPC_CREG->CREG0 |= (1 << 1) | (1 << 0);
255 #if (MAX_CLOCK_FREQ > 180000000)
274 #ifndef BOARD_NGX_XPLORER_18304330
276 LPC_EMC->DYNAMICCONTROL &= ~(1 << 2);
277 while (
LPC_EMC->STATUS & (1 << 2)) {}
296 NVIC_DisableIRQ(EVENTROUTER_IRQn);
299 NVIC_SetPriority(EVENTROUTER_IRQn, ((0x01 << 3) | 0x01));
302 NVIC_EnableIRQ(EVENTROUTER_IRQn);
312 uint8_t confirm = 0xFF;
347 while ( (confirm !=
'C') && (confirm !=
'c')) {
353 DEBUGOUT(
"Entering 'Sleep' state ...\r\n");
359 DEBUGOUT(
"Press WAKEUP0 button/Connect WAKEUP0 pin to 3.3V to exit 'Sleep' mode \r\n");
367 DEBUGOUT(
"Entering 'Deep Sleep' state ...\r\n");
373 DEBUGOUT(
"Press WAKEUP0 button/Connect WAKEUP0 pin to 3.3V to exit 'Deep Sleep' mode \r\n");
389 DEBUGOUT(
"Entering 'Power Down' state ...\r\n");
395 DEBUGOUT(
"Press WAKEUP0 button/Connect WAKEUP0 pin to 3.3V to exit 'Power Down' mode \r\n");
412 DEBUGOUT(
"Entering 'Deep Power Down' state ...\r\n");
418 DEBUGOUT(
"Press WAKEUP0 button/Connect WAKEUP0 pin to 3.3V to exit 'Deep Power Down' mode \r\n");
449 NVIC_DisableIRQ(EVENTROUTER_IRQn);
457 NVIC_DisableIRQ(EVENTROUTER_IRQn);
470 uint8_t Wake_RTC = 0;
482 while (exitflag ==
RESET) {
489 DEBUGOUT(
"'Sleep' state test selected \r\n");
496 DEBUGOUT(
"'Deep Sleep' state test selected \r\n");
503 DEBUGOUT(
"'Power Down' state test selected \r\n");
510 DEBUGOUT(
"'Deep Power Down' state test selected \r\n");