Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem


FreeRTOS on Atmega2560 issues

Posted by erltot on April 30, 2016

I have also posted this in the avrfreaks forum. http://www.avrfreaks.net/comment/1871906#comment-1871906

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..


FreeRTOS on Atmega2560 issues

Posted by rtel on April 30, 2016

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?

FreeRTOS on Atmega2560 issues

Posted by erltot on May 1, 2016

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.

FreeRTOS on Atmega2560 issues

Posted by erltot on May 2, 2016

I could not find the source of my problems, but using these files solved it for me: https://github.com/feilipu/miniAVRfreeRTOS

[ Back to the top ]    [ About FreeRTOS ]    [ Privacy ]    [ Sitemap ]    [ ]

Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.

Latest News

Version 10.1.0 of the FreeRTOS kernel is available for immediate download. MIT licensed.

View a recording of the "OTA Update Security and Reliability" webinar, presented by TI and AWS.


FreeRTOS and other embedded software careers at AWS.

FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Espressif ESP32

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers


STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

OpenRTOS and SafeRTOS

Xilinx Microblaze and Zynq partner