Hi,
I use imx8mp to run the loopback test, but seems like it can't leave the self loopback mode.
#!/bin/bash
COUNT=1
while true
do
echo -e "\n count=$COUNT\n"
COUNT=$(($COUNT+1))
echo -e "\n##test 1 wire-loopback"
ip link set can0 up type can bitrate 500000 dbitrate 2000000 fd on
ip link set can1 up type can bitrate 500000 dbitrate 2000000 fd on
candump can1 &
candump can0 &
cansend can0 123##1
cansend can1 123##1
sleep 2
echo -e "# kill all candump and set can to down"
killall candump
ip link set can0 down
ip link set can1 down
echo -e "\n##test2 self-loopback"
ip link set can0 up type can bitrate 500000 dbitrate 2000000 fd on loopback on
ip link set can1 up type can bitrate 500000 dbitrate 2000000 fd on loopback on
candump can1 &
candump can0 &
cansend can0 123##1
cansend can1 123##1
sleep 2
echo -e "# kill all candump and set can to down"
killall candump
ip link set can0 down
ip link set can1 down
echo -e "\n##test 3-1 wire-loopback can0-> can1"
ip link set can0 up type can bitrate 500000 dbitrate 2000000 fd on
ip link set can1 up type can bitrate 500000 dbitrate 2000000 fd on
candump can1 &
cansend can0 123##1
sleep 2
echo -e "# kill all candump and set can to down"
killall candump
ip link set can0 down
ip link set can1 down
echo -e "\n##test 3-2 wire-loopback can1->can0"
ip link set can0 up type can bitrate 500000 dbitrate 2000000 fd on
ip link set can1 up type can bitrate 500000 dbitrate 2000000 fd on
candump can0 &
cansend can1 123##1
sleep 2
echo -e "# kill all candump and set can to down"
killall candump
ip link set can0 down
ip link set can1 down
done
root@edm-g-imx8mp:~# ./2_test_can.sh
count=1
##test 1 wire-loopback
RTNETLINK answers: Device or resource busy
RTNETLINK answers: Device or resource busy
can0 123 [00]
can0 123 [00]
can1 123 [00]
can1 123 [00]
# kill all candump and set can to down
##test2 self-loopback
[ 716.425196] IPv6: ADDRCONF(NETDEV_CHANGE): can0: link becomes ready
[ 716.435328] IPv6: ADDRCONF(NETDEV_CHANGE): can1: link becomes ready
can0 123 [00]
can0 123 [00]
can1 123 [00]
can1 123 [00]
# kill all candump and set can to down
##test 3-1 wire-loopback can0-> can1
[ 718.468560] IPv6: ADDRCONF(NETDEV_CHANGE): can0: link becomes ready
[ 718.479017] IPv6: ADDRCONF(NETDEV_CHANGE): can1: link becomes ready
# kill all candump and set can to down
##test 3-2 wire-loopback can1->can0
[ 720.511155] IPv6: ADDRCONF(NETDEV_CHANGE): can0: link becomes ready
[ 720.521521] IPv6: ADDRCONF(NETDEV_CHANGE): can1: link becomes ready
# kill all candump and set can to down
count=2
##test 1 wire-loopback
[ 722.553288] IPv6: ADDRCONF(NETDEV_CHANGE): can0: link becomes ready
[ 722.563775] IPv6: ADDRCONF(NETDEV_CHANGE): can1: link becomes ready
can0 123 [00]
can0 123 [00]
can1 123 [00]
can1 123 [00]
# kill all candump and set can to down
##test2 self-loopback
[ 724.597857] IPv6: ADDRCONF(NETDEV_CHANGE): can0: link becomes ready
[ 724.608352] IPv6: ADDRCONF(NETDEV_CHANGE): can1: link becomes ready
can0 123 [00]
can0 123 [00]
can1 123 [00]
can1 123 [00]
# kill all candump and set can to down
##test 3-1 wire-loopback can0-> can1
[ 726.642325] IPv6: ADDRCONF(NETDEV_CHANGE): can0: link becomes ready
[ 726.652862] IPv6: ADDRCONF(NETDEV_CHANGE): can1: link becomes ready
# kill all candump and set can to down
##test 3-2 wire-loopback can1->can0
[ 728.684203] IPv6: ADDRCONF(NETDEV_CHANGE): can0: link becomes ready
[ 728.694695] IPv6: ADDRCONF(NETDEV_CHANGE): can1: link becomes ready
Hi @yoooh8668,
I don't think this issue could be due to can't leaving self-loopback mode as CAN works again as " 1 wire-loopback" in the count 2 test.
To test CAN functionality in imx SoCs one can try looking at root/test/can/doc/FSL-UT-CAN-003.txt at imx-test.
I hope it helps!
Best regards,
Dhruvit.
But what makes it can not use single CAN communication in test 3-1 3-2?
We found with the 'loopback on' need to make the CAN listening too to transfer the data.
So we thing it might be the 'can't leave self-loopback mode'.
Or the 'loopback on' test is wrong with my script?
Besides, I don't see the 'loopback on' command in 'FSL-UT-CAN-003.txt '.
Hi @yoooh8668,
Please provide me with the part number of the processor you are using.
Thanks & Regards,
Dhruvit.
Sorry for late reply.
it's PIMXL8DNVNL ZAB.
Hi @yoooh8668,
Thank you for your reply.
PIMXL8DNVNLZAB is a consumer-grade SOC.
It should be mentioned that only industrial grade i.MX8MP Processors support CAN-FD.
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Thanks & Regards,
Dhruvit.
I got this part number from the web side, maybe it's wrong.
U-Boot 2021.04-AUTOINC+g9368a0d86d (Aug 03 2022 - 08:29:30 +0000)
CPU: i.MX8MP[8] rev1.1 1600 MHz (running at 1200 MHz)
CPU: Industrial temperature grade (-40C to 105C) at 49C
Reset cause: POR
Model: TechNexion EDM-G-IMX8MP
DRAM: 8 GiB
MMC: FSL_SDHC: 1, FSL_SDHC: 2
But the U-Boot say it's Industrial grade.