Page 1 of 2

Sending messages to Arduino

Posted: Fri 5. Jul 2019, 05:23
by some1tbd
Hello All,

I have an Arduino Uno and CAN shield (equipped with a MCP2515 chip) that I am using to listen to messages sent over a CAN network via PEAK PCAN interface. Messages are sent at 50 kbytes/s and ids range form 0x0-0x7ff. Messages are confirmed received by printing them over Arduino's serial interface.

I confirmed that CAN messages transmitted via Arduino /CAN shield are received via Arduino, but am unable to receive messages when transmitting only through PCAN. Therefore the issue appears to originate either from the PCAN-View software or the PCAN USB-to-CAN controller itself.

Where may lie the issue or how should I troubleshoot? Side note I did not bridge the 120 ohm resistor, however I didn't do this for the CAN shield and it still works fine. Thanks!

Re: Sending messages to Arduino

Posted: Fri 5. Jul 2019, 09:30
by U.Wilhelm
If we understand your request correct, you could communicate between 2 Arduino, but not with one Arduino and PCAN-USB connected at a Windows PC.

Why not add the PCAN-USB for test as a third CAN node in the Arduino CAN Network and run PCAN-View with the exact Timing (50K ist not 50K - check sample point!) and also - A CAN BUS need to be terminated at each end of the CAN Bus with 120 Ohm this is a must !

Re: Sending messages to Arduino

Posted: Wed 10. Jul 2019, 17:29
by some1tbd
Sorry for the late reply. I have now terminated both H and L lines (although my labmate had told me he was able to transmit messages reliably without it).

Regarding the suggestion to connect all 3 nodes in parallel along the H and L lines, I am unsure of what outcome was expected? Why suggest this over the previous configuration?

Also thanks for the noticing the difference in 50 kBits in PCAN-View and Arduino code!

Re: Sending messages to Arduino

Posted: Wed 10. Jul 2019, 18:36
by some1tbd
One other note I am confused on is the BUS-HEAVY status. Can I still send messages with this status? What effects should I observe with this status?

According to this forum topic (https://www.peak-system.com/forum/viewt ... f=120&t=39), BUS-HEAVY indicates >127 error points. The explanation seems to imply that sending more messages results in a higher probability for BUS-HEAVY error, however I receive this status after sending only 1 message in "manual" mode.

Re: Sending messages to Arduino

Posted: Thu 11. Jul 2019, 12:15
by U.Wilhelm
1. Termination is in CAN a must - if you think you do not need it OK - it is up to you .
2. a third unit could solve the problem if one of your own build application does not set the CAN Core into ACK mode..but it was only a proposual - if you think you do it right - it is up to you.
3. BUSHeavy is a reaching a Error Level of the CAN Core - see point 1 and 2 - both could be the Problem.
If a CAN node send ONE message and have no ACK (see point 2) it will resend the frame - so sending one Message to CAN Core could end up in sending hundreds on CAN Bus - please study CAN Doku try to understand the protocol.

Re: Sending messages to Arduino

Posted: Fri 12. Jul 2019, 23:22
by some1tbd
Thanks for the help.

So I believe I have a good receiver (the Arduino is able to sniff messages from a CAN bus line successfully) however I am still unable to successfully transmit messages from PCAN. The device continues to read BUS-HEAVY. I am confident that my connections are good. Unless there is something wrong with the message I send (and I am reading ALL messages with my Arduino receiver) then I am not sure where I am going wrong.

Re: Sending messages to Arduino

Posted: Sat 13. Jul 2019, 08:44
by U.Wilhelm
As we wrote...check physical connection and Bitrate. Also check CAN Transceiver Voltage to be sure all CAN Transceivers are OK. A Guide how to do could be found in the Forum.

Re: Sending messages to Arduino

Posted: Tue 16. Jul 2019, 03:42
by some1tbd
I must say, I have tried and confirmed at least twice everything you have mentioned but still to no avail. I know that previous colleagues of mine have got it working; perhaps I am making a silly mistake or have a setting that has failed? I have also read the user manual and confirmed everything in working order.

~Seth

Re: Sending messages to Arduino

Posted: Tue 16. Jul 2019, 14:51
by U.Wilhelm
Have you check your Transceiver Voltages
https://www.peak-system.com/forum/viewt ... er+Voltage

Re: Sending messages to Arduino

Posted: Thu 3. Dec 2020, 05:04
by tranquangle1004
Hi you must use right library support peak can in arduino.
this link is https://github.com/coryjfowler/MCP_CAN_lib.

:) :)