Search code examples
obd-iij1939

Looking for an example of a OBD-II complete data frame


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


Solution

  • 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