The CAN-Board is a versatile circuit board designed to interface with the Controller Area Network (CAN) bus. This robust communication protocol is widely used in automotive and industrial applications to enable reliable data exchange between microcontrollers and devices without the need for a host computer. The CAN-Board facilitates seamless integration into various systems, making it an essential component for modern electronic designs.
Parameter | Value |
---|---|
Operating Voltage | 5V |
Communication | CAN 2.0B, up to 1 Mbps |
Interface | SPI |
Power Consumption | Typically 70 mA |
Temperature Range | -40°C to +85°C |
Pin Number | Pin Name | Description |
---|---|---|
1 | VCC | Power supply (5V) |
2 | GND | Ground |
3 | CS | Chip Select (SPI) |
4 | SCK | Serial Clock (SPI) |
5 | SI | Serial Data In (SPI) |
6 | SO | Serial Data Out (SPI) |
7 | INT | Interrupt Output |
8 | CANH | CAN High (connects to CAN bus) |
9 | CANL | CAN Low (connects to CAN bus) |
#include <SPI.h>
#include <mcp_can.h>
// Define the CS pin for the CAN-Board
const int CS_PIN = 10;
// Create an instance of the MCP_CAN class
MCP_CAN CAN(CS_PIN);
void setup() {
Serial.begin(115200);
// Initialize the CAN bus at 500 kbps
if (CAN.begin(CAN_500KBPS) == CAN_OK) {
Serial.println("CAN bus initialized successfully");
} else {
Serial.println("CAN bus initialization failed");
while (1);
}
}
void loop() {
// Example: Send a CAN message
byte data[8] = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07};
if (CAN.sendMsgBuf(0x100, 0, 8, data) == CAN_OK) {
Serial.println("Message sent successfully");
} else {
Serial.println("Message sending failed");
}
delay(1000); // Wait for 1 second before sending the next message
}
CAN Bus Initialization Failure:
Message Sending Failure:
No Communication on CAN Bus:
By following this documentation, users can effectively integrate and utilize the CAN-Board in their projects, ensuring reliable and robust communication in various applications.