cancel
Showing results for 
Search instead for 
Did you mean: 

Receiving/transmitting using UART and LL API

Indois
Associate II

0693W00000AOIHrQAP.pngHello,

I am experiencing some problems when trying to receive data from PC using UART and then check if it is correct. I am using using LL API and this code is placed in while(1) of main function. For example, when I send 'A' from PC to STM32, PC receives response with '0x01' but if I try to send 'A' again, it does not respond anymore. Do I have to clear some flags of USART before receiving again?

Thank you

7 REPLIES 7

Need to wait of TXE for the transmit, and RXNE on the receive

LL_USART_IsActiveFlag_TXE(USART2)

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Indois
Associate II

I noticed that LL_USART_TransmitData8 function successfully transmits chosen value every time when data = 'A' is received:

0693W00000AOTW9QAP.png 

But now I want to transmit a string:

0693W00000AOTXqQAP.png 

TransmitString function:

0693W00000AOTYUQA5.png 

And the problem is that string is transmtited only one time when first time data = 'A' is received. When data = 'A' is received again, nothing is transmitted. Could you help me to solve this problem?

Indois
Associate II

I found out that when I transmit only one symbol, for example '9' or 'C' then data recption is not blocked. But if I transmit more than one symbol, for example '10' or 'CC', then data reception is blocked. Could you help me to solve this problem?

Indois
Associate II

The problem is that when more than one symbol (digit or letter) is sent from PC to STM32 over UART , then STM32 received value (in my case called data) becomes '13' and it does not change anymore no matter how many times I send any values from PC to STM32 again.

Which STM32?

Maybe receiver stops working due to unhandled overrun error?

JW

I use STM32L011. I will try to check if this code of overrun error correction helps. Thank you.

Indois
Associate II

How should I use this function?

0693W00000AOr7SQAT.png 

It blocks receiving data if I start it in while, before data=LL_USART_ReceiveData8(USART2).