I have also posted this in the avrfreaks forum.
I got an application working fine on my robot with ATmega1284p.
I have another robot build on the arduino mega, with the atmega2560 chip.
I have set up to program the arduino mega with avrdude in atmel studio.
The plan was to just change some small context switching things in the port.c file and run the same software on this robot, to make it easy to make changes on both robots with little hassle.
It was not that simple.
I have tried several different port.c-files, but it seems FreeRTOS just stops working when I call vtaskdelay, it does not allow context switch.. It may or may not doing something else, I don't know since I can't use the debugger and check.
The only version of FreeRTOS I seem to get to work, is the version from this repo: https://github.com/greiman/FreeRTOS-Arduino - when I use arduino IDE. I could off course implement my c code from the atmega1284 to the arduino IDE and run it from the .ino file, but I would rather be using atmel studio for both..
I have found some other libraries for freertos and atmega2560 but these seems very bloated and I have trouble picking out what I need to make my application work..
I would really appreciate some tips on how to proceed..
when I call vtaskdelay, it does not allow context switch
Do you mean it does not swich away from the task that called vTaskDelay()? Or that the task that calls vTaskDelay() never runs again? If the latter, then the most likely issue would be that the tick interrupt is not executing. Have you checked that the setup of the timer that generates the tick interrupt is the same between the two AVR parts?
I can't debug using the USB bootloader, but yes, it seems like the task that calls vTaskDelay() does not run again.
I run the FreeRTOS arduino code from the arduino IDE, and my tasks are running as expected.
I use the same FreeRTOS files, in my atmel studio project, and I get this issue. Only changes I made was some arduino specific led blinking that I changed from digitalwrite to bit manipulation.
I could not find the source of my problems, but using these files solved it for me:
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.