I have been assigned to implement a protocol dealing with some nodes in a car.

For example: in a car the driver presses AC on/off or fan on/off from a button module. This information has to go the HVAC controller and the status needs to be delivered back to the button module and also may be the display module.

I am trying to implement it with CAN. The problem is that even if I have worked on CAN and tested the CAN frames using tools, I never gave thought to why a particular CAN ID is given to a particular frame.

Generally any node can listen to any CAN ID and the controller side of the CAN RX decides which CAN IDs it should accept with a message filter and mask. Sometimes it can be a single message ID like 0x123 or a range of message IDs like 0x120 - 0x128.

When I am trying to do that myself the questions is: should I assign a lower ID value or should I assign a high ID value? How do I know which sign is of priority? Can I use IDs lower than 100?

How to frame the CAN ID? Can you give an example of the frame or CAN ID structure, or share any documents?

One approach I came up with is to make use only of the J1939 identifier structure (the J1939 address claiming concept is not used) along with CAN 2.0B, where out of 29 bits I am setting PGN from 0000 to FFFF, used to identify the meaning of the message, and finally the source address to tell which button module is being pressed or which application ECU is sending the request, so we can uniquely identifies each node in communication.

Assume that the source address will not be used by other modules in the current network. With this approach I think a lot of the PGN range is unused.

Is this approach correct? How do I do the same with an 11-bit identifier?

  • \$\begingroup\$ I could answer these questions but it rather seems you would benefit from reading a book about CAN, since some of your questions are very fundamental. In order to understand priority, you need to understand message arbitration, which is kind of the centrepiece of anything CAN bus. \$\endgroup\$
    – Lundin
    Jun 9, 2021 at 7:00
  • 1
    \$\begingroup\$ @Lundin identifier defines not only the content of the data, but also the priority,I understand that the identifier is used as a priority to determine which device gains access to the network. and lower the numerical value of the identifier, the higher its priority. \$\endgroup\$
    – priya91
    Jun 9, 2021 at 7:34
  • \$\begingroup\$ Then you've answered most of your questions yourself. \$\endgroup\$
    – Lundin
    Jun 9, 2021 at 7:42
  • 1
    \$\begingroup\$ I think OP asks about how to determine priorities. For example, emergency messages probably need the highest priority. One may also study CANopen protocol to get some ideas. \$\endgroup\$
    – Tagli
    Jun 9, 2021 at 10:28

1 Answer 1


In j1939 I can't find a PGN defined with SPN for A/C buttons.

So you'd probably have to use the manufacturer proprietary fields and set your source addresses accordingly, source address 25 is for climate control ecu 1 for example.

For the other way around check SPN 7853 in PGN 64993 for example.

The CAN ID is compiled from the PGN, source and destination address and some other bits. You really need to read the spec to know which identifier you should be using.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.