Lpc21BootloaderUpload

From PaparazziUAV
Revision as of 04:45, 27 June 2010 by Openuas (talk | contribs)
Jump to navigation Jump to search

Installing the USB Bootloader

The USB bootloader only needs to be installed once, when the board is first built and has never been used. [Image:Bare_TWOG_Board.jpg|thumb|right|Bare_TWOG_Board] The Bootloader is uploaded through the serial interface UART0 (Serial1) by holding pin P0.14 low during power-up on Tiny V1.x. For 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. If you have a TWOG, it is easier just to unplug the GPS module temporarily. If you did not make and soldered the Autopilot board yourself but bought it somewhere it may have already had the USB bootloader installed, please check with your supplier. In that case you can just skip the steps described here.

You 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

The FTDI RS232 USB Cable

Some examples of suppliers: [1] [2] [3] [4]

It is strongly advised that you use a USB-serial converter with of the [www.ftdichip.com/ FTDI brand] chip as FTDI serial chips 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 (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 (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.

Where to insert Bootloader cable

Once this wiring is ready you will be ready to upload the USB Bootloader to the autopilot board from your PC.

To prepare the Autopilot board to accept uploads over it's 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.

In Linux

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.

Wait for the bootloader to upload

If everything is connected and dsetup correctly, after a while you will see the following messages

Shell Bootloader upload success

In Windows

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 in the previous. 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.


In depth info about the boatloader can be forun in the |Bootloader reference

http://paparazzi.enac.fr/wiki/DevGuide/USBDownload