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