FirmwareFlashing

From PaparazziUAV
Revision as of 08:28, 7 February 2013 by Flixr (talk | contribs) (trying to make an overview for different firmware flashing methods)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

This is about how to flash new firmware to you favorite new gadget :-)

Generally speaking there are several different ways to flash the firmware on your autopilot board. Not all boards support every method though.
Every board has a sensible default flash mode set, but where supported you can override that. Either specify the FLASH_MODE in the firmware section of your airframe file, e.g.:

<configure name="FLASH_MODE" value="JTAG"/>

or add it to the commandline invocation:

make AIRCRAFT=<aircraftname> ap.upload FLASH_MODE=JTAG

USB

If the autopilot senses a connected USB cable during power-on, it will wait to receive a firmware image rather than booting normally. The firmware can be compiled and flashed by several means, the simplest way using the Paparazzi Center, the traditional way being:

make AIRCRAFT=myplane clean_ac ap.upload

(where myplane is the name of your airframe as defined in conf/conf.xml) This command erases any compiled autopilot code from the PC, recompiles everything from scratch, and then sends it to the autopilot.

For boards where USB flashing is not the default you will have to specify it explicitly.

LPC21

Set FLASH_MODE=IAP.
This requires that you uploaded the LPC bootloader.

Connect an USB cable to the USB port on the autopilot board.

STM32

Set FLASH_MODE=DFU.
This requires that you have the Luftboot bootloader on the board.

JTAG

Set FLASH_MODE=JTAG.
Lisa/L has an onboard JTAG, otherwise you need a JTAG adapter. You should have OpenOCD already installed.

  1. Connect your JTAG adapter the board via the cortex cable (little black socket)
  2. Attach the UART port on the bottom of the jtag to UART2 on the autopilot.
  3. Plug in USB port of the jtag
  4. Plug in USB port of the Autopilot
  5. Click upload, wait until complete, then click Upload. You should see something like the following towards the end:

{{{ ... Info : device id = 0x10016418 Info : flash size = 256kbytes stm32x mass erase complete Info : Padding image section 1 with 7972 bytes wrote 152576 bytes from file src/paparazzi/var/Hexa_LisaL/ap/ap.elf in 7.498179s (19.871 KiB/s) Info : JTAG tap: stm32.cpu tap/device found: 0x3ba00477 (mfg: 0x23b, part: 0xba00, ver: 0x3) Info : JTAG tap: stm32.bs tap/device found: 0x06418041 (mfg: 0x020, part: 0x6418, ver: 0x0) shutdown command invoked }}} During an upload the JTAG RxTx LEDs should blink.

STM32

If you have a Lisa/M v2.0, using JTAG will not overwrite the bootloader by default. To overwrite the luftboot bootloader configure

<configure name="NO_LUFTBOOT" value="1"/>

Serial

You can also flash via serial cable or modem, but it takes a longer time. You can't just consider the baud rate to estimate the duration of the operation are there are many exchanges in the flashing protocol and the com latency over RF becomes significant.

Have a look at the page for your autopilot board to see how to enter serial flashing mode.
Firmware upload using the factory integrated bootloader can be useful e.g. if you have overwritten your USB bootloader.

LPC21

Set FLASH_MODE=ISP.
NOTES:

- Make sure you connect your serial device to UART0
- Make sure you pull P0.14 boot pin low on power on to enable the LPC ISP mode

STM32

Set FLASH_MODE=SERIAL.