Quality RTOS & Embedded Software

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


vApplicationTickHook ..FromISR?

Posted by Mathias Zenger on September 16, 2009
I have a question regarding the vApplicationTickHook function:

Context: Atmel EVK1100 with AT32UC3A0512, FreeRTOS and lwIP.

I've had the idea to use this function for toggling my watchdog timer . Further I would like to notify a task from the vApplicationTickHook function in case of certain events. Therefor I want to write to a queue. Problem: is this function a ISR and I therefore need to use xQueueSentToBackFromISR or not?

Thanks. Regards Mathias

RE: vApplicationTickHook ..FromISR?

Posted by Richard on September 16, 2009
Yes - you need to use the "FromISR" version.

Also, consider carefully how you use the tick to clear the watchdog. It is possible for your application to crash but the tick to continue. A common method is have the tick run some form of sanity check on each critical task to ensure the task is not only still running, but is also doing the right thing.


RE: vApplicationTickHook ..FromISR?

Posted by Mathias Zenger on September 17, 2009
Thanks for your answer Richard. I wasn't sure about this point.

In my application I am using a task supervision functionality additionally to the watchdog timer , too:

For task supervision I implemented an extra task. It periodically sends keep alive requests to the other tasks. Therefor every task has a queue and must send a reply to the supervision task's queue within a certain time (some of the tasks can block on their queue others need to poll it depending on their purpose). The tick hook function counts up a task local timer variable which gets reset by the supervision task upon the reception of every valid keep alive reply. If one reply is missing and the counter exceeds a limit the hook function sends a reset request to the supervision task's queue.

As far as I see this works quite fine although I have the problem that I can't supervise all tasks with this system. E.g. I have a network communication task which uses a blocking select on data reception. I am unable to let it listen to an additional keep alive queue...

Do you see an alternative/better solution where I could supervise all my tasks? What kind of sanity check are you thinking of?

Always appreciate your valuable inputs!

RE: vApplicationTickHook ..FromISR?

Posted by Richard Damon on September 17, 2009
One way to use this system to monitor a task that blocks too long waiting on another queue, is to define a message for the queue it is blocking on that it will detect as this keep-alive request.

A second way is to put an timeout limit on the queue request that it is blocking on (less than the maximum time it has to respond to the keep-alive), and check if the request timed out, and if so it only needs to check for the keep-alive request, and not processes the data packed that didn't arrive

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

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

Latest News

Version 10.1.0 of the FreeRTOS kernel is available for immediate download. MIT licensed.

View a recording of the "OTA Update Security and Reliability" webinar, presented by TI and AWS.


FreeRTOS and other embedded software careers at AWS.

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