Page 1 of 1
chThdSleepMilliseconds in main possible?
Posted: Sun Mar 08, 2015 1:20 am
by wizhippo
I'm trying nill out and if I call chThdSleepMilliseconds(250); in main it throws an unhandled excpetion, yet if I move the code into another thread and do not sleep in main I have no issue.
Any ideas?
Re: chThdSleepMilliseconds in main possible?
Posted: Sun Mar 08, 2015 2:07 am
by utzig
from demos/STM32/NIL-STM32F100-DISCOVERY/main.c
Code: Select all
/* This is now the idle thread loop, you may perform here a low priority
task but you must never try to sleep or wait in this loop. Note that
this tasks runs at the lowest priority level so any instruction added
here will be executed after all other tasks have been started.*/
while (true) {
}
I guess that would also apply to any code you put under main().
Cheers,
Fabio Utzig
Re: chThdSleepMilliseconds in main possible?
Posted: Sun Mar 08, 2015 4:02 am
by wizhippo
Didn't see that. Thank you
Re: chThdSleepMilliseconds in main possible?
Posted: Sun Mar 08, 2015 7:39 am
by Giovanni
Correct, no sleeping there.
Giovanni
Re: chThdSleepMilliseconds in main possible?
Posted: Wed Jul 29, 2015 9:39 pm
by ulikoehler
Is there any point in running `__WFI()` in the main() loop for Cortex-Mx?
Best regards,
Uli
Re: chThdSleepMilliseconds in main possible?
Posted: Thu Jul 30, 2015 6:28 am
by Giovanni
Hi,
Yes, placing _WFI in the loop improves power usage, it is not there by default because it can affect some debuggers.
Giovanni