Page 1 of 1

UART Library problems (Data_Ready) STM32

Posted: 03 Feb 2023 19:08
by ericenaelectronics
Hi,

I wrote a simple loopback code to receive characters from a PC serial terminal (Termite) and send them back.
When I send smaller numbers of characters, the code works
But, when I send a lot of characters to the STM32 it seems the UART_Data_Ready() function starts to always read 0 and characters are no longer sent back.


See below:
Image

The problem is worse with larger baud rates.
I assume that I am doing something wrong but not sure what.

Board: Fusion for ARMv8 (USB-UART to UART1)
MCU: STM32F091RCT6

Code:

Code: Select all

void main() {

  unsigned buf;
  
  UART1_Init(115200);

  while(1) {
    if(UART1_Data_Ready()) {
       buf = UART1_Read();

       while(!UART1_Tx_Idle());

       UART1_Write(buf);
    }
  }
}
Project settings
Image

Image

Re: UART Library problems (Data_Ready) STM32

Posted: 08 Feb 2023 15:42
by IvanJeremic
Hi,

You can take a look at our example for Uart in the Project Explorer:
uproj.png
uproj.png (19.75 KiB) Viewed 438 times
You can also take a look at the limitations and how the Uart library works in the Help section:
ulib.png
ulib.png (17.07 KiB) Viewed 438 times
Regards,

Ivan.