Hi, Dear,
On S32K148 Board, with the S32 Development IDE for ARM, I write a uart driver for rx/tx data, the code is as below.
However, when I send data from PC to S32k board, the Log_Rx_Hander wasn't called, why?
Thanks!
void Log_Rx_Handler(void *driverState, uart_event_t event, void *userData)
{
/* Unused parameters */
(void)driverState;
(void)userData;/* Check the event type */
if (event == UART_EVENT_RX_FULL)
{
/* The reception stops when newline is received or the buffer is full */
if ((buffer[bufferIdx] != '\n') && (bufferIdx != (BUFFER_SIZE - 2U)))
{
/* Update the buffer index and the rx buffer */
bufferIdx++;
LPUART_DRV_SetRxBuffer(INST_DEBUG_UART2, &buffer[bufferIdx], 1U);
}
}
}void Log_Init()
{
LPUART_DRV_Init(INST_DEBUG_UART2, &debug_uart2_State, &debug_uart2_InitConfig0);LPUART_DRV_InstallRxCallback(INST_DEBUG_UART2, Log_Rx_Handler, NULL);
//WINT_SYS_InstallHandler(LPUART2_RxTx_IRQn, Log_Rx_Handler, (isr_t *)0);
INT_SYS_EnableIRQ(LPUART2_RxTx_IRQn);
LPUART_DRV_SendData(INST_DEBUG_UART2,(uint8_t *)dbgOkMsg, strlen(dbgOkMsg));
}
Hi Kong,
I don't see anything obvious on the snippet you posted.
I'd suggest you to check:
* if your pinmux for Rx/Tx pin is correctly configured. (see below example valid for LPUART1 - OpenSDA UART)
* can you send character from MCU -> PC?
* see the SDK example lpuart_echo_s32k148 as a reference project
Hope it helps.
Stan