Redirecting...

This page has moved to https://docs.px4.io/master/en/uavcan/bootloader_installation.html.

Click here if you are not redirected.

UAVCAN Bootloader Installation

UAVCAN devices typically ship with a bootloader pre-installed. Do not follow the instructions in this section unless you are developing UAVCAN devices.

Overview

The PX4 project includes a standard UAVCAN bootloader for STM32 devices.

The bootloader occupies the first 8–16 KB of flash, and is the first code executed on power-up. Typically, the bootloader performs low-level device initialization, automatically determines the CAN bus baud rate, acts as a UAVCAN dynamic node ID client to obtain a unique node ID, and waits for confirmation from the flight controller before proceeding with application boot.

This process ensures that a UAVCAN device can recover from invalid or corrupted application firmware without user intervention, and also permits automatic firmware updates.

Prerequisites

Installing or updating the UAVCAN bootloader requires:

Device Preparation

If you are unable to connect to your device using the instructions below, it's possible that firmware already on the device has disabled the MCU's debug pins. To recover from this, you will need to connect your interface's NRST or nSRST pin (pin 15 on the standard ARM 20-pin connector) to your MCU's NRST pin. Obtain your device schematics and PCB layout or contact the manufacturer for details.

Installation

After compiling or obtaining a bootloader image for your device (refer to device documentation for details), the bootloader must be copied to the beginning of the device's flash memory.

The process for doing this depends on the SWD or JTAG interface used.

BlackMagic Probe

Ensure your BlackMagic Probe firmware is up to date.

Connect the probe to your UAVCAN device, and connect the probe to your computer.

Identify the probe's device name. This will typically be /dev/ttyACM<x> or /dev/ttyUSB<x>.

Power up your UAVCAN device, and run:

arm-none-eabi-gdb /path/to/your/bootloader/image.elf

At the gdb prompt, run:

target extended /dev/ttyACM0
monitor connect_srst enable
monitor swdp_scan
attach 1
set mem inaccessible-by-default off
load
run

If monitor swdp_scan returns an error, ensure your wiring is correct, and that you have an up-to-date version of the BlackMagic firmware.

Ensure you have a recent version—at least 0.9.0—of OpenOCD.

Connect the ST-Link to your UAVCAN device, and connect the ST-Link to your computer.

Power up your UAVCAN device, and run:

openocd -f /path/to/your/openocd.cfg &
arm-none-eabi-gdb /path/to/your/bootloader/image.elf

At the gdb prompt, run:

target extended-remote localhost:3333
monitor reset halt
set mem inaccessible-by-default off
load
run

Connect the JLink Debugger to your UAVCAN device, and connect the JLink Debugger to your computer.

Power up your UAVCAN device, and run:

JLinkGDBServer -select USB=0 -device STM32F446RE -if SWD-DP -speed 20000 -vd

Open a second terminal, navigate to the directory that includes the px4esc_1_6-bootloader.elf for the esc and run:

arm-none-eabi-gdb px4esc_1_6-bootloader.elf

At the gdb prompt, run:

tar ext :2331
load

As a recovery method it may be useful to erase flash to factory defaults such that the firmware is using the default parameters. Go to the directory of your SEGGER installation and launch JLinkExe, then run:

device <name-of-device>
erase

Replace <name-of-device> with the name of the microcontroller, e.g. STM32F446RE for the Pixhawk ESC 1.6 or STM32F302K8 for the SV2470VC ESC.

results matching ""

    No results matching ""