0
\$\begingroup\$

I have been assigned a task to implement a protocol understanding with some nodes in car. for example, in a car the driver pressed AC on/off or fan on/off from a a button module this information has to go the HVAC controller and status need to be delivered back to the Button module and also may be the display module.

I am trying to implement it in CAN. The problem is even if I have worked on CAN and tested the CAN frames using tools. I never gave thought on 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 message filter and mask sometimes it can be single message id like 0x123 or a range of message id 0x120 - 0x128

When I am trying to do that myself the questions like should I assign 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 only make use of J1939 Identifier structure(J1939 address claiming concept are not used ) along with can 2.0B, where out of 29bit I am setting PGN from 0000 to FFFF are used to identifies the meaning of the message, and finally the source Address to tell which button module is being pressed or which application ECU is sending request.So we can uniquely identifies each node in communication. Assume that source address will not be used by other module in the current network. With this approach I am thinking lot of PGN range are unused.

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

\$\endgroup\$
4
  • \$\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 at 7:00
  • \$\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 at 7:34
  • \$\begingroup\$ Then you've answered most of your questions yourself. \$\endgroup\$ – Lundin Jun 9 at 7:42
  • \$\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 at 10:28
0
\$\begingroup\$

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.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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