MCP2515 AND ARDUINO FOR HACK A CAR

Thread Starter

Mohamedimad

Joined Dec 22, 2020
16
Hello everyone;
I want to start a small project for the purpose of ensuring communication between an arduino card and the ECU of my car through the CAN bus.
- My care model is : RENAULT SYMBOL
- Micro-controller : ATMEGA328P-PU (ARDUINO UNO).
- MCP2515 Card (CAN BUS DRIVER)
I found several programs and libraries that do not work correctly.

I want a library or code that work with MCP2515 and arduino that will allow me to read some data from my car.
I will be very grateful for any information on this subject.
 

Papabravo

Joined Feb 24, 2006
19,570
Hello everyone;
I want to start a small project for the purpose of ensuring communication between an arduino card and the ECU of my car through the CAN bus.
- My care model is : RENAULT SYMBOL
- Micro-controller : ATMEGA328P-PU (ARDUINO UNO).
- MCP2515 Card (CAN BUS DRIVER)
I found several programs and libraries that do not work correctly.

I want a library or code that work with MCP2515 and arduino that will allow me to read some data from my car.
I will be very grateful for any information on this subject.
The secret to operating in any CAN based system is to understand the assignment and use of identifiers. Without that knowledge you are just wasting your time.
 

Irving

Joined Jan 30, 2016
3,188
As Papabravo says, you need to beg/borrow/steal the relevant sections of SAE J1939 to get the common identifiers, though there are many blogs on the web on the subject too. You also need to understand the complex error management services.

But forget the UNO, its not really fast enough for the main engine CANBus - yes you can capture messages, but you don't really have the processing power to do much else. I use an ESP32 with both the internal CAN controller and an external MCP2515 controller on the HSPI. The STM chipsets with internal CAN controllers work well too.
 

Papabravo

Joined Feb 24, 2006
19,570
As Papabravo says, you need to beg/borrow/steal the relevant sections of SAE J1939 to get the common identifiers, though there are many blogs on the web on the subject too. You also need to understand the complex error management services.

But forget the UNO, its not really fast enough for the main engine CANBus - yes you can capture messages, but you don't really have the processing power to do much else. I use an ESP32 with both the internal CAN controller and an external MCP2515 controller on the HSPI. The STM chipsets with internal CAN controllers work well too.
IIRC, SAE J1939 uses the 29-bit extended identifier. It will be a much bigger challenge to catalog and make use of the larger identifier space. You could potentially spend an entire career on such a project.
 

Irving

Joined Jan 30, 2016
3,188
It's been a while since I looked at it but J1939 uses both 11 and 29bit IDs.

If all the TS wants to do is monitor a few key parameters eg engine revs, wheel revs then all you need to know is the ID for the parameter and the data format and capture those IDs.

Anything more sophisticared and you need to know the request/response protocol.

Trying to work that out from scratch would be a mountain to climb...
 
I tried to look, but couldn't find anything definite. but I was under the impression cars usually use some form of ISO11898 instead of J1939.

Finding a library that will decode messages is probably going to be useless. While the various specifications define messages and such, in the end it is up to the manufacturer to decide how to use the specification or ignore it altogether other than what is required by law and getting basic name, manufacturer, and version data. On top of that there are messages reserved for proprietary use and other than finding someone on the inside with the right knowledge it's going to be a long battle to figure out what those messages do. All the manufacturers have to do is make information available to those building diagnostic tools and such so they can make the tools work with the system. That probably takes a fair chunk of change along with non disclosure agreements, liability agreements, and who knows what else.
 

Irving

Joined Jan 30, 2016
3,188
I tried to look, but couldn't find anything definite. but I was under the impression cars usually use some form of ISO11898 instead of J1939.
ISO11898:1-4 details the physical and datalink layers formerly defined in CAN2.0B which was also adopted by J1838, but extends that to 2 and 5Mbps signalling and tightens many parameters.

AFAIK it doesnt extend to the messaging protocol itself, though it does introduce a time-driven messaging mechanism.
 
ISO11898:1-4 details the physical and datalink layers formerly defined in CAN2.0B which was also adopted by J1838, but extends that to 2 and 5Mbps signalling and tightens many parameters.

AFAIK it doesnt extend to the messaging protocol itself, though it does introduce a time-driven messaging mechanism.
Interesting. I won't lie I don't know a lot of details about smaller vehicle systems. I just know that in passenger vehicles 'P', 'C', and a few other letters are used to prefix the trouble codes that usually just tell you a part isn't sending the right information. Larger diesels and industrial type equipment give SA, SPN, and FMI information for every trouble code which is A LOT more helpful. Cars I don't know, but the others is usually J1939 or if old enough J1587/J1708 (MID,SID,FMI).

I spent more than a few dollars to get the access to what I had at one time. I just don't want to see someone else do the same for something that won't help them. Being a Renault vehicle it is entirely possible it is something different that what we would call normal.
 
Top