CAN:
CANFD:
https://github.com/linux-can/can-utils
$ ./candump can0
5. Transmit and receive packets with extended id number (--loop argument here)
$ ./cansend can0 -i 0x333
$ ./candump can0
6. Loopback mode
$ ./canconfig can0 ctrlmode loopback on
7. Checking link state (checking bitrate/errors/packets)
$ ./ip -d -s link show can0
8. Checking net device state
$ ifconfig can0
9. Getting statistics via proc
$ cat /proc/net/can/stats
10. Socket CAN core uses several filter lists to deliver received CAN frames to CAN protocol modules. These
receive lists, their filters and the count of filter matches can be checked in the appropriate receive list. All entries contain the
device and a protocol module identifier:
$ cat /proc/net/can/rcvlist_all
rcvlist_all - list for unfiltered entries (no filter operations)
rcvlist_eff - list for single extended frame (EFF) entries
rcvlist_err - list for error message frames masks
rcvlist_fil - list for mask/value filters
rcvlist_inv - list for mask/value filters (inverse semantic)
rcvlist_sff - list for single standard frame (SFF) entries
To run CANFD, use the below command:
1. Set bit-timing
Canfd supports two bitrates, one for Arbitration phase and other for Data phase. Xilinx CANFD h/w and driver supports these bit rates
$ ./ip link set can0 type can bitrate 125000 dbitrate 8000000 fd on
2. Bring up the device
$ ./ip link set can0 up
3. Bring down the device
$ ./ip link set can0 down
4. Transmit and receive canfd packets with standard id number
$ ./cansend can0 213##
$ ./candump can0
5. Transmit and receive can packets with same controller, since canfd supports backward can also
$ ./cansend can0 123#
$ ./candump can0
6. Loopback mode
$ ./ip link set can0 type can bitrate 125000 dbitrate 8000000 fd on looopback on
7. Checking link state (checking bitrate/errors/packets)
$ ./ip -d link show can0
8. Checking net device state
$ ifconfig can0
Binding Tests:
Microblaze:
a. correct binding with
XILINX_CAN e0008000.ps7-can: phy mem:0xe0008000..0xe0008fff
XILINX_CAN e0008000.ps7-can: reg_base=0xf0062000 irq=60 clock=23809523, tx fifo depth:64
b. Incorrect binding - tests suppose to fail
I. missing clocks
II. missing clock-names
III. missing register
IV. missing interrupt parent
V. missing interrupts number
Zynq:
a. correct binding with
b. Incorrect binding - tests suppose to fail (done on dummy nodes)
I. missing clocks
II. missing clock-names
III. missing register
IV. missing interrupt parent
V. missing interrupts number
Expected Output
root@Xilinx-ZC702-2013:~# canconfig can3 ctrlmode loopback on can3 ctrlmode: loopback[ON], listen-only[OFF], tripple-sampling[OFF],one-shot[OFF], berr-reporting[OFF] root@Xilinx-ZC702-2013:~# cancon root@Xilinx-ZC702-2013:~# canconfig can3 bitrate 500000 XILINX_CAN e0008000.ps7-can can3: bitrate error 0.7% can3 bitrate: 496031, sample-point: 0.666 root@Xilinx-ZC702-2013:~# canconfig can3 start can3 state: ERROR-ACTIVE root@Xilinx-ZC702-2013:~# cansend can3 -i 0x77 0x33 0x88 0x33 0x88 0x33 0x88 0x33 interface = can3, family = 29, type = 3, proto = 1 root@Xilinx-ZC702-2013:~# ip -d -s link show can3 5: can3: <NOARP,UP,LOWER_UP,ECHO> mtu 16 qdisc pfifo_fast state UNKNOWN mode DEFAULT qlen 10 link/can promiscuity 0 can <LOOPBACK> state ERROR-ACTIVE (berr-counter tx 0 rx 0) restart-ms 0 bitrate 496031 sample-point 0.666 tq 672 prop-seg 0 phase-seg1 1 phase-seg2 1 sjw 1 XILINX_CAN: tseg1 1..16 tseg2 1..8 sjw 1..4 brp 1..256 brp-inc 1 clock 23809523 re-started bus-errors arbit-lost error-warn error-pass bus-off 0 0 0 0 0 0 RX: bytes packets errors dropped overrun mcast 7 1 0 0 0 0 TX: bytes packets errors dropped carrier collsns 7 1 0 0 0 0 root@Xilinx-ZC702-2013:~# cansend can3 -i 0x33 0x88 0x33 0x88 0x33 0x99 0x33 0x88 0x88 interface = can3, family = 29, type = 3, proto = 1 root@Xilinx-ZC702-2013:~# ip -d -s link show can3 5: can3: <NOARP,UP,LOWER_UP,ECHO> mtu 16 qdisc pfifo_fast state UNKNOWN mode DEFAULT qlen 10 link/can promiscuity 0 can <LOOPBACK> state ERROR-ACTIVE (berr-counter tx 0 rx 0) restart-ms 0 bitrate 496031 sample-point 0.666 tq 672 prop-seg 0 phase-seg1 1 phase-seg2 1 sjw 1 XILINX_CAN: tseg1 1..16 tseg2 1..8 sjw 1..4 brp 1..256 brp-inc 1 clock 23809523 re-started bus-errors arbit-lost error-warn error-pass bus-off 0 0 0 0 0 0 RX: bytes packets errors dropped overrun mcast 15 2 0 0 0 0 TX: bytes packets errors dropped carrier collsns 15 2 0 0 0 0 root@Xilinx-ZC702-2013:~# cansen root@Xilinx-ZC702-2013:~# cansend can3 -i 0x88 0x33 0x88 0x33 0x88 x0x33 0x88 0x33 0x88 --loop=10 interface = can3, family = 29, type = 3, proto = 1 root@Xilinx-ZC702-2013:~# ip -d -s link show can3 5: can3: <NOARP,UP,LOWER_UP,ECHO> mtu 16 qdisc pfifo_fast state UNKNOWN mode DEFAULT qlen 10 link/can promiscuity 0 can <LOOPBACK> state ERROR-ACTIVE (berr-counter tx 0 rx 0) restart-ms 0 bitrate 496031 sample-point 0.666 tq 672 prop-seg 0 phase-seg1 1 phase-seg2 1 sjw 1 XILINX_CAN: tseg1 1..16 tseg2 1..8 sjw 1..4 brp 1..256 brp-inc 1 clock 23809523 re-started bus-errors arbit-lost error-warn error-pass bus-off 0 0 0 0 0 0 RX: bytes packets errors dropped overrun mcast 95 12 0 0 0 0 TX: bytes packets errors dropped carrier collsns 95 12 0 0 0 0 root@Xilinx-ZC702-2013:~#