Hi TIC,
I try to add the LPUART idle line interrupt - LPUART_INT_IDLE_LINE based on S32SDK_S32K1xx_RTM_3.0.0.
- Firstly, set the CTRL[ILT] and CTRL[IDLECFG]:
LPUART_SetParityMode(base, lpuartUserConfig->parityMode);
LPUART_SetStopBitCount(base, lpuartUserConfig->stopBitCount);
/* Config: 8 idle character(s) must be received before the IDLE flag is set.*/
base->CTRL = (base->CTRL & ~LPUART_CTRL_IDLECFG_MASK) | (3 << LPUART_CTRL_IDLECFG_SHIFT);
/* Idle character bit count starts after stop bit. */
base->CTRL = (base->CTRL & ~LPUART_CTRL_ILT_MASK) | (1 << LPUART_CTRL_ILT_SHIFT);
- Secondly, enable the CTRL[IDLE] in the function LPUART_DRV_StartReceiveDataUsingInt() or LPUART_DRV_StartReceiveDataUsingDma():
/* Enable LPUART Rx IDLE interrupt */
LPUART_SetIntMode(base, LPUART_INT_IDLE_LINE, true);
- Lastly, add handler for the LPUART_INT_IDLE_LINE interruption to the LPUART_DRV_IRQHandler():
/* Handle idle line interrupt */
if (LPUART_GetIntMode(base, LPUART_INT_IDLE_LINE))
{
if (LPUART_GetStatusFlag(base, LPUART_IDLE_LINE_DETECT))
{
LPUART_IdleLineIrqHandler(instance);
}
}
After that, it still can not trigger the LPUART_INT_IDLE_LINE interruption when I send a string to the LPUART.
Is it configured correctly? Is there anything that I haven't done?
Have a great day,
Cyril