Hi everyone, I'm here today, because I trying to use the MCP2515 board with my arduino uno for read can bus message from my car. When I turn ACC my car, I should get a large number of message but, I receive just two message
Message ID: 7E9
Data: 1 51 3A 48 B7 89 13 4B
Message ID: 7E8
Data: 1 51 BE EF CA FE BE EF
this is my code:
#include <SPI.h>
#include <mcp_can.h>
const int SPI_CS_PIN = 10;
MCP_CAN CAN(SPI_CS_PIN);
void setup() {
Serial.begin(115200);
if (CAN.begin(MCP_ANY, CAN_500KBPS, MCP_8MHZ) == CAN_OK) {
Serial.println("CAN init success");
} else {
Serial.println("CAN init failed");
while (1);
}
CAN.setMode(MCP_NORMAL);
Serial.println("CAN mode set to NORMAL");
}
void loop() {
long unsigned int rxId;
unsigned char len = 0;
unsigned char buf[8];
if (CAN_MSGAVAIL == CAN.checkReceive()) {
CAN.readMsgBuf(&rxId, &len, buf); // Lire le message
Serial.print("Message ID: ");
Serial.println(rxId, HEX);
Serial.print("Data: ");
for (int i = 0; i < len; i++) {
Serial.print(buf[i], HEX);
Serial.print(" ");
}
Serial.println();
CAN.setMode(MCP_NORMAL);
}
delay(10);
}
This is my wiring:
VCC : 5V
GND : GND
CS : Pin 10
SCK : Pin 13
MOSI : Pin 11
MISO : Pin 12
INT : Pin 2
And CAN-H et CAN-L wired to pin 6 and 14 of my OBD connector
I tried with serveral baudrate but it only work with 500KBPS.
I am a beginner with arduino, I suppose that my wiring is correct since I receive the first two messages but now I do not know what to do to solve this problem. Thanks in advance.
In addition, I receive this message when I turn key to ACC.
It seems to be working, but that’s only the physical (PHY) interface. It’s like walking into a ballpark and saying, 'I lost my ball in here somewhere.' A good starting point would be to provide the make, model, and any other relevant details. Keep in mind that OBDII has evolved over the years, and different versions can affect compatibility. Depending on the make and model, not all information may be accessible—it could be labeled as OEM, Dealer, or Other. Your equipment will need to be put into the correct mode to retrieve specific data, and each vehicle can be different.
Also, be sure to check which OBDII standard version applies to your setup, as that can impact how you interact with the system.
why are you sure that you 'should get a large number of messages'?
Typically in ACC only few ECUs are powered.
Also if the OBD port is 'protected' by a gateway, you will not see any vehicle traffic from there except for diagnostic commands (which is what you read out btw )
and just in case is make any difference, comment out
CAN.setMode(MCP_NORMAL);
in 'loop()' as you have already set that up in 'setup()'. it is not required to call this function over and over!
Thank you for your answers. Because I want to get all the CAN messages of the accessories, such as the opening of the front door window, the position of the seat, etc. When I look at how to get it, the guys get several messages and continuously. And when they do an action on the car and well a command is added in the serial monitor with the others. I even tried with the engine to turn on and I just have these two messages. You said that it is possible that my car has an OBD gateway, is it possible to remove it?
I use this here
My car is a 2006 jeep, his, a 2012 more it uses the CAN BUS H and L of the car radio connector except that when I do this I literally do not receive any message, on the other hand my car has a rather strange reaction. I have like a slight short circuit when my arduino is plugged into the car radio connector like the guy. And as soon as I remove the arduino it doesn't do it anymore. And only if I change the baudrate to something other than 500KBPS.
If I remember correctly, your vehicle may have a Security Gateway Module, which protects the vehicle's network from external attacks through the OBD port, emergency assistance, and radio. There may also be another port for factory or dealer access, but tampering with it could potentially damage the engine or other systems.
Additionally, your vehicle might still use the CCD (Chrysler Collision Detection) bus. Although it was officially phased out around 2000, some remnants of it remained in use for a while.
There may be another connector for the dealer or OEM located before the Security Gateway Module. Connecting to that module and sending incorrect data could potentially damage your vehicle's CAN system and possibly the engine.