i.MX 93 BSP Manual PD24.1.1 Documentation Rev.: imx8mp-pd22.1.2-51-ga548be7d
• To get information on can0, such as bit rate and error counters, type:
target:~$ ip -d -s link show can0
4: can0: <NOARP,UP,LOWER_UP,ECHO> mtu 16 qdisc pfifo_fast state UP mode DEFAULT group␣
,→default qlen 10
link/can promiscuity 0 allmulti 0 minmtu 0 maxmtu 0
can state ERROR-ACTIVE (berr-counter tx 0 rx 0) restart-ms 0
bitrate 500000 sample-point 0.875
tq 25 prop-seg 37 phase-seg1 32 phase-seg2 10 sjw 1 brp 1
flexcan: tseg1 2..96 tseg2 2..32 sjw 1..16 brp 1..1024 brp_inc 1
flexcan: dtseg1 2..39 dtseg2 2..8 dsjw 1..4 dbrp 1..1024 dbrp_inc 1
clock 40000000
re-started bus-errors arbit-lost error-warn error-pass bus-off
0 0 0 0 0 0 numtxqueues 1␣
,→numrxqueues 1 gso_max_size 65536 gso_max_segs 65535 tso_max_size 65536 tso_max_segs 65535␣
,→gro_max_size 65536 parentbus platform parentdev 443a0000.can
RX: bytes packets errors dropped missed mcast
0 0 0 0 0 0
TX: bytes packets errors dropped carrier collsns
0 0 0 0 0 0
The output contains a standard set of parameters also shown for Ethernet interfaces, so not all of these
are necessarily relevant for CAN (for example the MAC address). The following output parameters contain
useful information:
can0 Interface Name
NOARP CAN cannot use ARP protocol
MTU Maximum Transfer Unit
RX packets Number of Received Packets
TX packets Number of Transmitted Packets
RX bytes Number of Received Bytes
TX bytes Number of Transmitted Bytes
errors… Bus Error Statistics
The CAN conguration is done in the systemd conguration le /lib/systemd/network/can0.network. For
a persistent change of (as an example, the default bitrates), change the conguration in the BSP under
./meta-ampliphy/recipes-core/systemd/systemd-conf/can0.network in the root lesystem and rebuild the
root lesystem.
[Match]
Name=can0
[Can]
BitRate=500000
The bitrate can also be changed manually, for example, to make use of the exible bitrate:
target:~$ ip link set can0 down
target:~$ ip link set can0 txqueuelen 10 up type can bitrate 500000 sample-point 0.75 dbitrate␣
,→4000000 dsample-point 0.8 fd on
You can send messages with cansend or receive messages with candump:
Accessing Peripherals 65