S32K UART Rx can't enter the receive callback

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

S32K UART Rx can't enter the receive callback

3,120 次查看
kongdetao
Contributor III

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

0 项奖励
回复
2 回复数

2,348 次查看
547416104
Contributor III

you should try to init the clock module, I think the uart module is ok.

0 项奖励
回复

2,739 次查看
stanish
NXP Employee
NXP Employee

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)

pastedImage_2.png

* can you send character from MCU -> PC?

* see the SDK example lpuart_echo_s32k148 as a reference project

pastedImage_1.png

 

Hope it helps.

Stan

0 项奖励
回复