the atusb boot loader (how to flash it)
Werner Almesberger
werner at almesberger.net
Wed May 11 19:06:08 EDT 2011
atusb contains two pieces of firmware: the boot loader and the actual
application. The boot loader implements the DFU protocol which lets
you update the application via USB, using dfu-util.
Since at the time I sent out the prototypes, my USB stack wasn't able
to restart properly when passing from boot loader to the application,
I flashed only the application but left out the boot loader.
I've fixed the stack now, and I recommend flashing the boot loader on
the prototypes.
Note that the application gets erased when flashing the boot loader.
You also have to complete the application download procedure described
in the next mail to make your atusb fully usable again.
What you need:
- Hardware
- a Ben, running from NAND (the 8:10 card slot must be available)
- an atusb board
- the atusb-pgm cable
- Software
- avrdude on the Ben avrdude controls the firmware flashing process)
- the new boot loader
There are three ways to get avrdude for the Ben:
1) Build it on your own, using these instructions:
http://projects.qi-hardware.com/index.php/p/ben-blinkenlights/source/tree/master/avrdude/README
2) If using OpenWRT, install this pre-built package:
http://downloads.qi-hardware.com/software/packages/NanoNote/Ben/latest/avrdude_5.8-1_xburst.ipk
3) Download this tarball containing a pre-compiled statically linked
executable:
http://downloads.qi-hardware.com/people/werner/wpan/bindist/avrdude-5.10-de72af351f661b538add81cbc9965278a2f8c40c.tar.gz
Then extract it on your Ben as follows:
tar Cxfz / avrdude-5.10-de72af351f661b538add81cbc9965278a2f8c40c.tar.gz
For GPL compliance, I also placed a tarball with the sources here:
http://downloads.qi-hardware.com/people/werner/wpan/bindist/avrdude-5.10-de72af351f661b538add81cbc9965278a2f8c40c-src.tar.bz2
There are two ways to get the boot loader binary:
1) Build it on your own, using these instructions:
http://projects.qi-hardware.com/index.php/p/ben-wpan/source/tree/master/atusb/fw/README
2) Download this pre-compiled binary:
wget -O boot.hex \
http://downloads.qi-hardware.com/people/werner/wpan/bindist/boot-de72af351f661b538add81cbc9965278a2f8c40c.hex
(Or any updated version I may put there in the future.)
Copy the boot loader to your Ben.
Next, run this on the Ben to silence all other users (*) of the 8:10
card slot:
echo jz4740-mmc.0 >/sys/bus/platform/drivers/jz4740-mmc/unbind
echo spi2.0 >/sys/bus/spi/drivers/at86rf230/unbind
(*) These commands are from the following script, which tracks the
things that share the 8:10 card slot:
http://projects.qi-hardware.com/index.php/p/wernermisc/source/tree/master/ub
Insert the atusb-pgm adapter into the Ben and prepare to run the
following command (*):
avrdude -F -p atmega32u2 -c nanonote_atusb -e \
-U flash:w:boot.hex:i \
-U lfuse:w:0x60:m \
-U hfuse:w:0xd8:m \
-U lock:w:0x2f:m
(*) From target "prog" of
http://projects.qi-hardware.com/index.php/p/ben-wpan/source/tree/master/atusb/fw/Makefile
Make sure the atusb board is not connected to USB. Place atusb-pgm on
atusb as shown in this image:
http://downloads.qi-hardware.com/people/werner/wpan/tmp/atusb-programming.jpg
Gently press on atusb-pgm and run avrdude, as shown above. avrdude
should run for about 20-30 seconds, then report success and thank you
for using it.
If it fails for some reason, make sure you properly placed atusb-pgm,
and try again. If it keeps on failing, remove atusb-pgm from the Ben
and insert it again.
Remove atusb-pgm from the atusb board. When plugging atusb into a PC,
it should turn on the LED and enumerate. lsusb -d 20b7:1540 -v
should show
...
idVendor 0x20b7 Qi Hardware
idProduct 0x1540 ben-wpan, AT86RF230-based
bcdDevice 0.01
...
iSerial 1 46303334393715081003
...
bInterfaceClass 254 Application Specific Interface
bInterfaceSubClass 1 Device Firmware Update
...
The serial number should differ between boards.
- Werner
More information about the discussion
mailing list