autowp / arduino-mcp2515

Arduino MCP2515 CAN interface library
MIT License
793 stars 279 forks source link

Issue Arduino MEGA 2560 and MCP2515 #18

Closed lenardteri closed 5 years ago

lenardteri commented 5 years ago

I am trying to connect a Arduino MEGA 2560 to a MCP2515 can controller with a TJA1050 transceiver and SPI interface. The board with the can controller and transceiver has a 8.000 mhz crystal. The problem is when calling mcp2515.setBitrate(CAN_125KBPS, MCP_8MHZ); the return value is 1. Tested this on a Arduino UNO where it works. Tried calling setBitrate() with different parameters too but it seems that it fail every time.

EDIT: I have managed to make it work by chaging the wiring in the following way: Name----Mega2560---MCP2515 INT-------2----------INT MISO------50---------SO MOSI------51---------SI SCK-------52---------SCK SS--------53---------CS VCC-------5V---------VCC GND-------GND--------GND

Now i can call successfully mcp2515.setBitrate(CAN_125KBPS, MCP_8MHZ);

This issue can be closed. :D