Hi,
I am using KL27 and implement my code on IAR workbench with freertos, then a stranger thing happened that is my device can be wakeup interrupt by the port C from pin 3 to pin 7, but pin 1 and pin 2 are not responding. All these 7 pins are configured as GPIO and connected to either push switches and slide switches. I measured the current and my device is successfully entered into normal stop mode, even I tried to configure some pin that cannot wakeup the device, that still works fine. But pin 1 and pin 2 are not under my configuration. In addition, I also tried with my development board, the function works fine. Not sure if I miss or make something wrong. Please see my code below and kindly advise.
Thank you.
Gilbert
void APP_STOPmode() // Stop mode entry
{
f_LOW_POWER = true;
vTaskSuspendAll();
APP_SetWakeupConfig();
SMC_SetPowerModeStop(SMC, kSMC_PartialStop);
}
void APP_SetWakeupConfig() // Wakeup pin configuration
{
PORT_SetPinInterruptConfig(BOARD_PTC_PORT, BOARD_PTC1_GPIO_PIN, kPORT_InterruptEitherEdge);
PORT_SetPinInterruptConfig(BOARD_PTC_PORT, BOARD_PTC2_GPIO_PIN, kPORT_InterruptEitherEdge);
PORT_SetPinInterruptConfig(BOARD_PTC_PORT, BOARD_PTC3_GPIO_PIN, kPORT_InterruptEitherEdge);
PORT_SetPinInterruptConfig(BOARD_PTC_PORT, BOARD_PTC4_GPIO_PIN, kPORT_InterruptEitherEdge);
PORT_SetPinInterruptConfig(BOARD_PTC_PORT, BOARD_PTC5_GPIO_PIN, kPORT_InterruptEitherEdge);
PORT_SetPinInterruptConfig(BOARD_PTC_PORT, BOARD_PTC6_GPIO_PIN, kPORT_InterruptEitherEdge);
PORT_SetPinInterruptConfig(BOARD_PTC_PORT, BOARD_PTC7_GPIO_PIN, kPORT_InterruptEitherEdge);
}
void APP_PostSleepConfig() // Pin usage configuration after wakeup
{
PORT_SetPinInterruptConfig(BOARD_PTC_PORT, BOARD_PTC1_GPIO_PIN, kPORT_InterruptEitherEdge);
PORT_SetPinInterruptConfig(BOARD_PTC_PORT, BOARD_PTC2_GPIO_PIN, kPORT_InterruptOrDMADisabled);
PORT_SetPinInterruptConfig(BOARD_PTC_PORT, BOARD_PTC3_GPIO_PIN, kPORT_InterruptFallingEdge);
PORT_SetPinInterruptConfig(BOARD_PTC_PORT, BOARD_PTC4_GPIO_PIN, kPORT_InterruptFallingEdge);
PORT_SetPinInterruptConfig(BOARD_PTC_PORT, BOARD_PTC5_GPIO_PIN, kPORT_InterruptFallingEdge);
PORT_SetPinInterruptConfig(BOARD_PTC_PORT, BOARD_PTC6_GPIO_PIN, kPORT_InterruptFallingEdge);
PORT_SetPinInterruptConfig(BOARD_PTC_PORT, BOARD_PTC7_GPIO_PIN, kPORT_InterruptEitherEdge);
}
if (f_LOW_POWER) // Wakeup point
{
SMC_SetPowerModeRun(SMC);
APP_PostSleepConfig();
xTaskResumeAll();
f_LOW_POWER = false;
}