Weird CAN bus communication in car

Hi!

I'm using Arduino UNO with MCP 2515. I want to display coolant temperature at the GID display in my Opel Astra H. And i already managed to send text to the display. But i've got problem with reading CAN bus messages. I found that sending packet to the 0x248 should return packets from 0x548 with few parameters (including coolant temperature), but data response is different using sniffer app and Arduino IDE (both codes use same libraries).

So, after sending request to 0x248 like this:

 248 # 06 AA 01 01 07 10 11 - Ask the A/C controller (0x0248) for measuringblocks 01, 07, 10 and 11

I should get something like this in response:

548 # 01 03 A5 00 00 01 9C 00 - 01: 0x03A5: Solar sensor: 4.665V - 0x019C: Indoor temp sensor: 2.06V 
548 # 07 00 90 04 3D FE 70 00 - 07: 0x90: Voltage: 14.4V 
548 # 10 00 91 02 B2 03 1E 96 - 10: 0x0091: Out-temp: 14.5°C - 0x02B2: Engine temp: 69.0°C 
548 # 11 08 ED 00 30 01 FE 23 - 11: 0x08ED: RPM: 2285 - 0x30: Speed: 48 km/h - 0x23: LED: 35%

Instead in Arduino IDE i get this:

[...]
Received packet with id 0x548 Data:13A5001490
Received packet with id 0x548 Data:707A09FE700
Received packet with id 0x548 Data:13A5001490
[...]

In sniffer app i get nice response from bank 11:

548 # 11 0 00 00 00 00 38 00 - engine is off thats why so many 00's

This is my Arduino code can sniff code - Pastebin.com. I use libraries from here GitHub - sandeepmistry/arduino-CAN: An Arduino library for sending and receiving data using CAN bus.. The fact that sniffer with the same libraries show me good message proves that libraries and Arduino is OK. The problem is with my code, but it is so simple that i don't know where to look for mistake.

Can you please help me ? BTW Can.filter() doesn't work (or probably i don't know how to use it :smiley: )so im using "if" loop.

From what I can see you should be receiving 8 bytes but that is not the case. Check the errors when receiving data and be sure you get the end of the message.

Could you explain that in more detail? How to check for errors ? And how to check do i receive whole message ?

The number of bytes is part of the CAN message. The can controller checks a lot to be sure it is correct, that information is internal to the CAN controllers registers. Also be sure you are not in loopback mode. Every message on the CAN bus must be acknowledged in a specified bit time in the message by another currently not sending node. Have you actually read the CAN specification by Bosch, it is available free: Here is a copy posted by NXP: https://www.nxp.com/docs/en/reference-manual/BCANPSV2.pdf
Do you have access to the information to decode these messages? Putting the wrong messages on the CAN bus may damage the vehicle and make it non operational. Have you consulted the OEM or service manuals to get the format of the packets. The standard can frame is as follows: it is composed of seven bit fields: Start of frame (SOF), arbitration, control, data, cyclical redundancy check (CRC), acknowledge (ACK) and end of frame (EOF). CAN message bits are referred to as “dominant” (0) or “recessive” (1). The SOF field consists of one dominant bit.

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.