Cortex M4, low power mode

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

Cortex M4, low power mode

793 Views
_ZZ_
Contributor II

Hi every body,

this is going to be an easy one for most people I believe. 

the sleep functionality works fine, but I need to know this for something else. 

when the micro is in sleep mode (LLS), and it is woken up by an irq for instance a GPIO irq and set the event which fires the TASK B. where the code go first after wake up? what is the flow of the flow of the code  

does it go to the LLS isr then into GPIO isr or it is the other way around ? 

----------------- for example -------------------------

void task_A( )   // this task has lower priority to task B

{

   while (1)

    {

         do things;

         if (condition is met){

             WFI();            // goes into LLS sleep 

           }

        starts doing things again;

    }

}

void LLWU_IRQHandler( )        // LLS isr

{

    do the rigth things;

}

void  gpio_isr( )          // GPIO isr

{

   _lwevent_set(&event);   

}

void task_B( )   // this task has higher priority to task A

{

    while(1)

   {

        _lwevent_wait_ticks(&event);

         do stuff quickly;

        _lwevent_clear(&event);    

   }

}

thanks you 

0 Kudos
2 Replies

634 Views
mjbcswitzerland
Specialist V

Hi Roosbeh

You always wake with interrupts disabled, they have configurable priorities and order of calls (or which ones are of interest) can be controlled on exit from SLEEP.
See the following video for some ideas:

https://youtu.be/v4UnfcDiaE4

Regards

Mark

Kinetis: http://www.utasker.com/kinetis.html
Low power and LLWU: http://www.utasker.com/kinetis/LLWU.html
Low power videos:
- https://youtu.be/kWNlsAoMly4
- https://youtu.be/iZEMRiDmHzw
- https://youtu.be/v4UnfcDiaE4

Free Open Source solution: https://github.com/uTasker/uTasker-Kinetis
Working project in 15 minutes video: https://youtu.be/K8ScSgpgQ6M

For better, faster, cheaper product developments consider the uTasker developer's version, professional Kinetis support, one-on-one training and complete fast-track project solutions to set you apart from the herd : http://www.utasker.com/support.html

0 Kudos

634 Views
_ZZ_
Contributor II

Hi Mark,

thanks for your response. that was very helpful. 

it turned out that first LLWU isr is executed and we can clean the gpio Status Flag Register there, if we don't do it there then it will jump into the GOPI isr where we can clean it there. therefore.

regards,

Roosbeh 

0 Kudos