1
\$\begingroup\$

I am implementing a LIN master, developing all the aspects of the LIN protocol I need, using a UART device (capable to send break).

The question is about the doubt to compute the parity bits in order to send the protected identifier on the bus (as one does for any unconditional frame)

As LIN_Specification_Package_2.2A states:

2.3.1.3 Protected identifier field

A protected identifier field consists of two sub-fields; the frame identifier and the parity.

Bits 0 to 5 are the frame identifier and bits 6 and 7 are the parity.

Frame identifier

Six bits are reserved for the frame identifier, values in the range 0 to 63 can be used.

The frame identifiers are split in three categories:

• Values 0 to 59 (0x3B) are used for signal carrying frames,

• 60 (0x3C) and 61 (0x3D) are used to carry diagnostic and configuration data,

• 62 (0x3E) and 63 (0x3F) are reserved for future protocol enhancements.

Parity

The parity is calculated on the frame identifier bits as shown in equations (1) and (2):

P0 = ID0 ^ ID1 ^ ID2 ^ ID4 (1)

P1 = ~(ID1 ^ ID3 ^ ID4 ^ ID5) (2)

How do I compute the protected id in case of diagnostic requests, as I couldn't find any evidence in the official documentation?

In case of diagnostic master request, the frame id is 0x3C: the protected ID to be sent is still 0x3C (P0 = 0, P1 = 0).

In case of diagnostic slave response, the frame id is 0x3D: the protected ID computed should be 0x7D (P0 = 1, P1 = 0).

So, in short, as a LIN master should I send 0x7D as protected identifier (raw value on the bus line) to let the slave reply?


LIN specification package V2.1 & V2.0 & V2.2A

LIN Protocol and Physical Layer Requirements

LIN Message Frame

\$\endgroup\$
6
  • \$\begingroup\$ Details of what you are talking about at the start of the question will help. A link or few to relevant documentation will also help. You mention LIN in passing. \$\endgroup\$
    – Russell McMahon
    Commented May 28, 2020 at 3:40
  • \$\begingroup\$ Agree - what's the context here? \$\endgroup\$
    – RJR
    Commented May 28, 2020 at 7:34
  • \$\begingroup\$ Hi, sorry for not being clear. I am implementing a LIN master, developing all the aspects of the LIN protocol I need, using a UART device (capable to send break). The question is about the doubt to compute the parity bits in order to send the protected identifier on the bus (as one does for any unconditional frame). \$\endgroup\$
    – Francesco
    Commented May 28, 2020 at 13:58
  • \$\begingroup\$ I have no experience with LIN - but reading what you say above and skimming through a version of the LIN SPECIFICATION PACKAGE (that you should have provided a reference to, or to one relevant to you) it seems that you "have it backwards". | To me the instruction "In case of diagnostic master request, the frame id is 0x3C: the protected ID to be sent is still 0x3C (P0 = 0, P1 = 0)." sounds as though your master should send 03xC. \$\endgroup\$
    – Russell McMahon
    Commented May 28, 2020 at 23:39
  • \$\begingroup\$ Hi Russell, thanks for editing the question adding references. I definitely learn something. My doubt was on the frame id of the slave response but re-reading the quoted lines I'm pretty confident that I should trasform 0x3D (adding the parity bits) into 0x7D and send it on the bus as protected identifier. As I'll receive a LIN slave board, I will be able to test this out and confirm this as answer myself. Thank you all. \$\endgroup\$
    – Francesco
    Commented May 29, 2020 at 7:30

1 Answer 1

1
\$\begingroup\$

In LIN, whichever frame identifier (that is 6 bits long) the master sends is subject to parity computation, or-ing P0 and P1 as bits 6 and 7, respectively.

Examples:

  • 0x3C is sent unaltered (P0 = 0, P1 = 0).

  • 0x3D is sent as 0x7D (P0 = 1, P1 = 0).

My initial doubt was these values (used for diagnostic messages) were treated in a special way, but that is not the case.

\$\endgroup\$

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.