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


System crashes

Posted by Alexander Zurkan on July 29, 2008
Hi there,

I am running FreeRTOS on an Atmel ATmega128 with 16MHz. Most of the time the system works fine, but I came across a constellation, where the system shows strange behaviour, which I would like to discuss with you.

My general setup is:
- max heap size: 3000 Byte
- stack size for each task: 85 Byte
- max priorities: 8
- rtos-ticker: 1000
- 8 tasks, each with its own priority(0,1,..,7)
- each task has the same content (counting a simple varable from 0 to 300, a seperate local variable for each task)
- after finish the counting each task delays itself for 1 to 8 ticks (depends on the number of the task, see table below)
- the combination of tasks, priorities and delay-ticks is as follows:
| task# | prio | delay |
| task00 | 7 | 1 |
| task01 | 6 | 2 |
| task02 | 5 | 3 |
| task03 | 4 | 4 |
| task04 | 3 | 5 |
| task05 | 2 | 6 |
| task06 | 1 | 7 |
| task07 | 0 | 8 |

OK, when I run the system with that setup, it runs for a short time and then hangs.
I examined the system behaviour with a logic analyzer. Have a look at the result at: www.ti.et-inf.uni-siegen.de/research/zurkan/freertos/pic03.jpg
The signal for a task goes high, when the task starts counting the variable and goes low just before calling vTaskDelay().
You can see on the right end of that picture, that the ticker stops working (keep high) and so the system is not responding anymore. The result is reproducible.

The same system is working fine without hanging or crashing if I do one of the following changes:
- change rtos-tick to <950
- change rtos-tick to >1050
- change priority of task00 from 7 to 6
- change priority of task07 from 0 to 1
- change priority of task06 from 1 to 0

If I change the priority of task06 from 1 to 2, the system crashes also. Screenshot at: www.ti.et-inf.uni-siegen.de/research/zurkan/freertos/pic09x1.jpg
It shows more strange behaviour, when I raise the priority os task06 from 1 to 3. Then the system hangs for a short while, then the ticker starts working again, but no taskswitch is performed anymore. Have a look at that: www.ti.et-inf.uni-siegen.de/research/zurkan/freertos/pic10x1.jpg

So is there anybody who could help me understand that behaviour?
If there is need for more information, just let me know.

Best Regards,

RE: System crashes

Posted by Richard on July 29, 2008
I would not read too much into the fixes you have listed (changing priorities, etc.) as these will just change the execution pattern so it might be that under all circumstances you will eventually get the same problem. Does your project run in the AVRStudio simulator? If so then I could give it a try.


RE: System crashes

Posted by Alexander Zurkan on July 29, 2008
Hi Richard,

thanks for your fast reply.
The project does run in AVRStudio and shows the same behaviour as on real hardware.

The project can be downloaded from here: http://www.ti.et-inf.uni-siegen.de/research/zurkan/freertos/freertos_system_crash.zip

I use AVRStudio 4.14 und the current WinAVR Package 20080610.
There are two breakpoints set in AVRStudio. One at the system startup (to check for any system resets) and one in port.c in function vPortYieldFromTick() to halt the simulator at every rtos-tick. This works fine for about 15 times but after that the simulator keeps running without halting at that breakpoint. This is the same as in hardware. It looks like that the system gets stuck in the functions vListInsertEnd() and vListRemove()

Thanks in advance and best regards,

RE: System crashes

Posted by Alexander Zurkan on July 29, 2008
Hi Richard,

i have just found out that the problem is the current WinAVR package. I installed an older version and compiled my project with that version and now everythings works. I do not know already what the exact problem is with the current WinAVR release.

So there is no need for you to have a look deeper into my project.

Best Regards,

[ 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