Go Down

Topic: "Half" bus speed with Arduino UNO and MCP2515 (Read 1 time) previous topic - next topic


I work on a project with Can bus. I use an Arduino UNO and MCP2515. The bus is running, but the bus speed does not fit. If I select 500kbits/s the data comes only with 250kBits/s. Both when sending and/or receiving.

This effect I have with different libraries for MCP2515 as "CAN_Library-master" or "MCP_CAN_lib-master" and it is always the factor 2.

Did someone give me a tip?
Many Thanks


Do you use a breakout board for the MCP2515? If yes, please provide a link to it. If not, please post the schemata of how you wired everything. The MCP2515 need and external clock source. This may either be crystal or a clock signal generated by some other source (p.e. the Arduino).


Enclosed is an overview of my breadboard with the MCP2515 module.
This setup I have 2 times - also 2 times with the identical effect.

In this example, only one setup communicates with a Peak dongle. The Peak dongle sends every second a message, received by the MCP2515 and send back.

In this case I work with the MCP_CAN_lib

#include <mcp_can.h>
#include <SPI.h>

MCP_CAN CAN0(10);     // Set CS to pin 10

unsigned int MsgCounter = 0;
unsigned long currentMillis;

void setup() {

    // Initialize MCP2515 running at 16MHz with a baudrate of 500kb/s and the masks and filters disabled.
    if(CAN0.begin(MCP_ANY, CAN_500KBPS, MCP_16MHZ) == CAN_OK) Serial.println("MCP2515 Initialized Successfully!");
    else Serial.println("Error Initializing MCP2515...");
    CAN0.setMode(MCP_NORMAL);   // Change to normal mode to allow messages to be transmitted

void loop() {
    long unsigned int rxId;
    unsigned char len = 0;
    unsigned char rxBuf[8];

    while (CAN_MSGAVAIL == CAN0.checkReceive())
        CAN0.readMsgBuf(&rxId, &len, rxBuf);            // Read data
        CAN0.sendMsgBuf(rxId+1, 0, len, rxBuf);         // and send echo back

        currentMillis = millis();
        Serial.print("  ");

Also a screenshot of the Pcan-View with the bus speed. It is only 250kbit/s and not 500 as defined in the programm. The same result I also get with my CANalyzer tool.

If a message is received, I output a time stamp on the serial interface. The difference time is 1000msek as from the peak dongle.

Do you have any idea?



Whats the crystal speed on your CAN modules MCP2515? Also, how are you measuring speed? Timming between bits on the scope?


Code: [Select]
if(CAN0.begin(MCP_ANY, CAN_500KBPS, MCP_16MHZ) == CAN_OK) Serial.println("MCP2515 Initialized Successfully!");

Why are you telling the MCP it runs on 16MHz when the crystal is a 8MHz (at least that's on the picture you sent, you STILL didn't provide a link to that breakout board!)


Feb 15, 2017, 10:49 am Last Edit: Feb 17, 2017, 01:06 pm by mikb55
All the NiRen boards I've received are fitted with an 8 MHz crystal.


Ups. Your are right
Thank you guys  :smiley-lol:

I was just in tunnel mode and did not think of the module
Now I understand why. That was important to me

Thank you and til nextime

Go Up