FreeRTOS on AVR with external RAM

AVR microcontrollers aren’t best choice to run FreeRTOS scheduler due to low RAM. Atmega128 has only 4K of RAM memory, so this limits FreeRTOS functionality to very basic. Anyway this can be solved by adding extra RAM connected to external memory interface. We have already implemented external memory block of 8K previously so now we can muck around. Lets continue with our previous code having several simple tasks (button state reading, LCD output and LED flash), and add more to it. We are going to set up external RAM for storing heaps. This will allow to store large data buffers without worrying of heap and stack overlap.

Continue reading

Running multiple FreeRTOS tasks on AVR

In previous post we just run a single task. Running RTOS with single task has no meaning at all. This can be easily done with conventional program. But what if we need to have more separate functions. To execute them at exact timing would require separate timer or interrupt. But microcontroller cannot guarantee an interrupt for every tasks. This way it is hard to make code modular and testing can be painful. Using RTOS solves this kind of problem. It allows programming each task as endless loop. Kernel scheduler takes care of assuring each task gets it’s chunk of processing time. Additionally it does bearing the priority systems – more important tasks are executed prior to less important ones. Let us go further with our example code and add more tasks to our FreeRTOS engine. We already have LED flashing task that toggles LED every second. Additionally we are going…

Continue reading