idle Led

Hi all, Does anyone know how to achieve an idle LED? By “idle LED” I mean a led that is lit while the RTOS is idle. Thanks in advance.

idle Led

One way is to turn it on when you enter the idle loop, turn it off when you enter the scheduler and maybe tick_hook and again at the entry to each ISR if you using them.

idle Led

Correction, you would want to turn off led when a task other that the idle task is running, so again this would be done in the scheduled…. May not be perfect, but it might give you what your looking for…

idle Led

You could use traceTASKSWITCHEDIN() or traceTASKSWITCHEDOUT() hooks, or potentially https://www.freertos.org/rtos-trace-macros.html – or potentially but more clumsily an application task tag that points to a function that turns the LED on and off.

idle Led

Lafleur’s suggestion is better. Turn it on in the idle hook and off in the tick hook.

idle Led

Turning off in the tick hook doesn’t work, as tasks started by some other interrupt won’t clear the LED. I personally think the best solution is traceTASKSWITCHEDIN() hook and set the LED to the state of pxCurrentTCB == the Idle Task TCB, so it accurately indicates if the current task is the Idle task. Personally, I think rather than an Idle LED, and Active LED would be more useful, as I find I tend to have periods where I spend a lot of time in the Idle task, but their some activity going on, and it is easier to see that the LED is dimly glowing rather than just slightly dimmer. The one use for an Idle LED that I see is that if it ever goes out (or very dim) that is a good sign that the machine is heavily loaded.

idle Led

But you also need to turn off led when entering an ISR… ~~ _/) ~~~~ _/) ~~~~ _/) ~~~~ _/) ~~ Tom Lafleur
On Jan 23, 2018, at 7:23 PM, Richard Damon richard_damon@users.sf.net wrote: Turning off in the tick hook doesn’t work, as tasks started by some other interrupt won’t clear the LED. I personally think the best solution is traceTASKSWITCHEDIN() hook and set the LED to the state of pxCurrentTCB == the Idle Task TCB, so it accurately indicates if the current task is the Idle task. Personally, I think rather than an Idle LED, and Active LED would be more useful, as I find I tend to have periods where I spend a lot of time in the Idle task, but their some activity going on, and it is easier to see that the LED is dimly glowing rather than just slightly dimmer. The one use for an Idle LED that I see is that if it ever goes out (or very dim) that is a good sign that the machine is heavily loaded. idle Led Sent from sourceforge.net because you indicated interest in https://sourceforge.net/p/freertos/discussion/382005/ To unsubscribe from further messages, please visit https://sourceforge.net/auth/subscriptions/

idle Led

Turning off the LED depends a lot on if you consider being in an ISR to be ‘non-Idle’. ISRs should be very short, so the time in them should be negligable, and not really noticable, so for a person observed LED, not observable. Also, it would be very invasive to do this. Note, if the ISR does wake up a task, having the hook in TASKSWITCHEDIN() will still get triggered, so the LED will get updated on the exit of the ISR.