Hi ronald_j_chasse,
If you want to enable both the TX and RX interrupt, you just need to enable both LPUARTx_CTRL[TIE] and LPUARTx_CTRL[RIE], more details, please check the CTRL register description in the KL82 reference manual.

So, you can use this API:
LPUART_EnableInterrupts(base, kLPUART_TxDataRegEmptyInterruptEnable | kLPUART_RxDataRegFullInterruptEnable);
About the interrupt, please check :
static void HAL_UartInterruptHandle(uint8_t instance)
{
hal_uart_state_t *uartHandle = s_UartState[instance];
uint32_t status;
if (NULL == uartHandle)
{
return;
}
status = LPUART_GetStatusFlags(s_LpuartAdapterBase[instance]);
/* Receive data register full */
if ((LPUART_STAT_RDRF_MASK & status) &&
(LPUART_GetEnabledInterrupts(s_LpuartAdapterBase[instance]) & kLPUART_RxDataRegFullInterruptEnable))
{
if (uartHandle->rx.buffer)
{
uartHandle->rx.buffer[uartHandle->rx.bufferSofar++] = LPUART_ReadByte(s_LpuartAdapterBase[instance]);
if (uartHandle->rx.bufferSofar >= uartHandle->rx.bufferLength)
{
LPUART_DisableInterrupts(s_LpuartAdapterBase[instance],
kLPUART_RxDataRegFullInterruptEnable | kLPUART_RxOverrunInterruptEnable);
if (uartHandle->callback)
{
uartHandle->rx.buffer = NULL;
uartHandle->callback(uartHandle, kStatus_HAL_UartRxIdle, uartHandle->callbackParam);
}
}
}
}
/* Send data register empty and the interrupt is enabled. */
if ((LPUART_STAT_TDRE_MASK & status) &&
(LPUART_GetEnabledInterrupts(s_LpuartAdapterBase[instance]) & kLPUART_TxDataRegEmptyInterruptEnable))
{
if (uartHandle->tx.buffer)
{
LPUART_WriteByte(s_LpuartAdapterBase[instance], uartHandle->tx.buffer[uartHandle->tx.bufferSofar++]);
if (uartHandle->tx.bufferSofar >= uartHandle->tx.bufferLength)
{
LPUART_DisableInterrupts(s_LpuartAdapterBase[uartHandle->instance],
kLPUART_TxDataRegEmptyInterruptEnable);
if (uartHandle->callback)
{
uartHandle->tx.buffer = NULL;
uartHandle->callback(uartHandle, kStatus_HAL_UartTxIdle, uartHandle->callbackParam);
}
}
}
}
#if 1
LPUART_ClearStatusFlags(s_LpuartAdapterBase[instance], status);
#endif
}
#endif
#endif
You also can do the operation in the callback function.
Wish it helps you!
If you still have questions about it, please kindly let me know!
Best Regards,
Kerry
-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!
- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-----------------------------------------------------------------------------