I use the lw_gpio_interrrupt to wake up from sleep mode in task_A. If I do this in the same task everything runs well.
Therefor I start the sleep like this: _lpm_set_operation_mode ( LPM_OPERATION_MODE_SLEEP ); I use codewarior with MQX3.8.
But if I start the slpee mode in a second task (task_B) sometimes the cpu never wake up. Sometimes It wake up for 5 or 6 times. But than the cpu does not wake up again.
Is it not allowed to start the sleep mode in another task than the gpio_interrupt is handeld?
Hello,
SLEEP operation mode has by default set LPM_CPU_POWER_MODE_FLAG_SLEEP_ON_EXIT flag. This means, that CPU core goes to sleep again after any ISR finishes. In order to let the core run again, you have to call function _lpm_wakeup_core() inside your gpio ISR.
The operation mode change can be done from any task, there's no connection to initialization of your gpio interrupt. But check the priorities of your tasks, maybe you are continuously switching to the SLEEP mode in a loop.
Regarding the timer component, it's required that you cancel the timer in a task that created it.
Regards,
PetrM
In case there is a active timer (_timer_create_component) the problem will occur too. Only if I cancel the timer (_timer_cancel) the cpu will wake up.