Bootloader from scatch
The goal of this page is to explain how to get the autopilot bootloader onto a brainless new ARM based autopilot board. Note that the bootloader only needs to be installed once, when the board is first built and has never been used. Most of the times if you bought a board somewhere, the bootloader is already installed for you. If you did not make and soldered the Autopilot board yourself but bought it somewhere, chances are high the bootloader is already uploaded onto your board by the manufacturer. You could ask the supplier of your board. In that case you can just skip the steps described here and just continue the part of Uploading the Flightplan code to your autopilot board or if you are more experienced you could go here
Why have Bootloader in the first place
Since the Airborne code and Flight-plans change frequently, it would be great if we could just simply upload new version with changes on the ground by connecting an USB cable to out airframes autopilot board. Well, the Bootloader makes this a simple reality.
How does it work
The Bootloader is uploaded through the serial interface UART0 (Serial1) by connecting certain point on the board to ground during power-up, sometimes referred to as: holding low. On the board Tiny V1.x pin P0.14, Tiny V2.x this pin is called BOOT). Also GPS_RESET has to be tied low during the serial programming to keep the GPS receiver quiet that shares the serial port with the download.
Connecting it allYou will need to convert the PC's RS232 Serial with voltage levels of +/-13V to 3.3V (or 5V) TTL in order to communicate directly with the Autopilot board. This can be accomplished in multiple ways. The easiest and most convenient method is to purchase or build a USB -> Serial 3.3V adapter similar to this one TTL-232R-3V3
It is strongly advised that you use a USB-serial converter with of the [FTDI brand] chip, as serial chips from the FTDI brand are by default working well in Linux. As a nice bonus, the Paparazzi ground station software is configured to look for modems on FTDI ports by default, the converter can likely serve as a modem interface after it's use in Bootloader uploading.
Make up a wiring harness similar to the following.
You may vary the details, however this is a working solution:
Tiny V1.x (SERIAL_1):
TINY RXD0 <-- PC SERIAL TX (5V or 3.3V) TINY TXD0 --> PC SERIAL RX (5V or 3.3V) TINY P0.14 --> attach to ground, or wire through a pushbutton to ground TINY GND --> PC SERIAL ADAPTER GND TINY RESET --> optional wired to ground through a pushbutton so you can reset
Tiny V2.x (Connectorname - DOWNLOAD) :
TINY LPC_RXD0 <-- PC SERIAL TX (5V or 3.3V) TINY LPC_TXD0 --> PC SERIAL RX (5V or 3.3V) TINY BOOT --> attach to ground, or wire through a pushbutton to ground TINY GPS_RESET --> attach to ground, or wire through a pushbutton to ground TINY GND --> PC SERIAL ADAPTER GND
TWOG V1.x (Connectorname - DOWNLOAD):
TWOG LPC_RXD0 <-- PC SERIAL TX (5V or 3.3V) TWOG LPC_TXD0 --> PC SERIAL RX (5V or 3.3V) TWOG BOOT --> attach to ground, or wire through a pushbutton to ground TWOG GND --> PC SERIAL ADAPTER GND
For TWOG make sure the GPS module is unplugged from the board. This is to prevent GPS serial data to disturb the uploading of the bootloader.
Upload the firmware
Once this wiring is ready you will be ready to upload the bootloader to the autopilot board from your PC.
To prepare the Autopilot board to accept uploads over its serial port you must have pin P0.14 LOW for at least 3ms while it is powering up or resetting. While it is still powered up it is ready to accept the Bootloader firmware code upload over the serial connection.
The next step while your board is all connected and powered up is to type the commands for uploading the bootloader firmware.
From your Paparazzi folder in Linux, type:
$ make upload_bl PROC=GENERIC
This will begin compiling your USB Bootloader and then attempt to transfer it to the Autopilot board. This will also assume you are using a USB -> Serial adapter for the connection. It uses /dev/ttyUSB0 by default. If your adapter is mapped to a different tty, you will need to modify the Makefile accordingly.
If everything is connected and setup correctly, after a while you will see the following messages
If for some reason you need to program your autopilot board USB Bootloader in MS Windows you have to download the LPC2000 Flash Utility V2.2.3 or later. You will then prepare the autopilot board and start it in ISP bootloader state as described previously. This small utility will ony help uploading the Bootloder firmware. You will need to copy your compiled bl.hex file from Linux to your Windows OS. This file will be then uploaded.