Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Real time embedded FreeRTOS mailing list 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem TCP & FAT Training


[AVR]Best place to place Watchdog Timer Reset

Posted by zohair on July 23, 2007
I'm working on an ATMega32 and am trying to add a watchdog timer to the project.

I wanna know, what would be the best place to place the timer reset command. Since FreeRTOS uses multi-threading, I guess threads would continue to operate even if one of them hung up. I'm guessing I'll need to create a task to occasionally reset the Watchdog, but what should I set the priority to?

Since we're on the topic, how many tasks can I create on my system?

RE: [AVR]Best place to place Watchdog Timer Reset

Posted by Richard on July 23, 2007
The number of tasks you can create is dependent on the amount of RAM available and the size of the stack allocated to each task.

There is no simple answer to your watchdog question. It depends on how secure you want it to be. There are lots of papers available on watchdog design, it can get quite an academic subject. One approach is to have each task perform some form of self check and send a message to a watchdog task. The watchdog task then needs to run within a time window, and receive "I am ok" messages from all the other tasks before it kicks the dog.


RE: [AVR]Best place to place Watchdog Timer R

Posted by zohair on July 23, 2007
I'm guessing the number of tasks isn't simply (Available RAM / configMINIMAL_STACK_SIZE), right?

I was thinking of a simple watchdog and kick it at the lowest priority. That way if any higher priority task hangs, we get a reset. Any possible problems with this?

RE: [AVR]Best place to place Watchdog Timer R

Posted by David Hawks on July 23, 2007
That depends on the type of "hang". A higher priority task can "hang" by blocking on a resource that will not become available for whatever reason. The higher priority task will be left blocked and the lower priority watchdog reset task will be allowed to run. The watchdog will continue to operate even though a higher priority task is stuck. It is due to this kind of interaction that watchdog design can become an "academic subject" as Richard said.

Your simple watchdog will detect some failures, and maybe that is good enough for you. It is not fool-proof, however.

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

Copyright (C) 2004-2010 Richard Barry. Copyright (C) 2010-2016 Real Time Engineers Ltd.
Any and all data, files, source code, html content and documentation included in the FreeRTOSTM distribution or available on this site are the exclusive property of Real Time Engineers Ltd.. See the files license.txt (included in the distribution) and this copyright notice for more information. FreeRTOSTM and FreeRTOS.orgTM are trade marks of Real Time Engineers Ltd.

Latest News:

FreeRTOS V9.0.0 is now available for download.

Free TCP/IP and file system demos for the RTOS

Sponsored Links

⇓ Now With No Code Size Limit! ⇓
⇑ Free Download Without Registering ⇑

FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Renesas Electronics Gold Alliance RTOS Partner.jpg

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Atmel RTOS partner supporting ARM Cortex-M3 and AVR32 microcontrollers

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

Xilinx Microblaze and Zynq partner

Silicon Labs low power RTOS partner

Altera RTOS partner for Nios II and Cortex-A9 SoC

Freescale Alliance RTOS Member supporting ARM and ColdFire microcontrollers

Infineon ARM Cortex-M microcontrollers

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

Cypress RTOS partner supporting ARM Cortex-M3

Fujitsu RTOS partner supporting ARM Cortex-M3 and FM3

Microsemi (previously Actel) RTOS partner supporting ARM Cortex-M3

Atollic Partner

IAR Partner

Keil ARM Partner

Embedded Artists