Thursday, April 9, 2009

Flashing AVR wirelessly with La Fonera GPIO

La Fonera is a cheap WiFi router, and it is also a small wireless device that you can program as you like.

It has a serial port and unused GPIO pins, whose information are already available on the net, so you can connect other device to build your own wireless application. If a microcontroller such as AVR is connected to it, your wireless application can make use of ADC, PWM, more digital IO ports, etc.

For AVR hobbiests, La Fonera can be seen as a cheap WiFi card with serial interface!

So, you connect La Fonera and AVR, why not download firmware to AVR using that connection?

La Fonera has 5 free GPIO pins, it's enough to program AVR using ISP interface, which uses only 4 IOs (SCK, MISO, MOSI and ~RESET). (With an additional GPIO pin connected to ~SS of AVR, it would also be possible to communicate with your running firmware using SPI.)

Having read the datasheet, it turned out writing a program to flash the AVR is fairly easy.
So I wrote fonasp.

I flash my AVR from Linux box using command line like this (in Makefile):
ssh root@fonera /jffs/fonasp - < firmware.bin
(My Fonera is running DD-WRT, and SSH and JFFS are enabled.)

fonasp does not use kernel-mode driver for GPIO. Instead it directly writes/reads hardware registers for fast bit-banging.

For detailed information and download of fonasp, follow this link.

Wired GPIO and unused serial port pins (using UEW wires) so connecting to AVR board is easy.

Bypass capacitors C142-145 are removed.

No comments: