aczento wrote on Tuesday, 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,
Alex