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

Adding external memory to Atmega128

Atmega128 is equipped with internal 4Kbytes of SRAM memory. Is it enough? Well, it depends on what project it’s going to hold. If your project must deal with loads of data or run larger RTOS code, you will run out of RAM pretty soon. Atmega128 microcontroller has an external memory interface built in, which allows to expand RAM up to 64 Kbytes. With that, you could do much more. To test things out, I used Piconomic Atmega128 development board, which has an XMEM interface header brought out. All we need is to make XMEM expansion board with some SRAM memory. I’ve chosen standard 8Kx8 (8Kbytes) memory chip from Alliance Memory Inc. I could use 64Kx8, but this is what I had at the moment. To drive memory chip I’ve used 74HC573 non-inverting latch. As you may know, the latch is used for pins that share the same pins for address…

Continue reading