I Need help with SAE J1939 Protocol Implementation

Hello guys! :wave:

My current project entails putting the SAE J1939 vehicle communication protocol into practice. I was hoping to obtain some guidance from others who have expertise with this regimen because I have run into a few obstacles.

Specifically, I am having trouble with the following:

Which protocols should be followed to guarantee prompt and dependable message delivery across the J1939 network? Are there any particular settings or time parameters I should be aware of?

Could anyone provide insights on efficiently managing Parameter Group Numbers (PGNs) and Suspect Parameter Numbers (SPNs)? Any tips on organizing and accessing this data effectively?

I need to implement diagnostic communication as per the J1939 standard. What are the common pitfalls to avoid, and how can I ensure compliance with the standard?

I also check this: https://www.sae.org/binaries/content/assets/cm/content/standards/enewsletters/gv-marqlikview But I have not found any solution. Could anyone provide me the best solution for this?

Thank you :smiling_face:

Respected community member :smiling_face_with_three_hearts:

Hello Georgia,
I assume you are about to implement the J1939-21 (CAN CC) protocol layer. You may use for the most Parameter Groups (PGs) a single CAN message. In case the length of a PG exceeds 8 byte you need to implement a transport protocol. This is either RTS/CTS or BAM. All message services are considered reliable with respect to CAN. If an implementation can handle all received message in time is a different question. To adjust the delay of a message delivery you have to carefully manage the priority of each CAN message by means of the PG’s priority field. Since most of the J1939 messages are broadcast and cyclic an application should be robust enough to survive a single message lost and wait for the next message. In case of a message is sent to a specific destination the receive most likely provides an acknowledge. This will helpt the sender of a message to see if the message transport was successfull.
To avoid issues you should consider to implement dynamic address management as described in the -81 document. An effective way to handle PGs/PGNs in you software is to use a hash algorithm. For compatibility issues you should consider -82 document and follow the checks precisely.
A general free of charge online training for J1939 fundamentals can be found here: Vector eLearning. You may also check our CANoe.J1939 which includes a compliance test, based on SAE documents CANoe.J1939.

Hello and welcome! :wave:

Great to see your interest in J1939—here’s a quick summary to help:

Reliable Messaging: Use BAM (Broadcast Announce Message) or RTS/CTS (Request To Send/Clear To Send) protocols for multi-packet messages; ensure proper timing with T1 (200 ms), T2 (50 ms), etc., as defined in J1939-21.
PGNs/SPNs: Organize PGNs using lookup tables and decode SPNs using the J1939DA (Database); using DBC files and tools like Vector CANdb++ or Kvaser Database Editor can help.
Diagnostics: Stick to J1939-73 for DM (Diagnostic Message) handling; avoid mixing DM1/DM2 incorrectly and ensure proper state management for active/inactive faults.

Hello! :wave: Here’s a short and focused reply to help with your SAE J1939 implementation:


:white_check_mark: Reliable Message Delivery:

  • Use Broadcast Announce Messages (BAM) or RTS/CTS for multi-packet transport.
  • Set T1 (750 ms), T2 (1250 ms), T3 (125 ms), and T4 (1050 ms) as per J1939/21 for timing compliance.
  • Ensure proper message prioritization using the 3-bit priority field in the 29-bit CAN ID.

:white_check_mark: PGNs & SPNs:

  • Use a PGN-to-SPN mapping table.
  • Store in a lookup dictionary or structured JSON/XML for easier access.
  • Use SPN decoding libraries/tools if available to simplify development.

:white_check_mark: Diagnostics (DM1–DM30):

  • Start with DM1 (active DTCs) and DM2 (previous DTCs).
  • Common issues: missing Acknowledgement messages, incorrect PGN formatting, and not handling multiple ECU responses.
  • Use J1939DA (SAE J1939 Digital Annex) for PGN/SPN definitions and diagnostics mapping.

Let me know if you need sample code or open-source libraries. :+1: