Sometimes the cpu never wake up from sleep

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

Sometimes the cpu never wake up from sleep

662 Views
soli
Contributor I

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?

 

0 Kudos
2 Replies

434 Views
PetrM
Senior Contributor I

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

 

434 Views
soli
Contributor I

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.

 

0 Kudos