I am having some problems with can bus. I am using SN65HVD230D transceiver.
I can connect to can0 and receive messages. can0 is in ERROR-ACTIVE state until I send the first message.
As soon as I do that can0 goes to BUS-OFF state.
I am using tdx-reference-multimedia-image 5.1.0-devel-202012
I was able to send and receive messages with an earlier installation and same configuration to device tree so I don’t think the transceiver is the problem.
I am sorry not to give you /etc/os-release and /etc/issue and other board details but I don’t currently have the device.
Could you give me some pointers how to troubleshoot or if you know of a similar issue and how to solve it.
Yes we have a terminated network. 120 ohms on both sides.
I will send the dmesg output tomorrow.
Will also check with oscilloscope tomorrow.
For me the mystery is that it worked normal with 5.0.0 and now it doesn’t with 5.1.0
I hope that it is just an issue with some clock speed and that the Baud rate is off and that is what is causing the problems.
Hi Stefan
I just tried to send a message on an empty bus and the same thing happened.
Error-Active before cansend and BUS-OFF after.
I wanted to check the Baud rate with oscilloscope but can’t do that if i cant send a message.
I have no idea what is happening every thing looks Ok, so if you have any ideas what to try please tell me.
Thank you.
do you mean you see absolutely no activity on CAN pins? I see you have bus-off recovery disabled can state BUS-OFF (berr-counter tx 0 rx 0) restart-ms 0 . Specifying non zero restart-ms as an argument to ip link set, then repeating cansend should allow you to measure bit time with scope (shortest pulse length).
I seem to have the same problem on an imx7 colibri using flexcan1 (pins 55 and 63). The state goes to BUS-OFF as soon as I try to send the first message.
# ip -details link show can0
4: can0: mtu 16 qdisc pfifo_fast state UP mode DEFAULT group default qlen 10
link/can promiscuity 0 minmtu 0 maxmtu 0
can state ERROR-ACTIVE (berr-counter tx 0 rx 0) restart-ms 0
bitrate 250000 sample-point 0.875
tq 250 prop-seg 6 phase-seg1 7 phase-seg2 2 sjw 1
flexcan: tseg1 4..16 tseg2 2..8 sjw 1..4 brp 1..256 brp-inc 1
clock 24000000numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535
# cansend can0 123#deadbeef
# ip -details link show can0
4: can0: mtu 16 qdisc pfifo_fast state DOWN mode DEFAULT group default qlen 10
link/can promiscuity 0 minmtu 0 maxmtu 0
can state BUS-OFF (berr-counter tx 0 rx 0) restart-ms 0
bitrate 250000 sample-point 0.875
tq 250 prop-seg 6 phase-seg1 7 phase-seg2 2 sjw 1
flexcan: tseg1 4..16 tseg2 2..8 sjw 1..4 brp 1..256 brp-inc 1
clock 24000000numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535
# dmesg | fgrep -i can
[ 12.015535] CAN device driver interface
[ 12.045204] flexcan 30a00000.can: 30a00000.can supply xceiver not found, using dummy regulator
[ 80.563886] IPv6: ADDRCONF(NETDEV_CHANGE): can0: link becomes ready
[ 116.604819] can: controller area network core (rev 20170425 abi 9)
[ 116.616042] can: raw protocol (rev 20170425)
[ 116.618702] flexcan 30a00000.can can0: bus-off
#
I’m running this from a docker image with these numbers:
I ask that because one of the situations in which the CAN bus will be turned off is when the CAN bus is unstable, then the driver will be turned off to avoid any problems.
So I think we have found out what went wrong. And it had nothing to do with the OS.
It was probably a combination of EMI and SN65HVD230D not having a resistor on RS pin for slope control.
When the device was working it was in our office(almost no EMI) when the problems occurred the device was in its final location where there was a lot of EMI(electromotors, high voltage batteries…)