Hi All,
We are working on RZG2N based Custom board and trying to check CAN0 and CAN1 and we are using 4.19 kernel, When we try to test CAN interface we are getting the below error,
We tried on RZG2N Hi-hope board and the result is same, Please guide us what are we missing here,
This is what we are getting when we try to test CAN with CAN Analyzer
======================================================================
root@hihope-rzg2n:~# candump can0
root@hihope-rzg2n:~# cansend can0 123#deadbeefroot@hihope-rzg2n:~# cansend can0 123#deadbeef
===================================================================
root@hihope-rzg2n:~# dmesg | fgrep -i can[ 1.280927] CAN device driver interface[ 1.285371] rcar_can e6c38000.can: device registered (IRQ147)[ 1.291703] rcar_canfd e66c0000.can: can_clk rate is 19999999[ 1.297671] rcar_canfd e66c0000.can: device registered (channel 0)[ 1.303870] rcar_canfd e66c0000.can: global operational state (clk 0, fdmode 1)[ 1.967839] can: controller area network core (rev 20170425 abi 9)[ 1.978685] can: raw protocol (rev 20170425)[ 1.982997] can: broadcast manager protocol (rev 20170425 t)[ 1.988697] can: netlink gateway (rev 20170425) max_hops=1[ 2.113834] [drm] Cannot find any crtc or sizes[ 2.118831] [drm] Cannot find any crtc or sizes[ 4.624875] rcar_sound ec500000.sound: Can't update kctrl when idle[ 4.681798] rcar_sound ec500000.sound: Can't update kctrl when idle[ 94.325231] rcar_can e6c38000.can can0: bit-timing not yet defined[ 94.331453] rcar_can e6c38000.can can0: open_candev() failed, error -22[ 131.182127] rcar_can e6c38000.can can0: bitrate error 0.0%[ 254.094047] rcar_can e6c38000.can can0: bitrate error 0.0%root@hihope-rzg2n:~# ip -details link show can0
=======================================================================root@hihope-rzg2n:~# ip -details link show can02: can0: <NOARP,ECHO> mtu 16 qdisc pfifo_fast state DOWN mode DEFAULT group default qlen 10 link/can promiscuity 0 can state STOPPED (berr-counter tx 0 rx 0) restart-ms 0 bitrate 125078 sample-point 0.846 tq 615 prop-seg 5 phase-seg1 5 phase-seg2 2 sjw 1 rcar_can: tseg1 4..16 tseg2 2..8 sjw 1..4 brp 1..1024 brp-inc 1 clock 66666664numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535
root@hihope-rzg2n:~# ip link set can0 up
root@hihope-rzg2n:~# ip -details 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 can state ERROR-ACTIVE (berr-counter tx 0 rx 0) restart-ms 0 bitrate 125078 sample-point 0.846 tq 615 prop-seg 5 phase-seg1 5 phase-seg2 2 sjw 1 rcar_can: tseg1 4..16 tseg2 2..8 sjw 1..4 brp 1..1024 brp-inc 1 clock 66666664numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535root@hihope-rzg2n:~#
And the ifconfig -a We are seeing interface like below,
root@hihope-rzg2n:~# ifconfig -acan0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 NOARP MTU:16 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:10 RX bytes:0 (0.0 B) TX bytes:0 (0.0 B) Interrupt:147
can1 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 NOARP MTU:72 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:10 RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
eth0 Link encap:Ethernet HWaddr 6E:F3:EF:5B:AD:EA inet addr:172.16.30.250 Bcast:172.16.255.255 Mask:255.255.0.0 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:95310 errors:0 dropped:25611 overruns:0 frame:0 TX packets:1144 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:14620157 (13.9 MiB) TX bytes:292069 (285.2 KiB) Interrupt:144
lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 UP LOOPBACK RUNNING MTU:65536 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
root@hihope-rzg2n:~#
Thanks and regards,
Nagaraja
Hello Nagaraja,
> [ 94.325231] rcar_can e6c38000.can can0: bit-timing not yet defined
This error means bitrate setting is not available yet.In your log, I see some ip commands, but there is no command to set CAN bitrate.There is chance you forgot that.
BTW, note that at default setting, RZ/G2N use different modes for 2 CAN channels (CAN for can0, and CANFD for can1).CANFD can transfer CAN. We already tested and confirmed that transfer between two channels work normally on our side.
Regards,HungT.