LPC11U67 Power-down with FreeRTOS

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

LPC11U67 Power-down with FreeRTOS

822 Views
vladimirk
Contributor I

Hi,

I am trying to make a low-power application using an LPC11U67 in combination with FreeRTOS. 

I've implemented the power-down functionality based on the LPCOpen examples_11u6x periph_pmu code. The MCU needs to wake up with a pin interrupt which works with both PININT and GPIOGP interrupts. When FreeRTOS is not implemented, the MCU goes into power-down mode and wakes up on an interrupt, so I know that part is not the issue.

Power-down code:

/* BOD and WDT are not needed */
Chip_SYSCTL_SetDeepSleepPD(SYSCTL_DEEPSLP_BOD_PD | SYSCTL_DEEPSLP_WDTOSC_PD);
	
Chip_SYSCTL_SetWakeup(~(SYSCTL_SLPWAKE_IRCOUT_PD | SYSCTL_SLPWAKE_IRC_PD | SYSCTL_SLPWAKE_FLASH_PD | SYSCTL_SLPWAKE_SYSOSC_PD | SYSCTL_SLPWAKE_SYSPLL_PD));		
																																					 																
Chip_PMU_PowerDownState(LPC_PMU);

 

 PININT:

Chip_GPIO_SetPinDIRInput(LPC_GPIO, 1, 20);
Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_PINT);
Chip_SYSCTL_SetPinInterrupt(PININT0_INDEX, PININT0_PORT, PININT0_PIN);
Chip_SYSCTL_EnableStartPin(PININT0_INDEX);
Chip_PININT_ClearIntStatus(LPC_PININT, PININTCH0);
Chip_PININT_SetPinModeEdge(LPC_PININT, PININTCH0);
Chip_PININT_EnableIntLow(LPC_PININT, PININTCH0);
NVIC_ClearPendingIRQ(PIN_INT0_IRQn);
NVIC_EnableIRQ(PIN_INT0_IRQn);

 

With FreeRTOS there is one task that is woken up using a software timer. When the task is not running for a certain amount of time, the idle task is running, the power-down mode should be entered from the vApplicationIdleHook. But when the power-down code is called in the vApplicationIdleHook the MCU goes to power down and won't wake up with the interrupt that had previously worked without FreeRTOS. Furthermore, when trying to put the MCU in sleep mode from the idle hook using the

Chip_PMU_SleepState(LPC_PMU);

command, the program executes the code but does not enter sleep mode. Instead, it just continues as if there was no sleep command.

How would I go about putting the MCU to power-down mode from the idle task i having the system resume on a PININT?

Thanks in advance!

Labels (2)
0 Kudos
1 Reply

802 Views
EdwinHz
NXP TechSupport
NXP TechSupport

First, make sure you are handling the interruption correctly. Since interruptions are executed directly from the MCU, not the kernel, FreeRTOS implemented the “FromISR” functions in order to handle interruptions correctly from a task. Without these, the interrupt and the tasks would not be able to communicate with each other. Here’s a small example on how to handle interruptions from RTOS.

https://www.digikey.com/en/maker/projects/introduction-to-rtos-solution-to-part-9-hardware-interrupt...

As for the power down mode, I’m unsure why the MCU would be unable to go do power down mode if the pmu is executing it correctly. Perhaps this link might help for your inquiry:

https://www.freertos.org/low-power-tickless-rtos.html

 

Best regards,

Edwin.

0 Kudos