Field-upgrade bitwizard boards

From BitWizard WIKI
Revision as of 12:08, 26 May 2015 by Rew (talk | contribs)

Jump to: navigation, search

If you have a raspberry pi, and there is a reason to upgrade your bitwizard board and you have a raspberry pi, then this can be done....

Get the modified avrdude binary from:

Next you have to make a connection from your raspberry pi SPI0 bus to the programming connector for your board.

First the SPI0 bus on the raspberry pi. On rpi_serial and RPI_UI you have a 6-pin SPI connector. usually marked "SPI0". (sometimes it is marked SPI2... sorry.).

On your target board there is a pattern of 6 pads that form the programming connector. However 5 of the six pins are shared with the SPI connector. So using the SPI connector is more convenient. We'll take care of the sixth next.

Near the SPI connectors, on most boards you'll find a solder jumper. At the moment the center pad is connected to one of the other pads with a tiny track. Your SPI connector becomes a programming connector if you short the center pad with the pad without the tiny track. I use a 7cm piece of 220V cord that has been stripped for 1cm as a brush against the two pads that I want to connect. Any other trick that connects the two pads will work. People who are upgrading an I2C version have the option of simply using a blob of solder to make the connection. Leaving the little track is not a problem. (we cut the little track during development to make one of the SPI connectors a programming connector leaving the other SPI connector as the SPI connector....)

On the rpi_ui the procedure to make the SPI0 port a programming port is slightly different: Put a jumper on the jumper block in the 1-2 position (horizontal, near the SPI connector). Most of you won't have a jumper block installed. Any temporary connection between the two pins is acceptable, provided you can keep it stable for the few seconds it will take to program the board.

Then to program the board, you will have to do something like:

avrdude -P gpio -u -c gpio -p atmega328  -U eeprom:r:ee.hex:i
avrdude -P gpio -u -c gpio -p atmega328  -U lfuse:w:0xe2:m hfuse:w:0xdf:m
avrdude -P gpio -u -c gpio -p atmega328  -U flash:w:i2cmega_rpi_ui.hex
avrdude -P gpio -u -c gpio -p atmega328  -U eeprom:w:ee.hex

of course substituting the name hexfile that we sent you.

For the devices with atmega328 parts, you will need to have the definition of that part in your /etc/avrdude.conf. You can get an upgraded version from Install it in /etc . The commands above first try to read the eeprom, then flash the part, then rewrite the eeprom. This should now conserve your serial number in the eeprom. Not that it's terribly important.

Most our smaller expansion boards have an attiny44 chip as their brains. Use "attiny44" instead of "atmega328" in your commandline above. rpi_ui, xxx_motor and xxx_7seg have atmega328 processors.


The avrdude GPIO programmer will 'grab' the programming pins from the SPI module if you have it loaded. The SPI module will take them back if you remove it from the kernel and re-insert it, or if you use gpio_setfunc . (Use the first method until I have time to document how to do it with gpio_setfunc).