I don't know where to clear the rx buffer.
Reference:
/* Handle idle line interrupt */
if (LPUART_GetIntMode(base, LPUART_INT_IDLE_LINE))
{
if (LPUART_GetStatusFlag(base, LPUART_IDLE_LINE_DETECT))
{
lpuart_state_t * lpuartState = (lpuart_state_t *)s_lpuartStatePtr[instance];
lpuartState->rxCallback(lpuartState, UART_EVENT_RX_FULL, lpuartState->rxCallbackParam);
if (lpuartState->rxSize > 0U)
{
/* Set the source address and the number of minor loops (bytes to be transfered) */
EDMA_DRV_SetDestAddr(lpuartState->rxDMAChannel, (uint32_t)(lpuartState->rxBuff));
EDMA_DRV_SetMajorLoopIterationCount(lpuartState->rxDMAChannel, lpuartState->rxSize);
/* Now that this rx is set up, clear remaining bytes count */
lpuartState->rxSize = 0U;
/* Re-start the channel */
(void)EDMA_DRV_StartChannel(lpuartState->rxDMAChannel);
}
else
{
/* Stop the reception */
LPUART_DRV_StopRxDma(instance);
/* Invoke the callback to notify the end of the transfer */
if (lpuartState->rxCallback != NULL)
{
lpuartState->rxCallback(lpuartState, UART_EVENT_END_TRANSFER, lpuartState->rxCallbackParam);
}
/* Clear the flags */
LPUART_DRV_ClearErrorFlags(base);
}
LPUART_ClearStatusFlag(base, LPUART_IDLE_LINE_DETECT);
}
}