CAN-BUS Shield Baud Rate Question

I noticed in the example code to send data onto the CAN-bus it does not contain a CAN.begin in the void Setup() area. Does it somehow initialize the baud rate in the IF statement within the void Setup()?

I need to use 250KBAUD.

hey, it’s a shame that i made a mistake~ actually you should have a CAN.begin(baudrate); :frowning:

about the baudrate, you can refer to Mcp_Can_Dfs.h

#define CAN_5KBPS 1 #define CAN_10KBPS 2 #define CAN_20KBPS 3 #define CAN_40KBPS 4 #define CAN_50KBPS 5 #define CAN_80KBPS 6 #define CAN_100KBPS 7 #define CAN_125KBPS 8 #define CAN_200KBPS 9 #define CAN_250KBPS 10 #define CAN_500KBPS 11

such as: CAN.begin(CAN_250KBPS );

then you can set you canbus baudrate to 250k

Thanks. Two more questions:

  1. How does this shield communicate with the Arduino? Does it use the hardware serial pins 1 and 2?

  2. I noticed it has an SPI library in the example, but it is not initialized anywhere, do I need to? What is it for?

Sorry, still a beginner with these parts.

Thank you,

Actually I may have figured it out, I think the shield uses the SPI interface to communicate with the UNO. However, I can see in the example code that you call the SPI.h library, but you never call SPI.begin() anywhere, does that happen in the background within the mcp_can.h library?

I’m super excited to learn more about all of this, and implement this into my project. All help is greatly appreciated.

Thank you,

I got the device working. I have it sending extended frame messages. Nice product!! Great support!!

Thank you,