Testing CAN3 in PX4

CAN3 Port Bring-up and Testing in PX4-Autopilot

At this point time (11/11/2024) CAN3 is not enabled to use DronCAN or UAVCAN by default in PX4. The port itself is enabled and can be exercised using CANSEND and CANDUMP commands This tutorial describes how to enable the CAN3 Port on the NXP-VMU-RT117x in PX4-Autopilot, and demonstrates the transmission of CAN Frames between two VMU-RT117x using the can-utils module.

ITEMS REQUIRED

S.No.
Name
Quantity

4

USB-C (Male) to USB-A (Male) Cable [Connects VMU-RT117x and Pixhawk Adaptor with the host]

4

5

Micro-USB (Male) to USB-A (Male) Cable [Connects J-Link EDU Mini Debugger with the host]

2

6

4-Pin JST-GH to 4-Pin JST-GH (Twisted CAN Cable) [Connects the CAN3 Ports of VMU-RT117x]

1

7

JST SH 10-Pin Cable [Connects VMU-RT117x and Pixhawk Debug Adaptor]

2

8

10-Pin 2x5 Socket-Socket IDC (SWD) Ribbon Cable [Connects J-Link and Pixhawk Adaptor]

2

Note: We require 6 USB-A (Female) ports on the host machine for this setup. You may utilize a USB-HUB (USB-A Male to USB-A Female) to get multiple ports on your host machine.

HARDWARE SETUP

The high level overview here is that we want to be able to both program and gain console access to the MR-VMU-RT1176 so we can issue commands. Note that there are other valid ways to get a console, such as through an attached Telemetry radio. Programming may also use MCU-LINK-MR.

Hardware Connections for Reference (Without USB Wires)
CAN3: 4-Pin JST-GH to 4-Pin JST-GH (Twisted CAN Cable) Connection with the CAN3 Port on VMU-RT117x
USB-C Connection with the CAN3 Port on VMU-RT117x
DEBUG: 10-Pin 2x5 Socket-Socket IDC (SWD) Ribbon Cable Connection with the Debug port on VMU-RT117x
Block Diagram for Hardware Connections (Complete)

SOFTWARE SETUP

PX4-Autopilot SETUP

cd ~
git clone git@github.com:PX4/PX4-Autopilot.git
cd PX4-Autopilot
make px4_fmu-v6xrt menuconfig

Select the following options:

  1. Device Drivers → CAN Driver Support

  2. License Setup → Use components that have GPL/LGPL licenses

  3. Application Configuration → CAN Utilities → SocketCAN cansend tool

  4. Application Configuration → CAN Utilities → SocketCAN candump tool

cd ~/PX4-Autopilot

make px4_fmu-v6xrt
make px4_fmu-v6xrt_bootloader
Successful Build Output for px4_fmu-v6xrt
Successful Build Output for px4_fmu-v6xrt_bootloader

FLASH PX4-Autopilot on VMU

Note: The following steps need to be run once for each of the two VMU-RT117x.

Open a new shell and perform the following steps for flashing PX4-Autopilot on VMU-RT117x.

cd ~/PX4-Autopilot
JLinkExe
connect
MIMXRT1176XXXA_M7
S
4000
loadbin boards/px4/fmu-v6xrt/extras/px4_fmu-v6xrt_bootloader.bin 0x30000000
loadbin build/px4_fmu-v6xrt_default/px4_fmu-v6xrt_default.bin 0x30020000
Setting up J-Link for Flashing VMU-RT117x
Successful output for Flashing VMU-RT117x

EXECUTION STEPS

Get the serial shell of the two VMU-RT117x on your host machine.

Execute "candump can2" on one shell and "cansend can2 123#1234567890" on the other.

Last updated

Was this helpful?