S32k146 UART RX interrupt not receiving entire buffer

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

S32k146 UART RX interrupt not receiving entire buffer

939 次查看
bhanu_p
Contributor I

Hi,

i'm using S32k146 custom board PCB  in that i'm trying to get the RX buffer using interrupt method but the thing is my interrupt  call back function not triggering to get entire buffer.

for Example : if i send "AT+RESET" to MCU  my call back function only triggering 3 times and i'm getting buffer only "AT" remaining buffer i'm not getting and my call back event is showing as "UART_EVENT_ERROR

please go through the below given code for your reference

uart_init(void)
{
	LPUART_DRV_Init(INST_LPUART1, &lpuart1_State, &lpuart1_InitConfig0);
	LPUART_DRV_InstallRxCallback(INST_LPUART1, iot_rx_callback, NULL);
        LPUART_DRV_SendDataBlocking(INST_LPUART1, ser_tx_cmd0, 4U, 100);
}

void iot_rx_callback(void *driverState, uart_event_t event, void *userData)
{
	(void) driverState;
	(void) userData;

    if (event == UART_EVENT_RX_FULL)
    {
        if ((buffer[bufferIdx - 1] != '\r') && (buffer[bufferIdx] != '\n') && (bufferIdx != (BUFFER_SIZE - 1U)))
        {
            bufferIdx++;
            LPUART_DRV_SetRxBuffer(INST_LPUART1, &buffer[bufferIdx++], 1U);
        }
        else
        {
	  bufferIdx=0;
           rx_complete = true;
        }
    }
}

while(1){

	int ret =LPUART_DRV_ReceiveData(INST_LPUART1, buffer, 1U);
	if(ret=STATUS_SUCCESS){
	while(LPUART_DRV_GetReceiveStatus(INST_LPUART1, &bytesRemaining) == STATUS_BUSY);
	  ser_buffer_index=0;
	}
/*********/
own code
/********/

}

 

Screenshot 2024-10-14 173728.png

my normal TX data is transmitting properly without any trouble  only problem i'm facing in RX  data 

 

0 项奖励
回复
1 回复

902 次查看
Robin_Shen
NXP TechSupport
NXP TechSupport

Hi

I recommend you to refer to the example in S32K1xx Lpuart IDLE detected with DMA transfer.


Best Regards,
Robin
-------------------------------------------------------------------------------
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.
-------------------------------------------------------------------------------

0 项奖励
回复