Skip to main content
Visitor II
May 14, 2021
Question

Receiving/transmitting using UART and LL API

  • May 14, 2021
  • 6 replies
  • 5886 views

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

    This topic has been closed for replies.

    6 replies

    Graduate II
    May 14, 2021

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

    LL_USART_IsActiveFlag_TXE(USART2)

    IndoisAuthor
    Visitor II
    May 15, 2021

    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?

    IndoisAuthor
    Visitor II
    May 16, 2021

    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?

    IndoisAuthor
    Visitor II
    May 17, 2021

    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.

    Super User
    May 18, 2021

    Which STM32?

    Maybe receiver stops working due to unhandled overrun error?

    JW

    IndoisAuthor
    Visitor II
    May 18, 2021

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

    IndoisAuthor
    Visitor II
    May 19, 2021

    How should I use this function?

    0693W00000AOr7SQAT.png 

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