How to control the Builtin LED Light of Teensy 3.5 using uTasker?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to control the Builtin LED Light of Teensy 3.5 using uTasker?

967 Views
alresarena
Contributor III

How to control the Builtin LED Light of Teensy 3.5 using uTasker?

Because the rate of the flashing of led light is fast. How can i control it ? Please Help :smileysad:

2 Replies

711 Views
alresarena
Contributor III

Thank you so much for the advise Sir Mark :smileyhappy:  I'll try this :smileyhappy:

0 Kudos
Reply

711 Views
mjbcswitzerland
Specialist V

Hello Alres

The LED is 'attached' to the watchdog retrigger. It is called each time the retrigger takes place via the macro
TOGGLE_WATCHDOG_LED()
which is defined as
#define TOGGLE_WATCHDOG_LED()  _TOGGLE_PORT(C, BLINK_LED)
for the Teensy 3.5 (see app_hw_kinetis.h)

If you wanted to have no LED, for example, you could just make the macro dummy:

#define TOGGLE_WATCHDOG_LED()

The watchdog retrigger rate is set in the watchdog task's properties in TaskConfig.h:

{"Wdog",      fnTaskWatchdog, NO_QUEUE,   0, (DELAY_LIMIT)(0.2 * SEC),  UTASKER_GO}, // watchdog task (runs immediately and then periodically)

Here you see that it is set at 2.5Hz (200ms retrigger rate) as standard.

You can change this time to make it faster or slower, but remember that you will be changing also the watchdog retrigger rate, which you need to have at least at a periodic rate less that the watchog's timeout (with a little margin)!

A simply way to make it slower without changing the watchdog retrigger rate is to use something like

#define TOGGLE_WATCHDOG_LED()  if (++(my_variable >= 2)) {my_variable = 0; _TOGGLE_PORT(C, BLINK_LED);}

You will need to add my_variable defined globally and the >= 2 will halve the rate that the LED is toggled at, >= 3 would divide by 3 etc.


Note that the LED is used generally as a "heart-beat" indication. It allows you to simply see that the board is actually operating and, as long as it flashes at a constant and smooth rate, that the whole system is running stably. If it were to freeze or become jittery it shows that there is either an error (eg. a hard fault or endless loop, which will cause a watchdog reset after a short delay) or that there is some processing that is causing the watchdog task to be delayed.
The watchdog task itself is there to detect such issues - it is executed periodically as long as everything is operating normally.

Personally I hate demonstration projects that don't actually show that they are alive simply by looking at the board, as I hate demonstration projects that don't incorporate a watchdog concept as standard....even in a most primitive "blinky" configuration....

Regards

Mark