Idle task and WFI Topic is solved

Report here problems in any of ChibiOS components. This forum is NOT for support.
vrollei
Posts: 163
Joined: Sun Nov 13, 2016 8:44 am
Been thanked: 26 times

Idle task and WFI  Topic is solved

Postby vrollei » Mon Nov 14, 2016 9:19 am

Hello,

can not get idle task work correctly with ARM_ENABLE_WFI_IDLE = TRUE and STM32L1 low power sleep mode.

It works fine with modified _idle_thread function:

static void _idle_thread(void *p) {

(void)p;

while (true) {
/*lint -save -e522 [2.2] Apparently no side effects because it contains
an asm instruction.*/
__WFI();
// port_wait_for_interrupt();
// /*lint -restore*/
// CH_CFG_IDLE_LOOP_HOOK();
}
}

Chibios version 16.1.5

Thanks in advance!

--
Vitaly
Vitaly

User avatar
Giovanni
Site Admin
Posts: 14455
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1076 times
Been thanked: 922 times
Contact:

Re: Idle task and WFI

Postby Giovanni » Mon Nov 14, 2016 9:52 am

Hi,

Strange problem, moving this topic in "bug reports".

Giovanni

User avatar
Giovanni
Site Admin
Posts: 14455
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1076 times
Been thanked: 922 times
Contact:

Re: Idle task and WFI

Postby Giovanni » Thu Jan 12, 2017 9:52 am

Bumped.

User avatar
Giovanni
Site Admin
Posts: 14455
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1076 times
Been thanked: 922 times
Contact:

Re: Idle task and WFI

Postby Giovanni » Thu Jan 12, 2017 11:48 am

Hi,

I am unable to replicate the problem, by setting CORTEX_ENABLE_WFI_IDLE to TRUE a WFI instruction is placed inside the idle loop.

Giovanni

vrollei
Posts: 163
Joined: Sun Nov 13, 2016 8:44 am
Been thanked: 26 times

Re: Idle task and WFI

Postby vrollei » Thu Jan 12, 2017 11:58 am

Hi,

the problem is in different current consumption:

1. lowest current consumption with __WFI() directly put in while loop. It is about 5uA with one active timer for systick.
2. it is about 30-40uA using inline function port_wait_for_interrupt

compiled with gcc-arm-none-eabi-5_4-2016q3

--
Vitaly
Vitaly

User avatar
Giovanni
Site Admin
Posts: 14455
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1076 times
Been thanked: 922 times
Contact:

Re: Idle task and WFI

Postby Giovanni » Thu Jan 12, 2017 1:18 pm

Hi,

In my case WFI is inlined in the idle loop, there is no function call, what compiler options are you using?

Giovanni

vrollei
Posts: 163
Joined: Sun Nov 13, 2016 8:44 am
Been thanked: 26 times

Re: Idle task and WFI

Postby vrollei » Thu Jan 12, 2017 1:30 pm

# Compiler options here.
ifeq ($(USE_OPT),)
USE_OPT = -O0 -ggdb -fomit-frame-pointer -falign-functions=16
endif

# C specific options here (added to USE_OPT).
ifeq ($(USE_COPT),)
USE_COPT =
endif
Vitaly

User avatar
Giovanni
Site Admin
Posts: 14455
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1076 times
Been thanked: 922 times
Contact:

Re: Idle task and WFI

Postby Giovanni » Thu Jan 12, 2017 2:43 pm

Hi,

It is because -O0 (no optimizations), that disables inlining, if you are concerned by consumption you should really use at least -O2.

Giovanni

vrollei
Posts: 163
Joined: Sun Nov 13, 2016 8:44 am
Been thanked: 26 times

Re: Idle task and WFI

Postby vrollei » Thu Jan 12, 2017 2:45 pm

Giovanni,

thanks a lot!
Vitaly


Return to “Bug Reports”

Who is online

Users browsing this forum: No registered users and 7 guests