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
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. Regards.
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, Alex
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, Alex
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.