2023-08-26 18:43:34 -03:00
|
|
|
# AP_Periph DroneCAN Peripheral Firmware
|
2019-09-10 03:40:25 -03:00
|
|
|
|
2023-08-26 18:43:34 -03:00
|
|
|
This is an ArduPilot based DroneCAN peripheral firmware. This firmware
|
2019-10-28 19:36:47 -03:00
|
|
|
takes advantage of the wide range of sensor drivers in ArduPilot to
|
2023-08-26 18:43:34 -03:00
|
|
|
make building a DroneCAN peripheral firmware easy.
|
2019-10-28 19:36:47 -03:00
|
|
|
|
|
|
|
The AP_Periph firmware is based on the same ChibiOS hwdef.dat system
|
|
|
|
that is used to define pinouts for STM32 based flight controllers
|
|
|
|
supported by ArduPilot. That means you can add support for a new
|
2023-08-26 18:43:34 -03:00
|
|
|
DroneCAN peripheral based on the STM32 by just writing a simple
|
2019-10-28 19:36:47 -03:00
|
|
|
hwdef.dat that defines the pinout of your device.
|
|
|
|
|
2023-08-26 18:43:34 -03:00
|
|
|
We have over 60 build targets building for AP_Periph firmwares. All
|
|
|
|
ArduPilot supported MCUs can be used, including:
|
2019-09-10 03:40:25 -03:00
|
|
|
|
2023-08-26 18:43:34 -03:00
|
|
|
- STM32F1xx
|
|
|
|
- STM32F3xx
|
|
|
|
- STM32F4xx
|
|
|
|
- STM32F7xx
|
|
|
|
- STM32H7xx
|
|
|
|
- STM32L4xx
|
|
|
|
- STM32G4xx
|
2019-10-28 19:36:47 -03:00
|
|
|
|
2019-10-31 18:37:00 -03:00
|
|
|
More can be added using the hwdef.dat system
|
2019-10-28 19:36:47 -03:00
|
|
|
|
|
|
|
# Features
|
|
|
|
|
|
|
|
The AP_Periph firmware can be configured to enable a wide range of
|
2023-08-26 18:43:34 -03:00
|
|
|
DroneCAN sensor types. Support is included for:
|
2019-10-28 19:36:47 -03:00
|
|
|
|
|
|
|
- GPS modules (including RTK GPS)
|
|
|
|
- Magnetometers (SPI or I2C)
|
|
|
|
- Barometers (SPI or I2C)
|
|
|
|
- Airspeed sensors (I2C)
|
|
|
|
- Rangefinders (UART or I2C)
|
2023-09-16 13:46:41 -03:00
|
|
|
- ADSB (uAvionix compatible Ping ADSB receiver on UART)
|
2020-12-11 13:44:46 -04:00
|
|
|
- Battery Monitor (Analog, I2C/SMBus, UART)
|
2019-10-28 19:36:47 -03:00
|
|
|
- LEDs (GPIO, I2C or WS2812 serial)
|
|
|
|
- Safety LED and Safety Switch
|
|
|
|
- Buzzer (tonealarm or simple GPIO)
|
2020-12-12 05:08:45 -04:00
|
|
|
- RC Output (All standard RCOutput protocols)
|
2023-08-26 18:43:34 -03:00
|
|
|
- RC input
|
|
|
|
- battery balance monitor
|
|
|
|
- EFI engines
|
|
|
|
- Proximity sensors
|
2019-10-28 19:36:47 -03:00
|
|
|
|
2023-08-26 18:43:34 -03:00
|
|
|
An AP_Periph DroneCAN firmware supports these DroneCAN features:
|
2019-10-28 19:36:47 -03:00
|
|
|
|
|
|
|
- dynamic or static CAN node allocation
|
|
|
|
- firmware upload
|
|
|
|
- automatically generated bootloader
|
|
|
|
- parameter storage in flash
|
|
|
|
- easy bootloader update
|
|
|
|
- high resiliance features using watchdog, CRC and board checks
|
2023-02-22 13:36:19 -04:00
|
|
|
- firmware and parameter update via MissionPlanner or DroneCAN GUI tool when attached to an autopilot
|
|
|
|
- firmware update via USB if USB port is provided
|
|
|
|
- parameter update using SLCAN and DroneCAN GUI on standalone peripheral via USB, if provided
|
2019-09-10 03:40:25 -03:00
|
|
|
|
|
|
|
# Building
|
|
|
|
|
2019-10-02 08:55:41 -03:00
|
|
|
Using f103-GPS as an example, build the main firmware like this:
|
2019-09-10 03:40:25 -03:00
|
|
|
|
2019-10-02 08:55:41 -03:00
|
|
|
- ./waf configure --board f103-GPS
|
2019-09-10 03:40:25 -03:00
|
|
|
- ./waf AP_Periph
|
|
|
|
|
2019-10-02 08:55:41 -03:00
|
|
|
that will build a file build/f103-GPS/bin/AP_Periph.bin. You can
|
2023-08-26 18:43:34 -03:00
|
|
|
now load that using the CAN bootloader and either dronecan_gui_tool or
|
|
|
|
MissionPlanner DroneCAN support.
|
2019-09-10 03:40:25 -03:00
|
|
|
|
|
|
|
# Flashing
|
|
|
|
|
|
|
|
To load directly with a stlink-v2, do this:
|
|
|
|
|
2019-10-02 08:55:41 -03:00
|
|
|
- st-flash write build/f103-GPS/bin/AP_Periph.bin 0x8006400
|
2019-09-10 03:40:25 -03:00
|
|
|
|
|
|
|
for the CUAV_GPS which loads at offset 0x10000 use this:
|
|
|
|
|
|
|
|
- st-flash write build/CUAV_GPS/bin/AP_Periph.bin 0x8010000
|
|
|
|
|
|
|
|
# Flashing bootloader
|
|
|
|
|
|
|
|
To flash the bootloader use this:
|
|
|
|
|
2019-10-02 08:55:41 -03:00
|
|
|
- st-flash write Tools/bootloaders/f103-GPS_bl.bin 0x8000000
|
2019-09-10 03:40:25 -03:00
|
|
|
|
|
|
|
# Building bootloader
|
|
|
|
|
|
|
|
To build the bootloader use this:
|
|
|
|
|
2021-01-10 08:44:15 -04:00
|
|
|
- Tools/scripts/build_bootloaders.py f103-GPS
|
2019-09-10 03:40:25 -03:00
|
|
|
|
|
|
|
the resulting bootloader will be in Tools/bootloaders
|
|
|
|
|
2019-11-07 00:49:38 -04:00
|
|
|
# Firmware Builds
|
|
|
|
|
|
|
|
Firmware targets are automatically built and distributed on the
|
|
|
|
ArduPilot firmware server on firmware.ardupilot.org. These firmwares
|
2023-08-26 18:43:34 -03:00
|
|
|
can be loaded using Mission Planner or the DroneCAN GUI Tool. Parameters
|
|
|
|
for peripherals can be changed using the Mission Planner DroneCAN support
|
|
|
|
or using DroneCAN GUI Tools.
|
2019-11-09 05:45:15 -04:00
|
|
|
|
|
|
|
# User Bootloader Update
|
|
|
|
|
|
|
|
The bootloader is automatically stored in ROMFS in the main
|
2023-08-26 18:43:34 -03:00
|
|
|
firmware. End users can update the bootloader by setting the DroneCAN
|
2019-11-09 05:45:15 -04:00
|
|
|
parameter "FLASH_BOOTLOADER" to 1. After setting it to 1 the node will
|
2023-08-26 18:43:34 -03:00
|
|
|
respond with a debug text message which can be seen in the DroneCAN GUI
|
2019-11-09 05:45:15 -04:00
|
|
|
tool to show the result of the flash.
|
2019-11-09 06:54:43 -04:00
|
|
|
|
2020-11-09 04:11:20 -04:00
|
|
|
# SITL Testing
|
|
|
|
|
2023-08-26 18:43:34 -03:00
|
|
|
A wide range of DroneCAN peripherals are supported in the SITL
|
|
|
|
simulation system. The simplest way of starting a DroneCAN enabled
|
|
|
|
simulated vehicle is to use sim_vehicle.py.
|
|
|
|
|
|
|
|
For a quadplane use: sim_vehicle.py with the option -f quadplane-can
|
|
|
|
|
|
|
|
For a quadcopter use: sim_vehicle.py with the option -f quad-can
|
2020-11-09 04:11:20 -04:00
|
|
|
|
2019-11-09 06:54:43 -04:00
|
|
|
# Discussion and Feedback
|
|
|
|
|
|
|
|
Please join the discussions at these locations:
|
|
|
|
|
2023-08-26 18:43:34 -03:00
|
|
|
- https://discuss.ardupilot.org/
|
|
|
|
- https://ardupilot.org/discord
|
|
|
|
|