Getting Started with Contiki and the AVR Atmel RAVEN

Contiki is a very small operating system for sensor networks which is designed to work on microcontrollers with a very small amount of memory. According to their website Contiki uses 2 kilobytes of RAM and 40 kilobytes of ROM in a typical setup. The OS uses the uIPv6 stack which supports the 6LowPAN standard to be used on IEEE 802.15.4 radio links.

To get started with the RAVEN Kit and Contiki I had to install a new firmware on theRZUSBstick and the AVR Raven. Basically both devices are intended to be programmed using their JTAG interface. But JTAG programmer are rather expensive and I do not own a JTAG programmer, therefore I had to use the devices ISP port. You need an ISP programmer you can hook up your PC – I use the myAVR MK2 programmer, but in general you can use any other JTAG programmer that is compatible with avrdude.

The Raven has soldering points for ISP, unfortunately the RZUSBstick has not. You can find a quite good post by Michal Ossmann that explains how to connect ISP to the RZUSB – you basically have to soldier some wires directly onto the pins of the microcontroller. This is tricky, advanced soldering skills are required.

As soon a you finish soldering you can hook up the wires to your ISP. I downloaded the binary release of Contiki to flash it on the devices. The firmware is in ELF format which contains both, EEPROM and FLASH of the firmware in one file. Avrdude does not support this format, therefore the ELF file must be split into EEPROM part and the FLASH part as explained on gonium.net. For example the ravenlcd firmware:

# export NAME=ravenlcd_3290
# avr-objcopy -R .eeprom -R .fuse -R .signature -O ihex $NAME.elf $NAME.hex
# avr-objcopy -j .eeprom --set-section-flags=.eeprom="alloc,load" --change-section-lma .eeprom=0 -O ihex $NAME.elf $NAME.eep

After that you can use avrdude to flash the FLASH part and the EEPROM part separately:

# avrdude -p m3290p -c avr911 -P /dev/ttyUSB0 -U flash:w:ravenlcd_3290.hex -B10
# avrdude -p m3290p -c avr911 -P /dev/ttyUSB0 -U eeprom:w:ravenlcd_3290.eep -B10

You have to repeat these steps for webserver6.elf and ravenusbstick.elf.

For setting up your IPv6 network interface and radvd on the host the RZUSB is connected you can follow the tutorial on the Contiki Webpage.

If everything works it should look like this: Pinging AVR Raven!! 🙂

One thought on “Getting Started with Contiki and the AVR Atmel RAVEN”

  1. Well, i was going to show how to program the rz usb raven stick with avrispmkii but the captia was wrong and i lost the post. I’m too pissed off to retype it now.

Comments are closed.