As part of my tinkering with 802.15.4, I needed a way to bridge the divide between my computers and the microcontrollers. My initial idea was to build an ethernet to 6LoWPAN router, but this was soon shelved due to the complexity of the beast.

I needed an easier solution, and some poking around brought me to the Atmel RZUSBSTICK. This is a USB key about the size of a typical thumbdrive, that speaks USB on one side, and 802.15.4 on the other. When loaded with appropriate firmware, (such as Contiki), it allows the computer to transmit and receive 802.15.4 packets.

After obtaining one, I needed to get firmware onto it. This proved non-trivial for a number of reasons:

  1. The programming header is JTAG, not AVR ICSP
  2. The programming header is 50mil pitch, rather than 100mil

After pondering how to proceed, I turned back to the Famous Web Search Engine, which gave me entries on Michael Ossmann's blog, and Tom Ruby's page on the Raven. I wired up a 6 pin ICSP connector, following the information on those sites. Of particular use is the photos from Michael Ossmann, as he has kindly highlighted which pins to solder to. Be prepared to spend some time doing this, as you need a steady hand, 30gauge wire, a fine tip soldering iron and lots of patience to accurately solder to the fine pins on the ICs.

Once the connector was soldered, I secured the connector and wires with hotglue to provide strain relief.

Now for the fun part, I connected up the RZUSBSTICK to my USBTiny (actually a clone on Ebay), and I was successfully able to talk to and erase the chip:

avrdude -u -c usbtiny -p usb1287 -e

In order to get Contiki onto the device, I downloaded the precompiled binaries for the Atmel AVR Raven from the Contiki website. Then, following the instructions on StackOverflow.com (tweaked to suit my programmer), I was able to program my RZUSBSTICK and turn it into a Jackdaw!

avr-objcopy -O ihex -j .eeprom ravenusbstick.elf ravenusbstick-eeprom.hex
avr-objcopy -v -O ihex -R .eeprom -R .fuse ravenusbstick.elf ravenusbstick.hex
avrdude -u -c usbtiny -p usb1287 -e
avrdude -u -c usbtiny -p usb1287 -v -B 250 -U efuse:w:0xFF:m -U hfuse:w:0x99:m -U lfuse:w:0xE2:m -U eeprom:w:ravenusbstick-eeprom.hex -U ravenusbstick.hex

In particular, note the "-c usbtiny" which specifies my programmer, and "-B 250" which slows down the communincations enough to make it reliable (otherwise you will see errors such as:

avrdude: verifying ...
avrdude: verification error, first mismatch at byte 0x10000
         0xff != 0x0c
avrdude: verification error; content mismatch

Update 5 June 2010

It seems I am unable to get the programmer to not give the content mismatch error above. Of interest is the address of the error, on the 64KB boundary. At any rate, the Jackdaw is detected by Windows 7 and brought up as a network interface. I am yet to exercise it though.

Update 9 June 2010

I have successfully been able to program this using the USBtiny as a 10->6 pin ICSP adapter, and coupling with a USBasp programmer from Ebay to do the actual programming. The full firmware has successfully been written and read back, about three times faster than the USBTiny!