I'm new to CAN and currently having problem with a setup.
The image shows how my devices are connected to each other. I'm using the canutils Linux package to send messages (Linux uses its network layer to register and operate the CAN interfaces). So I start up the devices, bring up a terminal and type the following configuration commands on them:
ip link set can0 type can bitrate 125000 //This one registers an interface for can0 and sets the bit rate to 125000 bit/s.
ifconfig can0 up //Switches on the interface
At start, both devices' IDs are full null. Now, on one of the devices I switch on the listening state, which is:
candump can0
On the other one, I send out a message, something like this:
cansend 123#0x01 0x02 0x30 //123 specifies the ID, after "#" comes the data
Now, when this happens, the sender interface goes from error-active (normal state) to error-passive (error state). The "receiver" doesn't receive anything at all; it stays at error-active state. No messages are processed or catched, the log is clear (ip -d -s link show can0
) and on the oscilloscope I can see the diff signal, and the sender is sending the message periodically, non-stop.
Maybe it's waiting for a response? I don't know if it's the whole message or just a fraction of it, but it sure changes with the given data, so I guess it's the whole message. And after that, if I try to send out another message with different data, the program just loads it into a buffer (I know this because after, like, 10 new cansends, it writes out that the buffer is full) and continues to broadcast the same old message. So I have to type canconfig stop
-> canconfig start
to restart the interface into error-active mode.
I'm sure that I'm messing up something fundamental, but I can't figure it out.
How can I fix this problem? Could it be a software or hardware issue, or maybe both?