Skip to content

AVR Raven

Benoît Thébaudeau edited this page Sep 23, 2019 · 5 revisions

Hardware

The ATAVRRZRAVEN 2.4 GHz Evaluation and Starter Kit has two Ravens and one USB stick, five 50 mil headers you will need to solder in for reprogramming, and a 50 mil adapter to the more common 100 mil programmer plug. AVR Studio (for Windows OS only) has the documentation and schematics under the help menu, and has a simulator to test the code before writing it to the device.

  • Atmel Raven
Consists of an ATMega3290p driving an LCD and other peripherals, and an ATMega1284p driving an AT86RF230 802.15.4 2.4GHz radio. Contiki runs on the 1284p, and includes an AVR studio project for the 3290p which provides a simple interface for passing ping requests and sensor information to contiki through an RS232 link. You must solder in 50 mil headers (JTAG recommended, ISP is possible) in order to program the processors.
  • Atmel Jackdaw
Consists of an AT90USB1287 processor driving the AT86RF230 radio. The JTAG header must be soldered for the initial CPU flash, after that it is possible to reprogram through USB. ISP programming is possible by hand-wiring to the necessary pins. It enumerates as a Windows USB composite device with an RNDIS network interface (usb0 on linux) and a serial COM port (ttyACM0 on linux). An alternate configuration enumerates as a CDC-ECM network interface (and serial port) which can be used on Macintosh or Linux (Currently the Mac has no RNDIS driver and Windows has no ECM driver). The usb serial port has a menu interface to show and change operating conditions. In the Macintosh configuration it should still enumerate as RNDIS on Windows, but without the serial enumeration and menu.
  • MCU Programmer
JTAG is recommended. The Dragon is inexpensive, works well, and is documented in AVR Studio.

Software

Some contiki examples will compile for the ATMega1284p (TARGET=avr-raven) although many will fail because the MCU has no buttons, LEDs, or sensors. The Jackdaw (TARGET=avr-ravenusb) is normally just a repeater for network traffic which does not contain the uip stack (any needed uip6 routines are included in fakeuip.c). However the full stack can be included by modifying the makefile. In this case RAM will become a constraint!

avr-gcc and the avr toolchain are included in Instant Contiki. For Windows installs use WinAVR which is usually up to date (these devices are relatively new). For Linux try this avr-gcc and toolchain.

On Windows the examples will build in cygwin or cmd windows. PERL is trickier to get running in cmd windows.

  • /examples/hello-world
Periodically an effort is made to allow this to compile on both platforms, without or without IPV6. Note on the 1284p "Hello World" outputs through the serial port, not the LCD. On the Jackdaw it goes through the USB serial port unless debug strings are configured to go out the UART (#define USB_CONF_RS232 1 in the contiki-conf.h file).
 $make TARGET=avr-raven                       will make hello-world.avr-raven which is actually the .elf file.
 $make TARGET=avr-raven hello-world.elf       will make the hello-world.elf file for flashing with some programmers
 $make TARGET=avr-raven hello-world.hex       will extract a .hex file for flashing with most programmers
 $make TARGET=avr-raven hello-world.u         will invoke avrdude programming after a successful build.
  • /examples/webserver-ipv6-raven
An ipv6 webserver for the Raven. This is basically the /examples/webserver6 code, but customized for AVR-gcc to keep all the strings in program flash instead of RAM. That could have been done with a lot of macro wrappers which would have obscured the simplicity of webserver6. Some additions are a COFFEE file system option, and a $make WEBDIR=somedirectory that will get webserver content and ipv6 address from somedirectory. PERL is needed to generate web content, it makes the new httpd-fsdata.c before the build. Since the source is AVR specific only $make is needed (it invokes "$make -f Makefile.webserver TARGET=avr-raven webserver6.elf" which generates .elf and .hex files).

Makes with compatible AVR platforms are possible, for example the atmega128rfa1 is basically the atmega1284p with an internal RF231 radio. The RF230 radio driver will automatically select appropriate radio driver code (extended io space writes for the atmega128rfa1, software SPI for the mulle platform). Since the raven 1284p has no peripherals (other than the UART0 serial link to the 3290p, which will not hang anything if there is no response) such ports are relatively easy to make. In the /examples/webserver-ipv6raven directory, try

 $make TARGET=avr-atmega128rfa1
  • /examples/ravenusbstick
The Jackdaw network interface. Very AVR specific, so again just do $make. Use platform/ravenusb/contiki-conf.h file to configure it. This includes an experimental Jackdaw RNDIS RPL border router
  • /platform/avr-ravenlcd
This contains the AVR studio project to build the non-contiki 3290p application. A $make in the directory should do as well.

Debugging Tips

The Raven and Jackdaw both have UART outputs for debugging. These need to be level shifted for RS232 using a MAX232 or similar chip. The level converters on the STK500 can be used for the conversion, however many computers no longer have a true serial port and a serial to USB converter would also be needed. Hapsim will connect to the AVR Studio 4 simulation (simulator 1 only) and provide terminal emulation. Hapsim does not (yet) work with AVR Studio 5; a workaround is to direct debug prints to a memory buffer under watch and then break the CPU. Debug messages can be directed through the Jackdaw USB interface but are likely to slow down packet transfers and a burst of messages will be lost. The Jackdaw menu allows turning off the RS232 output to allow it to run at full speed.

Much webserver debugging can be done on the minimal-net target of webserver6, then transferring the code to webserver-ipv6-raven.

There are several options for on-chip debugging. AVR Studio 4 and 5 supports various programmer/debuggers (Dragon, JTAG-ICEmkII, etc.) through the same graphical interface as the simulator. AVaRICE together with a JTAG-ICEmkII or Dragon can act as a GDB or insight server, see this tutorial for setting it up on Windows. The WinAVR installation includes a native avr-gdb.exe and avr-insight.exe which do not require cygwin for operation. Emacs can also connect to the avr-gdb server in the usual way.

Raven motes can be emulated in COOJA (the 1284p and radio). See AVR motes in COOJA

Clone this wiki locally