arrow-left

All pages
gitbookPowered by GitBook
1 of 1

Loading...

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.

hashtag
ITEMS REQUIRED

S.No.
Name
Quantity
circle-info

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.

hashtag
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.

hashtag
SOFTWARE SETUP

hashtag
PX4-Autopilot SETUP

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

circle-exclamation

In file "~/PX4-Autopilot/platforms/nuttx/init/imxrt/rc.board_arch_defaults", add the line "param set-default -s UAVCAN_ENABLE 1" after line number 6.

hashtag
FLASH PX4-Autopilot on VMU

triangle-exclamation

For simplicity, connect only one setup at a time with your host machine, i.e. only 1 VMU-RT117x + Pixhawk Debug Adaptor + J-Link EDU MINI.

Alternatively, you may connect both the setups simultaneously and select the appropriate J-Link when running JLinkExe command.

circle-info

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.

hashtag
EXECUTION STEPS

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

circle-exclamation

Note: Baudrate for the serial console is 57600.

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

1

7

[Connects VMU-RT117x and Pixhawk Debug Adaptor]

2

8

[Connects J-Link and Pixhawk Adaptor]

2

Application Configuration → CAN Utilities → SocketCAN candump tool

1

NXP-VMU-RT117xarrow-up-right

2

2

J-Link EDU MINI DEBUGGERarrow-up-right

2

3

Pixhawk Debug Adaptorarrow-up-right

2

4

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

4

5

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

2

6

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)
Successful Build Output for px4_fmu-v6xrt
Successful Build Output for px4_fmu-v6xrt_bootloader
Setting up J-Link for Flashing VMU-RT117x
Successful output for Flashing VMU-RT117x

[Connects the CAN3 Ports of VMU-RT117x]

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

make px4_fmu-v6xrt
make px4_fmu-v6xrt_bootloader
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
4-Pin JST-GH to 4-Pin JST-GH (Twisted CAN Cable)arrow-up-right
JST SH 10-Pin Cablearrow-up-right
10-Pin 2x5 Socket-Socket IDC (SWD) Ribbon Cablearrow-up-right