LPC5410x UART overrun issue

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

LPC5410x UART overrun issue

664 Views
svensavic
Contributor III

I have always used interrupt based UART for any data transfer, so this is bit unknown to me. Seemingly most of my data goes down to the drain when I try to read uart "synchronously" (I dont mean synchronous mode of UART, but just not interrupt based).

I have loop something like this:

while (1) {

      if (uart.dataReady()) {

         buff = uart.receive();

         }

      delay_us(100);

}

uint8_t uart::dataReady()

{

   return IS_BIT_SET (channel.STAT, RXRDY);

}

uint8_t uart::receive()

{

  return channel.RXDAT;

}

If I put delay between each transmit sequence in the host system, this kinda works. but not reliably.

Without delay, I receive first character and then I get overrunint=1 in STAT and rest of the data is lost. 

Logic analyzer shows all data, and baud is set correctly (115200). Uart is connected to wifi module and host is connected over the wifi.

My packages are 10-30 bytes. I only receive first byte of each packet ?? 

With interrupt, everything works like a charm. .. so its obviously issue with collecting the data from UART.

Unfortunately, in this case I cant use interrupt as I need to write some data to FLASH RAM and if interrupt is enabled, uC got stuck after IAP_RAM2FLASH.

I dont need to do any operation when data transfer starts, so blocking calls are fine. How do I reliably read the whole data buffer synchronously ?

Labels (2)
0 Kudos
Reply
1 Reply

552 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Sven Savic,

   I suggest you refer to the official SDK code for LPC5410X at first, there has the UART block code.

   Please download the code from this link:

https://mcuxpresso.nxp.com/en/builder 

  Choose the board as LPCXpress54102, then generate the code and download it.

  You can find the uart code from this folder:

SDK_2.4.1_LPCXpresso54102\boards\lpcxpresso54102\driver_examples\usart\polling

Have a great day,
Kerry

 

-------------------------------------------------------------------------------
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 Kudos
Reply