Field-upgrade bitwizard boards

From BitWizard WIKI
Jump to: navigation, search

Different bitwizard boards

BitWizard now has STM32 based boards and AVR based boards. Errors in software are possible and sometimes the devices can be extended in functionality with a simple software upgrade. We therefore like to build our boards with the option of a software upgrade builtin.

Look in the right section for your board.

AVR based boards.

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 -b 1200 -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).

STM32 based boards

Some STM32 based boards do not have USB. In that case use the no-usb version of the upgrade procedure, otherwise skip to the with usb section.

no usb

No boards with this configuration are in-the-wild yet. BitWizard internal: Look in the internal wiki documentation. :-)

with usb

Our STM32 based boards with USB have a button labeled BOOT or BSEL. Press this button, keep it pressed and power up the board. Count to three and then release the button. Powering up the board is usually plugging in the USB cable. It might be easier to connect the cable to the board beforehand and power up the board by plugging the other end of the cable into a computer or USB HUB. If you have a hub with switches, that's an option too: you can throw the switch on the hub to power up our board.

Now the board should be in DFU (Device Firmware Update) mode. On Linux lsusb should show an ST microelectronics device in DFU mode. Someone with Windows may report how to navigate to a screen that shows the USB device and how to confirm DFU mode.

You should have gotten a firmware binary with .dfu extension from us.


Installing dfu-util: On modern Linux systems, you can simply do: apt-get install dfu-util , or the equivalent if your system does not use apt.

Then you can do:

dfu-util -a 0 -D ch.dfu

to upgrade the firmware in the device. (substitute the name of the binary you have if it is different).


On windows ...