User Tools

Site Tools


rc:flashing-afroflight32-firmware-in-linux

Flashing AfroFlight32 / Naze32 firmware in Linux

First get the latest hex file (=the firmware) using wget. The output file will be named baseflight.hex and may overwrite any other file having the same name.

wget http://afrodevices.googlecode.com/svn/trunk/baseflight/obj/baseflight.hex -O baseflight.hex

Next attach the usb cable to the board and if unsure check with dmesg that the device was detected. The output will look something like this.

usb 7-2: new full speed USB device using uhci_hcd and address 8
usb 7-2: configuration #1 chosen from 1 choice
cp210x 7-2:1.0: cp210x converter detected
usb 7-2: reset full speed USB device using uhci_hcd and address 8
usb 7-2: cp210x converter now attached to ttyUSB0

In my case, the board was attached to ttyUSB0 so it can now be accessed with /dev/ttyUSB0. There are two ways of setting the serial port settings and activating the flash mode. The first one consists of two command:

  • stty -F /dev/ttyUSB0 raw speed 115200 -crtscts cs8 -parenb -cstopb -ixon
  • echo -n 'R' >/dev/ttyUSB0

All three leds in the board should now be lit. Alternatively, for example CuteCom can be used for sending the R letter. Be sure to set the baud rate to 115200 before opening the device. Note that "No line end" needs to be selected.

Now you can proceed with the stm32flash command:

stm32flash -w baseflight.hex -v -g 0x0 -b 115200 /dev/ttyUSB0

The output should look something like this:

stm32flash - http://stm32flash.googlecode.com/

Using Parser : Intel HEX
Serial Config: 115200 8E1
Version      : 0x22
Option 1     : 0x00
Option 2     : 0x00
Device ID    : 0x0410 (Medium-density)
RAM          : 20KiB  (512b reserved by bootloader)
Flash        : 128KiB (sector size: 4x1024)
Option RAM   : 15b
System RAM   : 2KiB

Wrote and verified address 0x08009d68 (100.00%) Done.

Starting execution at address 0x08000000... done.

Powercycle the board and access the version string from the terminal. It should now be updated.

rc/flashing-afroflight32-firmware-in-linux.txt · Last modified: 06.04.2012 18:34 by vergo