How to use PID 0x3C and 0x3D on LIN component

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
DaCh_4605951
Level 1
Level 1

Hi,

I was wondering if it is possible to configure the Default ID settings for a LIN Slave 4.0 component on the PSoC 5LP to receive frames with PID 0x3C and 0x3D. The datasheet seems to indicate that this isn't possible, but I just wanted to confirm.

Thanks,

Daniel

0 Likes
1 Solution
BragadeeshV
Moderator
Moderator
Moderator
First question asked 1000 replies posted 750 replies posted

Hi dach_4605951​,

As per LIN protocol spec, the PIDs 0x3C and 0x3D are used as diagnostic frames. They can not be used as unconditional frames.

To use 0x3c and 0x3d, enable the Use Transport layer option in LIN Component configuration (right-click LIN Component and select Configure. In the Configure ‘LIN’ window, go to the Transport Layer tab). The Component handles these IDs in the LIN source code. (See LIN.c). However, you can monitor the the service field of the LIN diagnostic frame and create your own service handling function.

For instance, if you want to handle 0xB1, then you can use the following code snippet to handle the service:

/* If there is a data in the MRF then proceed frame receiving. */

if((ld_raw_rx_status(LINS_IFC_HANDLE) == LD_DATA_AVAILABLE))

{          /* Receive the data into a rxBuffer[] */

            ld_get_raw(LINS_IFC_HANDLE, rxBuffer);

}

if(rxBuffer[2] == 0xB1)

{

  //Handle the service

}

Regards,
Bragadeesh

View solution in original post

0 Likes
1 Reply
BragadeeshV
Moderator
Moderator
Moderator
First question asked 1000 replies posted 750 replies posted

Hi dach_4605951​,

As per LIN protocol spec, the PIDs 0x3C and 0x3D are used as diagnostic frames. They can not be used as unconditional frames.

To use 0x3c and 0x3d, enable the Use Transport layer option in LIN Component configuration (right-click LIN Component and select Configure. In the Configure ‘LIN’ window, go to the Transport Layer tab). The Component handles these IDs in the LIN source code. (See LIN.c). However, you can monitor the the service field of the LIN diagnostic frame and create your own service handling function.

For instance, if you want to handle 0xB1, then you can use the following code snippet to handle the service:

/* If there is a data in the MRF then proceed frame receiving. */

if((ld_raw_rx_status(LINS_IFC_HANDLE) == LD_DATA_AVAILABLE))

{          /* Receive the data into a rxBuffer[] */

            ld_get_raw(LINS_IFC_HANDLE, rxBuffer);

}

if(rxBuffer[2] == 0xB1)

{

  //Handle the service

}

Regards,
Bragadeesh
0 Likes