Chip: S32K314
S32 Design Studio: Version: 3.5 Build id: 240726 (Update 13)
RTD Version: 5.0.0 (Platform SDK_S32K3_S32K314_M7)
LIN Transceiver: TJA1029T, 118
I want to send LIN Diagnostic frames, my my S32K314 board to a LIN Slave Device (NAD: 0x4D).
I do the FXIO LIN configuration as below:
Code:
uint8 FlexioTxBuff[8] = {0x4DU, 0x06U, 0xB2U, 0x00U, 0x00U, 0x00U, 0x00U, 0xFFU};
uint8 FlexioRxBuff[8] = {0};
Flexio_Lin_Ip_PduType LinFlexioPdu[] = {
{
.Pid = 0x55U,
.Cs = FLEXIO_LIN_IP_ENHANCED_CS,
.SduPtr = FlexioTxBuff,
.Drc = FLEXIO_LIN_IP_FRAMERESPONSE_TX,
.Dl = 8U
},
{
.Pid = 0xD6,
.Cs = FLEXIO_LIN_IP_ENHANCED_CS,
.SduPtr = FlexioRxBuff,
.Drc = FLEXIO_LIN_IP_FRAMERESPONSE_RX,
.Dl = 8U
},
{
.Pid = 0x3CU,
.Cs = FLEXIO_LIN_IP_CLASSIC_CS,
.SduPtr = FlexioTxBuff,
.Drc = FLEXIO_LIN_IP_FRAMERESPONSE_TX,
.Dl = 8U
},
{
.Pid = 0x7DU,
.Cs = FLEXIO_LIN_IP_CLASSIC_CS,
.SduPtr = FlexioRxBuff,
.Drc = FLEXIO_LIN_IP_FRAMERESPONSE_RX,
.Dl = 8U
},
};
And in the main function:
Flexio_Lin_Ip_Init(Flexio_Lin_Ip_Sa_pxHwConfigPB_0.Instance,
&Flexio_Lin_Ip_Sa_pxHwConfigPB_0);
TimeoutValue = 12 * T_LIN_TIME_OUT;
// STEP 1: Send MasterReq (0x3C) with 8 bytes
(void) Flexio_Lin_Ip_SendFrame(FLEXIO_INSTANCE_0, &LinFlexioPdu[2]);
do {
FlexioMasterStatus = Flexio_Lin_Ip_GetStatus(FLEXIO_INSTANCE_0,
(const uint8**) &DummyBuffer);
} while ((FLEXIO_LIN_IP_STATUS_TX_OK != FlexioMasterStatus)
&& (TimeoutValue-- > 1));
TimeoutValue = 0;
TimeoutValue = 12 * T_LIN_TIME_OUT;
// STEP 2: Send Header (0x3D)
(void) Flexio_Lin_Ip_SendFrame(FLEXIO_INSTANCE_0, &LinFlexioPdu[3]);
do {
FlexioMasterStatus = Flexio_Lin_Ip_GetStatus(FLEXIO_INSTANCE_0,
(const uint8**) &DummyBuffer);
} while ((FLEXIO_LIN_IP_STATUS_TX_OK != FlexioMasterStatus)
&& (TimeoutValue-- > 1));
The reason I know my LIN slave device works is because when I send 0x16 (Respective PID: 0xD6), I do get response back from slave. But when I send 0x7C, I do not get anything back. I have not setup any interrupt because I am using a logic analyzer to see if the slave sends any response back.
Is my configuration of LIN message wrong or am I missing any step ?
Hi @ASN7,
Please use this calculator to verify the PID/CS.
https://linchecksumcalculator.machsystems.cz/
You use both classic and enhanced CS, does it match the Slave configuration, what Slave device do you use?
Can you share the oscillograms of the signal?
Regards,
Daniel