1

i have a Arduino Mega 2560 R3 and a Sparkfun CAN Bus Shied. Im using the SparkFun_CAN-Bus_Arduino_Library-master. I want to communicate over SPI (they have diffrent SPI pins), so i had to change it in defaults.h Changes:

#define P_MOSI B,2 // new pin: 51, orginal: #define P_MOSI B,3

#define P_MISO B,3 // new pin :50, orginal: #define P_MISO B,4

#define P_SCK B,1 // new pin :52, orginal: #define P_SCK B,5

#define MCP2515_CS B,0 // new pin:53, orginal: #define MCP2515_CS B,2

i connected the pins:

Arduino Mega Pin - Sparkfun pin

51 - 11

50 - 12

52 - 13

53 - 10

also connected: 5v, gnd, rst, (pin 2)
Before i realized that spi pins are diffrent, the can init from demos dont worked. After changes, init worked but e.g. CAN_Write_Demo i can not see the data in PCAN-View. There is nothing.

I read that PCAN-View is not compatible with my lib so i try the MCP_CAN_lib-master, same problem. I also tried it with Vector CAN, with both libraries same problem.

Why can't I see the messages?

I also tried other demos e.g. CAN_Read_Demo and sent a can message with PCAN-View but get nothing.

When i run write demos, it dousnt even send anything and when i run read demos e.g. sending from PCAN-View, status from PCAN-View changes instant to BUSHEAVY.

Thank you for helping.

1 Answer 1

0

CAN will not send messages into the ether. It must have another node to acknowledge the message. That node needs to be configured for the same bit rate. I use the MCP-CAN_lib-master by Cory Fowler and it works great. You can try the following and if it does not work I would suggest you start with two UNOs and two MPC2515 and get them to work first, the send and receive code is in the examples included with the library. Be careful there are at least three different crystals on the MPC2515 boards, select the correct one. Also be sure the bus is terminated on both ends, that should simply adding a jumper to the CAN module. Hopefully the bus is several feet long, I have heard of problems with short buses although I have never experienced it. Another hint be sure the grounds for all modules are connected. I know that is not necessary but makes getting it started much easier. Also start with something in the 125/250 Kbit rate.

2
  • As i know PCAN-View should acknowledge the messages? And i also tried it with a working system where the can bus shield should just listen, but getting nothing (With the working system i see the messages with PCAN-View).
    – Pablo
    Mar 7, 2022 at 7:34
  • To many unknowns. Post a schematic as you have them wired and your code per forum instructions. Frizz pictures do not count and links to technical information on the hardware you are using are also needed. There are many parts with the same name but different.
    – Gil
    Aug 3, 2022 at 23:04

Not the answer you're looking for? Browse other questions tagged or ask your own question.