http://interactive.freertos.org/attachments/token/wfsz46do1a8zcfz/?name=AVR_ATXMega128A1_WinAVR.zip
My setup is the last Freertos version, which compiles OK with no errors. The only file I’ve changed is PORT.c and after some investigation I came to find a strange behaviour of the software or port.
I have 2 tasks a mutex and a binary semaphore for synchronization, fired from an interrupt vector Task 1 takes the mutex when available and reads “protected” data then returns the mutex, Task 2 is idle most of the time waiting for a semaphore. When semaphore fires, task 2 acess hardware, retrieves data from device, takes the mutex and writes to the “protected data”, return the mutex then goes idle again When I start the system like these
main()
{ /* pseudocoded for clarity*/
...
start_task_1@priority=5
start_task_2@priority =6
start_scheduler
}
the system works OK
but if I start the system with both tasks AT THE SAME PRIORITYthe system will only work if I start the task2 first
If I start Task1 first, the scheduler will switch to the task 1 code, but no to the task 2
In this case the task switcher will switch to task 1, and will stop switching.
Even with all the two interrupts enabled (tick timer and semaphore vector) at the same LEVEL (both high or both low)
it doesn’t care. If I stop in a breakpoint placed in the task that’s working (Task 1) and watch the hardware, I see that both interrupts are enabled, the PMIC_CTRL register is enabled, and the I bit is set, but no interrupt gets processed (altough both are acknowledged since it’s individual flags so indicates, and PMIC_STATUS indicates an interrupt being executed) This is very strange, since I’ve worked before with FreeRtos and The ATmega128 (classic AVR) with no problems.
What do you thing is causing this? Is there something in the hardware tht I’m missing? Thanks in advance
Ignacio