Skip to main content

How to Use Sample Scripts

The 02_sample folder contains scripts for send/receive checks using can-utils.
The transmit samples work simply by running the bash scripts after starting the driver. No arguments are required.

Preparation​

To use them, can-utils must be installed in advance.

sudo apt install can-utils

Copy the sample scripts to the Linux PC and grant execution permission.

cd 02_sample
chmod +x *.sh
note

Before running the samples, load the driver and start can0 / can1 in the 01_drv directory. When checking the transmit side and receive side at the same time, it is easier to check by using separate terminals for reception and transmission.

Procedure for Running Classical CAN Samples​

  1. Start the driver in the 01_drv directory.
cd 01_drv
./mpdrv_run load
./mpdrv_run start-all
  1. Start the receive check in another terminal.
cd 02_sample
./simple_candump.sh
  1. Run the transmit sample in another terminal.
cd 02_sample
./simple_cansend.sh

To check with can1, use the following.

./simple_candump_can1.sh
./simple_cansend_can1.sh

To end the receive check, stop candump with Ctrl + C.

Procedure for Running CAN FD Samples​

  1. Start with CAN FD settings in the 01_drv directory.
cd 01_drv
./mpdrv_run load
MPX_CANFD=1 MPX_BITRATE=500000 MPX_DBITRATE=2000000 ./mpdrv_run start-all
  1. Start the receive check in another terminal.
cd 02_sample
./simple_candump.sh
  1. Run the CAN FD transmit sample in another terminal.
cd 02_sample
./simple_canfdsend.sh

To check with can1, use the following.

./simple_candump_can1.sh
./simple_canfdsend_can1.sh

Sample Script List​

Transmit Samples​

Script nameDetails
simple_cansend.shSends Classical CAN messages 10,000 times with can0.
simple_cansend_can1.shSends Classical CAN messages 10,000 times with can1.
simple_canfdsend.shSends CAN FD messages 10,000 times with can0.
simple_canfdsend_can1.shSends CAN FD messages 10,000 times with can1.

The transmit samples repeatedly run cansend internally. When executed, they send 10,000 frames and then exit after completion.

Receive Samples​

Script nameDetails
simple_candump.shStarts candump with can0.
simple_candump_can1.shStarts candump with can1.

The receive samples start candump internally. To exit, press Ctrl + C.

You can also run candump directly.

candump can0
candump can1

Receive Software Information​

Publicly available software can also be used for receive checks.

  • Wireshark (receive only)

Wireshark Official Site

  • SavvyCAN (send/receive supported)

SavvyCAN Official Site