fs23 Lin mode swith question

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

fs23 Lin mode swith question

Jump to solution
2,072 Views
gumu
Contributor V

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!

0 Kudos
Reply
1 Solution
2,041 Views
quangvuanh
NXP Employee
NXP Employee

Hi @gumu , I got confirmation from hardware team that it's a normal behaviour. In debug mode, the transceiver mode is forced ACTIVE. So even if you try and change the LIN_MODE field to OFFLINE (OFF, 2b00) then the transceiver stays in active mode.

View solution in original post

3 Replies
2,043 Views
quangvuanh
NXP Employee
NXP Employee
Hi, I have to check with hardware team. Can you please let me know what version of FS23 that you have? Or what is the part number?
0 Kudos
Reply
2,042 Views
quangvuanh
NXP Employee
NXP Employee

Hi @gumu , I got confirmation from hardware team that it's a normal behaviour. In debug mode, the transceiver mode is forced ACTIVE. So even if you try and change the LIN_MODE field to OFFLINE (OFF, 2b00) then the transceiver stays in active mode.

2,058 Views
TomasVaverka
NXP TechSupport
NXP TechSupport

Hi Quang (@quangvuanh),

Could you please help with this question from Anhui Zhitu Technology China?

Thanks & BRs, Tomas

0 Kudos
Reply
%3CLINGO-SUB%20id%3D%22lingo-sub-1993707%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3Efs23%20Lin%20mode%20swith%20question%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1993707%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHello%2C%3C%2FP%3E%3CP%3E%3CSPAN%3EWe%20encountered%20a%20question%20while%20debugging%20the%20FS%20LIN%20functionality.%20Specifically%2C%20we%20found%20that%20in%20debug%20mode%2C%20we%20cannot%20set%20the%26nbsp%3B%3C%2FSPAN%3ELINTRCV_FS23_TRCVMODE_OFF%3CSPAN%3E%26nbsp%3Bmode%20using%20the%26nbsp%3B%3C%2FSPAN%3ELinTrcv_fs23_SetMode()%3CSPAN%3E%26nbsp%3Bfunction.%20%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3EThe%20code%20snippet%20is%20as%20follows%3A%3C%2FSPAN%3E%3C%2FP%3E%3CBR%20%2F%3E%3CPRE%20class%3D%22lia-code-sample%20language-markup%22%3E%3CCODE%3EStd_ReturnType%20LinTrcv_fs23_SetMode(uint8%20u8LinNetwork%2C%20LinTrcv_fs23_TrcvModeType%20eOpMode)%0A%7B%0A%20%20%20%20uint16%20u16RegData%20%3D%200U%3B%0A%20%20%20%20Std_ReturnType%20eStatus%3B%0A%20%20%20%20LinTrcv_fs23_TrcvModeType%20eNewHwOpMode%20%3D%20LINTRCV_FS23_TRCVMODE_INVALID%3B%0A%20%20%20%20%2F*%20Read%20M_LIN%20register.%20*%2F%0A%20%20%20%20eStatus%20%3D%20Sbc_fs23_ReadRegister(SBC_FS23_M_LIN_ADDR%2C%20%26amp%3Bu16RegData)%3B%0A%0A%20%20%20%20if%20((Std_ReturnType)E_OK%20%3D%3D%20eStatus)%0A%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%2F*%20Set%20new%20register%20value.%20*%2F%0A%20%20%20%20%20%20%20%20u16RegData%20%26amp%3B%3D%20~(SBC_FS23_M_LIN_MODE_MASK%20%7C%20SBC_FS23_M_LIN_SLOPE_MASK%7C%20SBC_FS23_M_LIN_FS_DIS_MASK)%3B%0A%20%20%20%20%20%20%20%20if(TRUE%20%3D%3D%20xG_drivers%5Bu8LinNetwork%5D.bLinSlowSlope)%0A%20%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20u16RegData%20%7C%3D%20SBC_FS23_M_LIN_SLOPE_SLOW%3B%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20%20if(FALSE%20%3D%3D%20xG_drivers%5Bu8LinNetwork%5D.bLinFailsafeDisable)%0A%20%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20u16RegData%20%7C%3D%20SBC_FS23_M_LIN_FS_DIS_KEEP%3B%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20%20u16RegData%20%7C%3D%20((uint16)eOpMode%20%26lt%3B%26lt%3B%20SBC_FS23_M_LIN_MODE_SHIFT)%3B%0A%0A%20%20%20%20%20%20%20%20eStatus%20%3D%20Sbc_fs23_WriteRegister(SBC_FS23_M_LIN_ADDR%2C%20u16RegData)%3B%0A....%0A%20%20%20%20%20%20%20%20%2F*Check%20the%20real%20hardware%20state*%2F%0A%20%20%20%20%20%20%20%20eStatus%20%7C%3D%20LinTrcv_fs23_GetMode(u8LinNetwork%2C%20%26amp%3BeNewHwOpMode)%3B%0A%20%20%20%20%20%20%20%20if((eNewHwOpMode%20%3D%3D%20eOpMode)%20%26amp%3B%26amp%3B%20((Std_ReturnType)E_OK%20%3D%3D%20eStatus))%0A%20%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20eStatus%20%3D%20(Std_ReturnType)E_OK%3B%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20%20else%0A%20%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20eStatus%20%3D%20(Std_ReturnType)E_NOT_OK%3B%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%7D%0A%0A%20%20%20%20return%20eStatus%3B%0A%7D%3C%2FCODE%3E%3C%2FPRE%3E%3CBR%20%2F%3E%3CP%3E%3CSPAN%3EThe%26nbsp%3BeOpMode%20is%26nbsp%3BLINTRCV_FS23_TRCVMODE_OFF%2C%26nbsp%3B%20the%20eNewHwOpMode%26nbsp%3B%20is%26nbsp%3BLINTRCV_FS23_TRCVMODE_NORMAL.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3EThe%20manual%20states%20that%20in%20debug%20mode%2C%20LIN%20defaults%20to%20active%20mode.%20Is%20this%20behavior%20normal%3F%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3EThanks!%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1994564%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20fs23%20Lin%20mode%20swith%20question%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1994564%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F211858%22%20target%3D%22_blank%22%3E%40gumu%3C%2FA%3E%26nbsp%3B%2C%20I%20got%20confirmation%20from%20hardware%20team%20that%20it's%20a%20normal%20behaviour.%20I%3CSPAN%20data-teams%3D%22true%22%3En%20debug%20mode%2C%20the%20transceiver%20mode%20is%20forced%20ACTIVE.%20So%20even%20if%20you%20try%20and%20change%20the%20LIN_MODE%20field%20to%20OFFLINE%20(OFF%2C%202b00)%20then%20the%20transceiver%20stays%20in%20active%20mode.%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1994550%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20fs23%20Lin%20mode%20swith%20question%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1994550%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3EHi%2C%20I%20have%20to%20check%20with%20hardware%20team.%20Can%20you%20please%20let%20me%20know%20what%20version%20of%20FS23%20that%20you%20have%3F%20Or%20what%20is%20the%20part%20number%3F%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1993741%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20fs23%20Lin%20mode%20swith%20question%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1993741%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%20Quang%20(%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F220202%22%20target%3D%22_blank%22%3E%40quangvuanh%3C%2FA%3E)%2C%3C%2FP%3E%0A%3CP%3ECould%20you%20please%20help%20with%20this%20question%20from%26nbsp%3BAnhui%20Zhitu%20Technology%20China%3F%3C%2FP%3E%0A%3CP%3EThanks%20%26amp%3B%20BRs%2C%20Tomas%3C%2FP%3E%3C%2FLINGO-BODY%3E