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
The goal of this part of the documentation is to give you insight in how to give your Autopilot board a Brain. Airborne autopilot code, flight plans and configuration settings are compiled into a single file, sometimes referred to as a binary image. After compilation this file is transferred to the Autopilot board micro-controller flash ROM through use of an USB cable. Note that most tuning and flight plan parameters can be changed in-flight but after each power cycle, the autopilot reverts to the original settings. Permanent changes are made by recompiling the airborne code and it's new configurations settings, and re-upload this to the autopilot board. It may sound complicated but in fact it is quite simple if you follow the steps below.
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.
This requires that you uploaded the LPC bootloader.
Connect an USB cable to the USB port on the autopilot board.
There are two different DFU Bootloader:
- custom Luftboot bootloader (LisaM/Lia boards)
- will automatically go into DFU mode
- native dfu bootloader (embedded in ROM)
- To trigger DFU mode, connect BOOT0 with 3V (and BOOT1 with GND), reset and disconnect both. (BOOT1 is not always needes)
The native DFU bootloader requires external software
- Connect your JTAG adapter the board via the cortex cable (little black socket)
- Attach the UART port on the bottom of the jtag to UART2 on the autopilot.
- Plug in USB port of the jtag
- Plug in USB port of the Autopilot
- 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.
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"/>
E.g. using BlackMagicProbe.
Or additionally set STLINK=y to use STLink as described on STLink page.
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.
- 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