How to use CanBus with Python on NVIDIA Jetson NX Module?
Jetson Xavier NX 24 February 2021

In this post, we will use CanBus standard with Python on NVIDIA Jetson NX Module. For doing that, we will use a host machine which has Windows 10 operating system , "IXXAT Usb-to-Can converter" and NVIDIA Jetson NX Module. We need to install Can Analyser interface for checking data stream.

 

Firstly, we have to run the script which enables us to use Can standard like below.

 

./enable_can_nx.sh

 

 

"python3-pip", "python3-can" should be install by using "sudo apt-get install" command . "can" and "python-can" should be installed with by using "pip3" command.

 

sudo apt-get install python3-pip

pip3 install can

sudo apt-get install python3-can

pip3 install python-can

 
 
 

On host side, we have to make sure that the bitrate and protocol are set as "Both" and "500kbit/s" respectively. For doing that, we should click the "setting button".

 
 

Than we can set the bitrate and protocol properties from this window. When we are done with the arrangements , we should click the "OK" button.

 
 
 
 
 

We use the script to transmit and receive data via CanBus. You can find the script at the end of the post.

 

sudo python3 testcanbus.py

 
 

When we run this script on NVIDIA Jetson NX module, a message will be sent to host machine from the Jetson module.

 

 
 

The sent message can be seen on Can Analyser interface like below.

 
 
 
 

For transmitting a message from the host machine, we should press the transmit button which is shown on below. By doing that, we can send the data from the host machine to the NVIDIA Jetson module.

 
 
 

The written data can be seen on Jetson module.

 

 
You can find the zip files here.
ZIP 1
ZIP 2

Thanks for reading.