AnsweredAssumed Answered

S32K UART Rx can't enter the receive callback

Question asked by kongdetao@saicmotor.com on Jan 29, 2019
Latest reply on Feb 7, 2019 by stanish

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));
}

Outcomes