SPC5748G LINFLEXD_UART Using RXCallback Missing even Bytes

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

SPC5748G LINFLEXD_UART Using RXCallback Missing even Bytes

789 Views
cskwon
Contributor I

hello everyone

 

I am using SPC5748G.

I am using UART with LINFLEXD_UART2

The baudrate is 921600, and it is connected to the Wi-Fi module.


The data sent by the Wi-Fi module is processed in the callback with the install_rxcallback function.

The problem is that when I store the received data as an array, even bytes are missing.
ex:) If the total content to be received is "+eventapp:boot_complete",
The actual received data receives "+vnapbo_opee" and stores it in an array.

The callback function is as follows.

void WiFi_UART_Callback(void *driverState, uart_event_t event, void *userData)
{
	  char Str_Test = 0;
	  // Disable interrupt
	  INT_SYS_DisableIRQ(LINFLEXD2_RX_IRQn);
	  INT_SYS_DisableIRQ(LINFLEXD2_TX_IRQn);
//
	  LINFLEXD_UART_DRV_ReceiveData(INST_WIFI_UART, &WiFi_UART_RX_Buffer, 1U);
	  WiFi_Received_Data[WiFi_Received_Count] = WiFi_UART_RX_Buffer;
	  WiFi_Received_Count++;

//	  Str_Test = strstr(WiFi_Received_Data, "complete");
	  if(WiFi_Received_Count >= 20)
	  {
		  Str_Test = 0xFF;
	  }

//	  // Enable interrupt
	  INT_SYS_EnableIRQ(LINFLEXD2_RX_IRQn);
	  INT_SYS_EnableIRQ(LINFLEXD2_TX_IRQn);
}

The clock settings are as follows.

LIN2_CLK - Interface Clock : F40, Clock Source : F80, Frequency : 80MHz

I don't know what the hell is the problem.

Thank you very much for your reply. thank you.

 

0 Kudos
5 Replies

770 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

can you decrease baudrate of the used Wi-Fi module? Maybe it is fast enough if also anything else is running and served. Also try to increase interrupt priority for used UART2 module.

BR, Petr

0 Kudos

765 Views
cskwon
Contributor I

Hi. Thanks Reply

 

How to increase interrupt priority?

 

in processor expert??

 

 

0 Kudos

758 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

using INT_SYS_SetPriority(LINFLEXD2_RX_IRQn,15);  // 15 (highest priority) down to 0
(lowest priority).

BR, Petr

0 Kudos

752 Views
cskwon
Contributor I

Thanks, Solution

I changed Priority (changed to 15)
Sometimes data loss occurs.

Is there any other way to handle RX faster than the callback function?

 

BR.

0 Kudos

715 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

you can try to create circular buffer and use just SetRxBuffer function within rx callback, so do not call ReceiveData each time. Refer e.g. to UART_pal demo code.

BR, Petr

0 Kudos