Page 1 of 1
Idle task and WFI
Posted: Mon Nov 14, 2016 9:19 am
by vrollei
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
Re: Idle task and WFI
Posted: Mon Nov 14, 2016 9:52 am
by Giovanni
Hi,
Strange problem, moving this topic in "bug reports".
Giovanni
Re: Idle task and WFI
Posted: Thu Jan 12, 2017 9:52 am
by Giovanni
Bumped.
Re: Idle task and WFI
Posted: Thu Jan 12, 2017 11:48 am
by Giovanni
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
Re: Idle task and WFI
Posted: Thu Jan 12, 2017 11:58 am
by vrollei
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
Re: Idle task and WFI
Posted: Thu Jan 12, 2017 1:18 pm
by Giovanni
Hi,
In my case WFI is inlined in the idle loop, there is no function call, what compiler options are you using?
Giovanni
Re: Idle task and WFI
Posted: Thu Jan 12, 2017 1:30 pm
by vrollei
[font=Courier New]# 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[/font]
Re: Idle task and WFI
Posted: Thu Jan 12, 2017 2:43 pm
by Giovanni
Hi,
It is because -O0 (no optimizations), that disables inlining, if you are concerned by consumption you should really use at least -O2.
Giovanni
Re: Idle task and WFI
Posted: Thu Jan 12, 2017 2:45 pm
by vrollei
Giovanni,
thanks a lot!