I recenty bought a Seeed Can-Bus-Shield.
I connected it to my Arduino Uno and to my vehicles CAN-Bus. The CAN-Bus in my car runs at 33.33kbps. It is single wire, so I connected the CAN-Signal to CAN-H on the Shield and the Signal-Ground to CAN-L.
Initialization is correct. I also receive (a lot!) messages from my car.
But when I try to send a message back, something isn’t working…
For example, I receive a message from ID 373 (not hex, decimal) and data “0, 0, 0, 6, 153”. I want that to be sent back to my car.
So on my Arduino I’m calling:
After sending, “sendResult” is either 6 (CAN_GETTXBFTIMEOUT) or 7 (CAN_SENDMSGTIMEOUT).
What am I doing wrong?
I also tried to use “data[5]” but that doesn’t change anything.
Besides the error, the “Int” (initialize) LED on the shield is constantly on (before it’s just blinking a bit) and receiving messages doesn’t work well anymore. I get some, but less than before sending. I can only reset the board to receive all messages again.
I really hope you guys can help me! This is driving me crazy!
Hi, I think maybe there’re too many data received to make the board crash, you can try setting some mask and filter, to reduce the data receive, thanks.
It works like a charm, now! But… Init_Filt() or Init_Mask() doesn’t work (or I’m using it the wrong way). Could you please provide a sample for each method with a short description? The current description isn’t very detailed.
The solution is obviously that I don’t use the wires on the CAN-Terminal anymore. A few days ago I built a DB9 -> OBD adapter and used that one. Now the signals are transferred correctly.
But why is there a difference?
Hi, about the mask and filter, there’s a example in the library, mask is to choose which bit to be compare, such as, if mask set to 0x3ff, that means all the bit will be compared. if mask set to 0x3f0, that means the low 4 bit can be anything. After the mask was set, filter should be set as well.
eg: if you want to just receive data come from id: 0x2f5, you should set mask to 0x3ff, and filter to 0x2f5.
eg: if you want to receive data from id: 0x2f0~0x2ff, you should set mask to 0x3f0, and filter to 0x2f0(0r 0x2f1, 0x2f2… )
Sorry English is no my mother tongue, hope I had made myself clear.