Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem


Loading

idle Led

Posted by ojoj42 on January 23, 2018

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

Posted by tlafleur on January 23, 2018

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.

Attachments

alternate (1725 bytes)

idle Led

Posted by tlafleur on January 23, 2018

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...

Attachments

alternate (2566 bytes)

idle Led

Posted by rtel on January 23, 2018

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

Posted by rtel on January 23, 2018

Lafleur's suggestion is better.

Turn it on in the idle hook and off in the tick hook.


idle Led

Posted by richard_damon on January 24, 2018

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

Posted by tlafleur on January 24, 2018

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/

Attachments

alternate (2182 bytes)

idle Led

Posted by richard_damon on January 24, 2018

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.


[ Back to the top ]    [ About FreeRTOS ]    [ Privacy ]    [ Sitemap ]    [ ]


Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.

Webinar

"OTA Update Security and Reliability" webinar presented by TI and AWS. Register here.


Careers

FreeRTOS and other embedded software careers at AWS.


Latest News

FreeRTOS kernel V10.0.1 is available for immediate download. Now MIT licensed.


FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Espressif ESP32

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

OpenRTOS and SafeRTOS

Xilinx Microblaze and Zynq partner