0

I am trying to communicate with a vehicle control unit (VCU) over can. I have figured out the commands (index, data and frequency) and can verify the functionality through PCanView on Windows. Now I am using Nvidia Xavier system with python-can library to send the same commands, and I can verify the commands with candump. However when I power the vehicle engine on while sending these commands, the canbus freezes (this is when the VCU starts expecting the can commands I am sending, it goes into fault state if it doesn't receive the data it expects)

I have successfully used python-can in the past to talk to other can devices and I am confident about the correctness of the code itself. Hardware connection is fine too, because I can receive non-VCU messages from the vehicle. I can also receive VCU messages after I restart the canbus.

What could be causing the bus to freeze? And is there a way to prevent it? (By setting some config in the socket-can layer itself?)

Please note that restarting the bus will not fix the problem as the vehicle cannot recover once it goes into fault without a restart.

Any help will be appreciated!

  • In CAN bus terms, what does "freeze" mean? Are there error frames? Of which kind? – Lundin Feb 08 '22 at 07:50
  • It basically means that `candump can0` suddenly stops showing any data. Restarting the bus (can0 up/down) brings it all back. On error frames - How can I find out what is an error frame? And can I 'ignore' them at socket-can level? – Gaurav Gupta Feb 08 '22 at 08:08
  • You need an actual CAN bus listener or you can't work with CAN bus development. Alternatively you could use an oscilloscope and manually decode the frames, but that's far more tedious. – Lundin Feb 08 '22 at 08:12
  • Does that mean some sort of specialized hardware? I am using an industrial carrier board with Xavier and it has can transceivers with it. – Gaurav Gupta Feb 08 '22 at 08:21

2 Answers2

0

Ok, it turns out it was a hardware problem. The length of CAN cables was a bit too much. The bus receives a lot of data transmission when the vehicle is turned on and the CAN cable was flooded with data. I still don't know the mechanics of the fault but decreasing the cable length made it all work.

0

The cable length could be the reason, but take care about the bus topology and especially where the CAN terminations are located.

niavlys
  • 38
  • 1
  • 6