How is the low power levels handled with ChibiOS/RT 3?

Discussions and support about ChibiOS/RT, the free embedded RTOS.
Post Reply
MuratUrsavas
Posts: 8
Joined: Mon May 12, 2014 11:29 am

How is the low power levels handled with ChibiOS/RT 3?

Post by MuratUrsavas »

As you know many of the MCU's (especially ARM CM's) provides some different low power levels.

For example take the EFM32's. There are 4 low power modes (EM1-4). Two of them is usable for ChibiOS Idle thread(EM1,2). Most of the time EM2 is the best mode for idle, but sometimes, some tasks needs some high speed peripherals running while the CPU is off (EM1).

The same scenario can be applied to the STM32L0's. (Unfortunately STM32L1's are not good for tickless mode).

How is this handled with ChibiOS 3? How can I make sure the idle thread enters to the required low power level?
User avatar
Giovanni
Site Admin
Posts: 14891
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: How is the low power levels handled with ChibiOS/RT 3?

Post by Giovanni »

Hi,

In chconf.h there are two hooks, those are invoked when entering/leaving the idle thread, you can switch mode there (and check conditions in order to decide the mode).

Giovanni
MuratUrsavas
Posts: 8
Joined: Mon May 12, 2014 11:29 am

Re: How is the low power levels handled with ChibiOS/RT 3?

Post by MuratUrsavas »

But doesn't that mean I have to use just a single mode per project?
User avatar
Giovanni
Site Admin
Posts: 14891
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: How is the low power levels handled with ChibiOS/RT 3?

Post by Giovanni »

In the hook you can decide to which mode switch to. The kernel is agnostic to modes, it just tells you:
- I am going in idle.
- I am leaving idle.

Giovanni
MuratUrsavas
Posts: 8
Joined: Mon May 12, 2014 11:29 am

Re: How is the low power levels handled with ChibiOS/RT 3?

Post by MuratUrsavas »

OK. Then a counting semaphore is the best method to decide which mode to use. Thanks Giovanni.
Post Reply