cancel
Showing results for 
Search instead for 
Did you mean: 

USART gets overrun error non-stop

ernie
Associate
Posted on February 19, 2016 at 02:17

I'm using STM32L4 with CubeMx.  I want to use USART3 to implement an RS232 console echo.

My CubeMX is configured like this photo (and I have ''USART3 global interrupt'' checkboxed as enabled.

 0690X00000604WGQAY.png

After auto-generating the code, which initializes the USART3 module, I run my custom application code, which I'm trying to just echo console characters RS232 style.

void test_usart(void)

{

    uint8_t byte;

    HAL_StatusTypeDef ret;

    

    while(1)

    {

        while( HAL_OK != HAL_USART_Receive_IT(&husart3, &byte, 1) )

        {

            osDelay(1);

        }

        

        while( HAL_OK != HAL_USART_Transmit_IT(&husart3, &byte, 1) )

        {

            osDelay(1);

        }

    }

}

The issue is that in the ISR, I always get the overrun error and I can never get characters from the console host to the STM32L4.  However, I am not transmitting or receiving anything at that point.  Any clue as to what I might be doing wrong?

#usart-rs232-uart-stm32l4
1 REPLY 1
ernie
Associate
Posted on February 19, 2016 at 19:52

The problem ended up being that CubeMX automatically changed my USART settings to ''Synchronous'' rather than my original setting of ''Asynchronous''.  After changing things back to Async, it worked fine and auto-generated function names with UART* rather than USART*.