0

I'm developing an OBD-II reader where I want to query requests to read PID parameters with a stm32 processor. I already understand what should go on the data field, but the ID is giving me a headache. As I have read, one must send 0x7DF to broadcast a request, and each ECU will respond with his own ID. However, I have been asked to do this within the SAE J1939 protocol, which uses the 29 bit extended identifier, and I don't know what I need to add to this ID.

As I stated in the title, could someone show me some actual data from a bus using this method? I've been searching on the internet for real frames but did not have any luck so far.

I woud also appreciate if someone could shred some light to if the OBD-II communication needs some acknowledgment to work properly.

Thanks

1 Answers1

1

I would suggest you to take a look on the SAE J1939 documentation, in the more specifically on the J1939/21,J1939-71 and J1939/73.

Generally, a J1939 transport protocol response sequence can be processed as follows:

  • Identify the BAM frame, indicating a new sequence being initiated (via the PGN 60416 - 0xEC00 can be reach by 0x1CECFF00 )
  • Extract the J1939 PGN from bytes 6-8 of the BAM payload to use as the identifier of the new frame
  • Construct the new data payload by concatenating bytes 2-8 of the data transfer frames (i.e. excl. the 1st byte)

A J1939 data transfer messages with ID 1CEBFF00 (PGN 60160 or EB00).

Above, the last 3 bytes of the BAM equal E3FE00. When reordered, these equal the PGN FEE3 aka Engine Configuration 1 (EC1). Further, the payload is found by combining the the first 39 bytes across the 6 data transfer packets/fram

The administrative control device or any device issuing the vehicle use status PID should be sensitive to the run switch status (SPN 3046 - 0xFDC0 which probably can be reach by 0xCFDC000) and any other locally defined criteria for authorized use (i.e., driver log-ons) before the vehicle use status PID is used to generate an unauthorized use alarm.

Also, you can't forget to uses a read/send to extend ID message, since that is a 24-bit.

In fact, i will suggest you to use can-utils to make your a analyses even easier. A simple can-dump or can-sniffer you can see what is coming on your broadcast.

Some car's dbc https://github.com/commaai/opendbc

Gabriel Lincoln
  • 155
  • 1
  • 10
  • Sorry but I don't quite understand this. In the wikipedia article there is a comprehensible list of all the PID used in J1979. I believe those can be used as such in a simple car. However I believe a city bus or a truck use J1939. The J1939-73 document as I understand it allows to read the PGNs and SPNs that are equivalent (and compliant) to the PIDs that you can get from OBD. So: Is a J1939 vehicle also compliant with J1979 (ISO15031-5 and 15765)? Thanks in advance – Alex Ghilas Dec 14 '21 at 12:25
  • No, J1939 vehicle is not compliant to 1979. While OBD2 PID information is only available on-request by OBD2 test equipment, the J1939 protocol is used in most heavy-duty vehicles as the basic means for communicating CAN traffic - meaning data is broadcast continuously. If you plug a hardware to a j1939 truck/bus and simple do a "can dump" you will this: – Gabriel Lincoln Dec 14 '21 at 13:38
  • ----Timestamp: 1593742646.558943 ID: 0cf00400 X DLC: 8 0c 7d 7d E0 47 00 ff 7d Channel: can0 ----- Timestamp: 1593742646.559514 ID: 0cf00300 X DLC: 8 d1 00 00 ff ff ff 00 ff Channel: can0 ----- Timestamp: 1593742646.560094 ID: 18feef00 X DLC: 8 ff ff ff 64 ff ff ff ff Channel: can0 – Gabriel Lincoln Dec 14 '21 at 13:54
  • So, using as example the first message (CF00400) if you convert the F004 to decimal you will find 61444 this is the number on j1939/71 PGN61444 which represents "Electronic Engine Controller 1 - EEC1" this is the group of messages which has some messages inside. For example, the engine speed is the byte 4-5 (E0 47), represents the rotational speed, according to the protocol you need to read this like 47E0, convert to decimal = 18400, and apply the resolution for engine speed (0.125). So than we have 18400x0.125 = 2300 rpm – Gabriel Lincoln Dec 14 '21 at 13:58
  • if you would like, send me a email on g97santos@gmail.com and I can share with you some real J1939 Truck CAN data in MF4 and txt file that I already collected in the past. – Gabriel Lincoln Dec 14 '21 at 14:02
  • That would be fantastic thank you! – Alex Ghilas Dec 15 '21 at 10:07