DroneCAN (formerly UAVCAN v1/v0) is a lightweight, publish-subscribe protocol designed for reliable communication over CAN bus in aerospace and robotics systems. ArduPilot’sDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/Ardupilot/ardupilot/llms.txt
Use this file to discover all available pages before exploring further.
AP_DroneCAN library implements the full DroneCAN stack, including dynamic node allocation, parameter exchange, and ESC/servo output over the bus. The companion AP_CANManager library owns the physical CAN interfaces and dispatches frames to the correct protocol driver.
Robust Bus Topology
CAN bus provides differential signalling and hardware error detection, making it more noise-immune than UART-based peripherals in electrically noisy environments.
Plug-and-Play Nodes
Dynamic Node Allocation (DNA) lets new CAN peripherals join the bus without manual node-ID configuration. The flight controller acts as the DNA server.
Rich Peripheral Ecosystem
Supported peripherals include GPS/compass modules, ESCs, airspeed sensors, battery monitors, rangefinders, RGB LEDs, and buzzers.
AP_Periph Firmware
Any board running ArduPilot can become a CAN peripheral using the
AP_Periph firmware, enabling custom sensor integration over DroneCAN.Architecture overview
AP_CANManager
AP_CANManager initialises the hardware CAN interfaces and registers protocol drivers against them. It is a singleton accessible as AP::can().
CAN interface parameters
Each physical CAN port is configured with aCAN_Pn_* parameter group where n is the port index (1-based):
| Parameter | Description |
|---|---|
CAN_P1_DRIVER | Driver instance to assign to this interface (1 = first driver, 2 = second) |
CAN_P1_BITRATE | Bus bitrate in bits/s (default 1 000 000) |
CAN_P1_FDBITRATE | CAN-FD data-phase bitrate (0 = disable FD mode) |
CAN_P2_DRIVER | Driver instance for the second physical interface |
AP_DroneCAN
AP_DroneCAN is a driver that implements the DroneCAN protocol on top of the libcanard stack. Multiple driver instances can run simultaneously (one per physical interface or paired interfaces).
DroneCAN driver parameters
| Parameter | Description |
|---|---|
CAN_D1_PROTOCOL | Protocol for driver 1. See the protocol table below. |
CAN_D1_UC_NODE | This autopilot’s DroneCAN node ID (1–127; 0 = auto) |
CAN_D1_UC_ESC_BM | Bitmask of servo channels routed to DroneCAN ESCs |
CAN_D1_UC_SRV_BM | Bitmask of servo channels routed to DroneCAN servos |
CAN_D1_UC_OPTION | Options bitmask (see below) |
Protocol values for CAN_Dn_PROTOCOL
| Value | Protocol | Notes |
|---|---|---|
0 | None | Interface disabled |
1 | DroneCAN | Standard DroneCAN (UAVCAN v0) |
4 | PiccoloCAN | Currawong Piccolo ESC protocol |
6 | EFI_NWPMU | NWPMU EFI controller |
7 | USD1 | USD1 rangefinder |
8 | KDECAN | KDE Direct ESC protocol |
10 | Scripting | Lua scripting access |
11 | Benewake | Benewake rangefinder |
Values 2, 3, 5, and 9 are reserved (previously used protocols that have been removed). Do not reuse them.
Dynamic Node Allocation (DNA)
When a new peripheral powers on without a configured node ID, it broadcasts an allocation request. TheAP_DroneCAN_DNA_Server (running on the flight controller) responds with a unique node ID chosen from the range 1–127. Assignments are stored persistently so that the same peripheral always receives the same ID after a power cycle.
DNA options bitmask (CAN_D1_UC_OPTION)
| Bit | Option | Effect |
|---|---|---|
| 0 | DNA_CLEAR_DATABASE | Clear stored node assignments on next boot |
| 1 | DNA_IGNORE_DUPLICATE_NODE | Do not warn on duplicate node IDs |
| 2 | CANFD_ENABLED | Enable CAN-FD mode on this driver |
| 3 | DNA_IGNORE_UNHEALTHY_NODE | Ignore nodes reporting unhealthy status |
| 4 | USE_ACTUATOR_PWM | Send servo output as ActuatorCommand instead of raw PWM |
| 5 | SEND_GNSS | Re-broadcast GNSS fix from flight controller onto the bus |
ESC output over DroneCAN
WhenCAN_D1_UC_ESC_BM is set, AP_DroneCAN::SRV_send_esc() publishes uavcan.equipment.esc.RawCommand messages at the rate configured by CAN_D1_UC_SRV_RT (Hz). Each bit in the bitmask enables one ESC channel.
Supported peripheral types
GPS and Compass
GPS and Compass
DroneCAN GPS modules publish
uavcan.equipment.gnss.Fix2 and optionally uavcan.equipment.gnss.Auxiliary. Many modules also include a magnetometer published as uavcan.equipment.ahrs.MagneticFieldStrength2. These are detected and consumed by AP_GPS_DroneCAN and the compass subsystem automatically.ESCs
ESCs
DroneCAN ESCs receive
uavcan.equipment.esc.RawCommand (throttle values, –8192 to +8191 scaled from the servo output range). They reply with uavcan.equipment.esc.Status carrying RPM, voltage, current, and temperature. ArduPilot consumes this via the ESC telemetry backend.Airspeed
Airspeed
Airspeed sensors publish
uavcan.equipment.air_data.IndicatedAirspeed and uavcan.equipment.air_data.StaticPressure. Detected by AP_Airspeed_DroneCAN.Battery Monitor
Battery Monitor
Battery nodes publish
uavcan.equipment.power.BatteryInfo. Detected by AP_BattMonitor_DroneCAN. Set BATTn_MONITOR = 8 to enable.Rangefinder
Rangefinder
Rangefinder nodes publish
uavcan.equipment.range_sensor.Measurement. Detected by AP_RangeFinder_DroneCAN. Set RNGFNDn_TYPE = 24 to enable.LED and Buzzer
LED and Buzzer
AP_DroneCAN::led_write() publishes uavcan.equipment.indication.LightsCommand. set_buzzer_tone() publishes uavcan.equipment.indication.BeepCommand. Both are driven by the AP_Notify system automatically.Parameter exchange
The DroneCAN parameter protocol allows the flight controller to read and write parameters on any node. This is used during configuration and by theSLCAN pass-through for GUI tools.
AP_Periph: custom CAN peripheral firmware
AP_Periph (located in Tools/AP_Periph/) is a stripped-down ArduPilot build that runs on small CAN nodes. It re-uses the same sensor drivers (AP_GPS, AP_Compass, AP_Baro, etc.) but outputs data over DroneCAN rather than MAVLink.
To create a custom CAN peripheral:
- Add your sensor driver to the AP_Periph build in
Tools/AP_Periph/. - Define the DroneCAN message publisher in the peripheral’s main loop.
- Flash the peripheral board with the resulting firmware.
- On the flight controller, set
CAN_D1_PROTOCOL = 1andCAN_P1_DRIVER = 1.
Wiring and setup checklist
- Termination — 120 Ω resistors at both physical ends of the bus.
- Bitrate — All nodes must use the same bitrate (default 1 Mbit/s via
CAN_P1_BITRATE). - Driver assignment — Set
CAN_P1_DRIVER = 1andCAN_D1_PROTOCOL = 1for DroneCAN. - Node IDs — Leave
CAN_D1_UC_NODE = 0(auto) unless you have a reason to assign a fixed ID. - Peripheral type — Set the appropriate
*_TYPEparameter for each peripheral class (e.g.GPS_TYPE = 9for DroneCAN GPS). - Reboot — CAN initialisation happens at boot; a reboot is required after changing
CAN_*parameters.