Skip to main content

Installation and Driver Startup

Folder Structure

Folder / FileDescription
01_drvDirectory containing the SocketCAN driver.
02_sampleDirectory containing sample scripts.
ReadMe.txtSource file for this manual.

Installation Procedure

Build the Driver (First Time Only)

  1. Copy the 01_drv directory to your Linux PC.
  2. Open a terminal, move to 01_drv, and run the make command (GCC required).
cd 01_drv
make

A binary for the currently running kernel will be generated.

Starting the MicroPeckerX SocketCAN Driver

Quick Start

mpdrv_run is a script that consolidates the steps required to start the MicroPeckerX SocketCAN driver. Use it to launch the driver easily.

  1. Grant execute permission to the mpdrv_run file.
chmod +x mpdrv_run
  1. Load the driver.
./mpdrv_run load
  1. Start both the can0 and can1 channels (start both even if you only use one).
./mpdrv_run start can0
./mpdrv_run start can1

Step-by-Step Startup

This section explains how to start the MicroPeckerX SocketCAN driver manually.

  1. Load the SocketCAN kernel driver.
sudo modprobe can
  1. Load the library for the device driver.
sudo modprobe can_div
  1. Load the MicroPeckerX driver.
sudo insmod ./MpxDrv.ko
  1. Configure the CAN / CAN FD protocol settings for can0.
sudo ip link set can0 mtu 16

The configuration values are as follows.

ProtocolSetting
CANmtu 16
CAN FDmtu 72
  1. Bring up the can0 network interface at 500 kbps.
sudo ip link set can0 up type can bitrate 500000

The driver supports two channels, so start can1 in the same way.

  1. Configure the CAN / CAN FD protocol settings for can1.
sudo ip link set can1 mtu 16
  1. Bring up the can1 network interface at 500 kbps.
sudo ip link set can1 up type can bitrate 500000

This completes the startup procedure for the MicroPeckerX SocketCAN driver.

tip

Please also refer to the following YouTube video for installation instructions.

MicroPeckerX SocketCAN Driver Quick Start Guide (candump)

The video shows an older version. The latest release supports two channels, so please start both can0 and can1.