Sending messages to Arduino

USB to CAN Interface
some1tbd
Posts: 5
Joined: Fri 5. Jul 2019, 05:20

Sending messages to Arduino

Post by some1tbd » Fri 5. Jul 2019, 05:23

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!

User avatar
U.Wilhelm
Sales & Support
Sales & Support
Posts: 1174
Joined: Fri 10. Sep 2010, 19:34

Re: Sending messages to Arduino

Post by U.Wilhelm » Fri 5. Jul 2019, 09:30

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 !
--------------------------------
PEAK-System Technik
Technical Support Team
support@peak-system.com
-------------------------------

some1tbd
Posts: 5
Joined: Fri 5. Jul 2019, 05:20

Re: Sending messages to Arduino

Post by some1tbd » Wed 10. Jul 2019, 17:29

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!

some1tbd
Posts: 5
Joined: Fri 5. Jul 2019, 05:20

Re: Sending messages to Arduino

Post by some1tbd » Wed 10. Jul 2019, 18:36

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.

User avatar
U.Wilhelm
Sales & Support
Sales & Support
Posts: 1174
Joined: Fri 10. Sep 2010, 19:34

Re: Sending messages to Arduino

Post by U.Wilhelm » Thu 11. Jul 2019, 12:15

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.
--------------------------------
PEAK-System Technik
Technical Support Team
support@peak-system.com
-------------------------------

some1tbd
Posts: 5
Joined: Fri 5. Jul 2019, 05:20

Re: Sending messages to Arduino

Post by some1tbd » Fri 12. Jul 2019, 23:22

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.

User avatar
U.Wilhelm
Sales & Support
Sales & Support
Posts: 1174
Joined: Fri 10. Sep 2010, 19:34

Re: Sending messages to Arduino

Post by U.Wilhelm » Sat 13. Jul 2019, 08:44

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.
--------------------------------
PEAK-System Technik
Technical Support Team
support@peak-system.com
-------------------------------

some1tbd
Posts: 5
Joined: Fri 5. Jul 2019, 05:20

Re: Sending messages to Arduino

Post by some1tbd » Tue 16. Jul 2019, 03:42

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

User avatar
U.Wilhelm
Sales & Support
Sales & Support
Posts: 1174
Joined: Fri 10. Sep 2010, 19:34

Re: Sending messages to Arduino

Post by U.Wilhelm » Tue 16. Jul 2019, 14:51

Have you check your Transceiver Voltages
https://www.peak-system.com/forum/viewt ... er+Voltage
--------------------------------
PEAK-System Technik
Technical Support Team
support@peak-system.com
-------------------------------

tranquangle1004
Posts: 1
Joined: Thu 3. Dec 2020, 05:01

Re: Sending messages to Arduino

Post by tranquangle1004 » Thu 3. Dec 2020, 05:04

Hi you must use right library support peak can in arduino.
this link is https://github.com/coryjfowler/MCP_CAN_lib.

:) :)

Locked