UART Library problems (Data_Ready) STM32

General discussion on mikroC PRO for ARM.
Post Reply
Author
Message
ericenaelectronics
Posts: 2
Joined: 31 Jan 2023 20:06

UART Library problems (Data_Ready) STM32

#1 Post by ericenaelectronics » 03 Feb 2023 19:08

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

User avatar
IvanJeremic
mikroElektronika team
Posts: 316
Joined: 05 Sep 2022 14:32

Re: UART Library problems (Data_Ready) STM32

#2 Post by IvanJeremic » 08 Feb 2023 15:42

Hi,

You can take a look at our example for Uart in the Project Explorer:
uproj.png
uproj.png (19.75 KiB) Viewed 408 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 408 times
Regards,

Ivan.

Post Reply

Return to “mikroC PRO for ARM General”