Hello,
We encountered a question while debugging the FS LIN functionality. Specifically, we found that in debug mode, we cannot set the LINTRCV_FS23_TRCVMODE_OFF mode using the LinTrcv_fs23_SetMode() function.
The code snippet is as follows:
Std_ReturnType LinTrcv_fs23_SetMode(uint8 u8LinNetwork, LinTrcv_fs23_TrcvModeType eOpMode)
{
uint16 u16RegData = 0U;
Std_ReturnType eStatus;
LinTrcv_fs23_TrcvModeType eNewHwOpMode = LINTRCV_FS23_TRCVMODE_INVALID;
/* Read M_LIN register. */
eStatus = Sbc_fs23_ReadRegister(SBC_FS23_M_LIN_ADDR, &u16RegData);
if ((Std_ReturnType)E_OK == eStatus)
{
/* Set new register value. */
u16RegData &= ~(SBC_FS23_M_LIN_MODE_MASK | SBC_FS23_M_LIN_SLOPE_MASK| SBC_FS23_M_LIN_FS_DIS_MASK);
if(TRUE == xG_drivers[u8LinNetwork].bLinSlowSlope)
{
u16RegData |= SBC_FS23_M_LIN_SLOPE_SLOW;
}
if(FALSE == xG_drivers[u8LinNetwork].bLinFailsafeDisable)
{
u16RegData |= SBC_FS23_M_LIN_FS_DIS_KEEP;
}
u16RegData |= ((uint16)eOpMode << SBC_FS23_M_LIN_MODE_SHIFT);
eStatus = Sbc_fs23_WriteRegister(SBC_FS23_M_LIN_ADDR, u16RegData);
....
/*Check the real hardware state*/
eStatus |= LinTrcv_fs23_GetMode(u8LinNetwork, &eNewHwOpMode);
if((eNewHwOpMode == eOpMode) && ((Std_ReturnType)E_OK == eStatus))
{
eStatus = (Std_ReturnType)E_OK;
}
else
{
eStatus = (Std_ReturnType)E_NOT_OK;
}
}
return eStatus;
}
The eOpMode is LINTRCV_FS23_TRCVMODE_OFF, the eNewHwOpMode is LINTRCV_FS23_TRCVMODE_NORMAL.
The manual states that in debug mode, LIN defaults to active mode. Is this behavior normal?
Thanks!