# How to integrate RDDRONE-BMS or MR-BMS771 in PX4 via DroneCAN

## Hardware needed

1. NXP BMS (RDDRONE-BMS772 or MR-BMS771)
   1. Including 4 wire CAN wire
   2. Tested on MR-BMS771 (7S – 14S) NXP BMS (planned to be released June 30 2025)
2. FMU (any Pixhawk with CAN)
   1. Tested on MR-VMU-RT1176
3. USB-C cable (FMU to PC)
4. 3V3 FTDI cable and DCD-LZ
5. Programmer (JLink base or edu)

## How to integrate the BMS into PX4 step by step guide

1. Be sure to download the latest the NuttX BMS application example code version 6.0 or higher.
   1. RDDRONE-BMS772: [NXPHoverGames/RDDRONE-BMS772: NuttX source code for RDDRONE-BMS772 ](https://github.com/NXPHoverGames/RDDRONE-BMS772)
   2. MR-BMS771: <https://github.com/NXPHoverGames/MR-BMS771>
2. Program the BMS (see [`releaseNotes`](https://github.com/NXPHoverGames/MR-BMS771/blob/master/BMS771_releaseNotes_7.0.pdf)) and follow the instruction of the releaseNotes to make sure the BMS set up and is operating in NORMAL mode.
3. Make a UART connection to the BMS according the releaseNotes to use the CLI.
4. Enter the following parameters in the CLI for the BMS, save and reboot.
   1. `bms set can-mode dronecan`
   2. `bms set dronecan-node-static-id 31`
   3. `bms set dronecan-bat-info 1`
   4. `bms set dronecan-bat-info-aux 1`
   5. `bms save`
   6. `reboot`
5. Connect from the PC to the FMU with the USB cable
6. Open QGroundControl and wait for auto connect to complete
7. Go to parameters -> UAVCAN and set it to sensors and actuators & save
8. Reboot ((right top) tools -> Reboot vehicle)
9. Go to parameters -> UAVCAN -> UAVCAN\_SUB\_BAT and set to raw data & save
10. Reboot (tools -> Reboot vehicle)
11. Connect 4 wire CAN wire from FMU CAN1 and to BMS CAN0.
12. To validate: go to Analyze -> MAVLink Console and type “uavcan status” -> this should result in
    1. `Sensor ‘battery’:`\
       `Name: uavcan_battery`\
       `Channel 0: node id 31 --> instance 1`
    2. You can also check cell voltages with “listener battery\_status”

It should now work.
