Dear NXP Support Team,
We have ls1028a based custom board in which CAN TRANSCEIVER is connected directly to processor.we want to check CAN TRANSCEIVER which is connected in loopback i.e CAN0_H is connected to CAN1_H,CAN0_L is connected to CAN1_L,CAN0_GND is connected to CAN1_GND.
We have created small application(can_test) to check CAN in loopback but when we are running application it is throwing below error:
ip: either "dev" is duplicate, or "type" is garbage
ip: either "dev" is duplicate, or "type" is garbage ,after running below system() call in application :
system("ifconfig can0 down");
system("ip link set can0 up type can bitrate 112500");
system("ifconfig can1 down");
system("ip link set can1 up type can bitrate 112500");
system("ip link set can0 up type can bitrate 112500")
Below is our dts file configuration for CAN0 & CAN1:
&can0 {
status = "okay";
can-transceiver {
max-bitrate = <5000000>;
};
};
&can1 {
status = "okay";
can-transceiver {
max-bitrate = <5000000>;
};
};
I have attached required information with this post.
Below are my question on this :
How we can test CAN TRANSCEIVER in loopback in linux ?
What modification is required in linux and in .config files ?
Please help me on this.
Regards,
Amit Keshri
解決済! 解決策の投稿を見る。
Dear NXP Support Team,
Thank you for your reply.
After doing below things CAN loopback start working:
1.CONFIG_CAN_FLEXCAN=y in .config files
2.Install ip tool and copy in /usr/sbin directory in rootfs.
Regards,
Amit Keshri
On ls1028ardb,
Internal loopback mode of can0: pin2<->pin7
root@localhost:~# zcat /proc/config.gz | grep -i flexcan
CONFIG_CAN_FLEXCAN=y
root@localhost:~# ifconfig can0 down
root@localhost:~# ip link set can0 up type can bitrate 125000 loopback on
[ 47.597118] IPv6: ADDRCONF(NETDEV_CHANGE): can0: link becomes ready
root@localhost:~# cat /proc/interrupts |grep can0
20: 0 0 GICv3 53 Level can0
root@localhost:~# candump can0 &
[1] 1804
root@localhost:~# echo ' SENSORCAN="can0"
> (1234567890.223344) can0 123#1122
> (1234567890.223380) can0 123#2223
> (1234567890.223400) can0 123#3323
> (1234567890.223420) can0 123#4423
> (1234567890.223460) can0 123#5523
> '> can0data.txt
root@localhost:~#
root@localhost:~# echo $?
0
root@localhost:~# cat can0data.txt
SENSORCAN="can0"
(1234567890.223344) can0 123#1122
(1234567890.223380) can0 123#2223
(1234567890.223400) can0 123#3323
(1234567890.223420) can0 123#4423
(1234567890.223460) can0 123#5523
root@localhost:~# canplayer -I can0data.txt
can0 123 [2] 11 22
can0 123 [2] 11 22
can0 123 [2] 22 23
can0 123 [2] 22 23
can0 123 [2] 33 23
can0 123 [2] 33 23
can0 123 [2] 44 23
can0 123 [2] 44 23
can0 123 [2] 55 23
can0 123 [2] 55 23
root@localhost:~# cat /proc/interrupts |grep can0
20: 10 0 GICv3 53 Level can0
root@localhost:~# ip -details -statistics link show can0
2: can0: <NOARP,UP,LOWER_UP,ECHO> mtu 16 qdisc pfifo_fast state UP mode DEFAULT group default qlen 10
link/can promiscuity 0 minmtu 0 maxmtu 0
can <LOOPBACK> state ERROR-ACTIVE (berr-counter tx 0 rx 0) restart-ms 0
bitrate 125000 sample-point 0.875
tq 100 prop-seg 37 phase-seg1 32 phase-seg2 10 sjw 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 200000000
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
RX: bytes packets errors dropped overrun mcast
20 10 0 0 0 0
TX: bytes packets errors dropped carrier collsns
10 5 0 0 0 0
Would you please try flexcan loopback mode on ls1028ardb first?
Dear NXP Support Team,
Thank you for your reply.
After doing below things CAN loopback start working:
1.CONFIG_CAN_FLEXCAN=y in .config files
2.Install ip tool and copy in /usr/sbin directory in rootfs.
Regards,
Amit Keshri