Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

Home

Phillip Stevens

An overview, and some related projects can be found here:
http://feilipu.posterous.com/melding-freertos-with-chans-fatf-hd44780-lcd
http://feilipu.posterous.com/quadram-512kbyte-on-ethermega-arduino-atmega2
http://feilipu.posterous.com/avr-pong-peggy2-danger-shield
http://feilipu.posterous.com/freertos-and-libraries-for-avr-atmega
http://feilipu.posterous.com/?sort=&search=retrograde

I'm building a prototype ATmega1284p based Arduino Uno clone.
Read more here. http://www.pozible.com/project/18609

README

This Edition: 15 June 2012.

This repository of files is a working collection for a freeRTOS based platform using the AVR-GCC and AVRDUDE platform.

The development environment used was Eclipse IDE. Instructions for importing into Eclipse are found here:
http://feilipu.posterous.com/freertos-and-libraries-for-avr-atmega

It is assumed that the AVR tools and libraries are installed.
For the retrograde project, it is assumed that Pololu libraries are installed.

The freeRTOS folder contains the most recent version 7.1.0 of freeRTOS, but it has been abridged down to only those files relevant for AVR GCC.

The port.c file has been extensively modified to allow the use of any of the ATmega328p Timer0 or Timer1 timers. Generally this means Arduino Uno, or older and Freetronics or other Arduino clones. And, the use of Timer3 on the Pololu SVP which has uses a ATmega1284p

If you want to use 16bit PWM in ATmega328p, then you'll need to enable Timer0 for the freeRTOS tick.

The freeRTOSConfig.h file contains most of the variables that you'll need to change. This is located in the ./freeRTOS/include folder.

There are some relevant and often used libraries added.

lib_digitalAnalog: contains often used digital and analogue routines borrowed from Ben at Pololu.

lib_i2c: contains the tools to use the TWI or I2C bus. contains interrupt driven multi-master and slave routines, both Master and Slave code tested. Multi-master code (arbitration / back off) is untested.

lib_spi: contains the optimised tools to use the SPI bus.

lib_servo: contains routines to enable accurate PWM using Timer1, used in the retrograde clock example.

lib_serial: contains routines to drive the serial interface. there are two versions; avrSerial for use before the freeRTOS scheduler has been enabled, and xSerial for normal operations. xSerial is interrupt driven.

lib_fatf: contains routines for accessing the SD card found on the EtherMega. This works for MMC cards, and has been tested for HDSD 4Gbyte cards.

lib_ext_ram: contains routines for initialising and working with the Rugged Circuits QuadRAM, which provides up to 512kBytes of RAM, or MegaRAM with 128kBytes. It has been integrated with freeRTOS, such that there is a selection of heap management. heap_1.c and heap_2.c have their allocations manually moved to extended RAM. heap_3.c uses malloc() and this is also managed. Maximum heap size for heap_1.c and heap_2.c is 32kBytes. Of course this doesn't apply for heap_3.c using malloc(). And it is easy to manage the RAM banks to access the rest of the available memory.

lib_hd44780: contains support for any LCD screen using the HD44780 driver chip. Pin assignments can be flexibly managed using some easy to modify macros defined in the library.

lib_W5100: contains the Wiznet v1.6 based drivers for W5100 on EtherMega and Arduino Mega devices. Fixed a subtle bug where the chip wasn't finished transmitting by matching Tx read and Tx write pointers, before transmitting.

lib_inet: contains a DHCP routine, used to demonstrate the drivers. Additional internet libraries will go here too.

NOTE: The standard (April 2012) Arduino Mega & Freetronics EtherMega bootloader stops working beyond 64kB of flash. There is a newer version from msproul, which with some minor modifications, I'm now using. Code uploaded for sake of completeness.

DIRECTORY STRUCTURE

freeRTOS
|
|-> retrograde: digital & retrograde analogue clock, depends on Pololu libraries.
|
|-> LCD6100_Driver: a driver for the Sparkfun LCD using Nokia 6100 LCD
| |
| |-> LCD6100_Demo: a simple demo program, developed from the Arduino version.
|
|-> microbridge: a driver set for the Sparkfun USB Host interface. UNFINISHED
| |
| |-> danger_ADB: using the Danger Shield together with Host USB interface. UNFINISHED
| There is a SRAM limitation that prevents all tasks (threads) from running
| simultaneously.
|
|-> ConwayLifePeggy: a simple Life game for the Peggy2 (not freeRTOS)
|
|-> PeggyVideo16: an I2C interrupt driven 4bit Video device. Plays 4bit video based on inputs.
|
|-> PeggyVideoPong: a pong game, with interrupt driven tones, interrupt I2C output to PeggyVideo16, and CRC video transmission.
|
|-> MegaSDTest: A serial monitor program to test the SD Card.
|
|-> MegaW5100Test: A serial monitor program for both SD Card, and basic Internet functions testing the W5100 driver, including DHCP and HTTP.

PeggyVideoPong depends on Peggy2 using I2C communications with an Arduino compatible (Freetronics) and Danger Shield (for sliders and buttons for control).

The music generation (Buzzer.h & Buzzer.c) in PeggyVideoPong uses Timer 2, and PD3 based on the Danger Shield buzzer layout.

PeggyVideoPong, depends on the absence of temperature sensor, and knock sensor from Danger Shield to allow I2C to function properly. These normally block A4 and A5 on the Arduino platform.

IF YOU WANT TO USE BOTH ACCURATE PWM OUTPUTS FROM 16 BIT TIMER1 (FOR RETROGRADE PROJECT FOR EXAMPLE) ON AN ARDUINO PLATFORM, THEN SUBSTITUTE OrangutanLCD.h AND RECOMPILE THE POLOLU LIBRARY
ALSO USE Timer0 for the freeRTOS tick.. This doesn't apply to a SVP Orangutan.

Project Admins: