SW Environment Setup:
1. Prepare L5.10.35 Yocto and build Image
The prebuilt image also is available and useable.
2. Flash image to the SD card
Refer to the Yocto User Guide.
3. Compile flash.bin without M4 and flash it to sdcard (flash.bin as attachment)
make SOC=iMX8QM flash
sudo dd if=flash.bin of=/dev/sde bs=1k seek=32 conv=fsync
HW Environment Setup:
Prepare the imx8qm MEK CPU board and base board and DB9 male cable, connect to CAN0 and CAN1 female connector on base board. (Pin to Pin connection)
User Case:
1. Power on board and configure specify dtb file in uboot
setenv fdt_file imx8qm_mek.dtb
2. Boot up and config bitrate for can0 and can1 in kernel
root@imx8qmmek:~# ip link set can0 up type can bitrate 500000
root@imx8qmmek:~# ip link set can1 up type can bitrate 500000
3. Check CAN0 and CAN1 devices
root@imx8qmmek:~# ifconfig
can0: flags=193<UP,RUNNING,NOARP> mtu 16
unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 txqueuelen 10 (UNSPEC)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
device interrupt 85
can1: flags=193<UP,RUNNING,NOARP> mtu 16
unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 txqueuelen 10 (UNSPEC)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
device interrupt 86
3. Run candump for CAN1
root@imx8qmmek:~# candump can1 &
[1] 1215
[ 65.624580] can: controller area network core
[ 65.630225] NET: Registered protocol family 29
[ 65.641158] can: raw protocol
4. Run cansend for CAN0
root@imx8qmmek:~# cansend can0 5A1#11.2233.44556677.88
can1 5A1 [8] 11 22 33 44 55 66 77 88
The above red is output result from CAN1.