cancel
Showing results for 
Search instead for 
Did you mean: 

Hi, I need to work with USART auto baud rate detection on STM32G0.

OBA.1
Associate

 I did the USART configuration as mentioned in AN4908. However, the UART_FLAG_ABRF flag is always reset.

3 REPLIES 3

Not sure your presentation is sufficient to understand or replicate what you tried.

Have you reviewed the problem in the context of the Reference Manual?

https://www.st.com/resource/en/application_note/an4908-stm32-usart-automatic-baud-rate-detection-stmicroelectronics.pdf

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

hi, sure! i have set the config as defined below:

/*##-2- Configure the AutoBaudRate method */ UartHandle.AdvancedInit.AdvFeatureInit =UART_ADVFEATURE_AUTOBAUDRATE_INIT; UartHandle.AdvancedInit.AutoBaudRateEnable = UART_ADVFEATURE_AUTOBAUDRATE_ENABLE; /*Uncomment your appropriate mode */ //UartHandle.AdvancedInit.AutoBaudRateMode = UART_ADVFEATURE_AUTOBAUDRATE_ONSTARTBIT; //UartHandle.AdvancedInit.AutoBaudRateMode = UART_ADVFEATURE_AUTOBAUDRATE_ONFALLINGEDGE; //UartHandle.AdvancedInit.AutoBaudRateMode = UART_ADVFEATURE_AUTOBAUDRATE_ON0X7FFRAME; //UartHandle.AdvancedInit.AutoBaudRateMode = UART_ADVFEATURE_AUTOBAUDRATE_ON0X55FRAME; if (HAL_UART_Init(&UartHandle) != HAL_OK) { /* Initialization Error */ Error_Handler(); } /* Wait until Receive enable acknowledge flag is set */ while(__HAL_UART_GET_FLAG(&UartHandle,UART_FLAG_REACK) == RESET) {} /* Wait until Transmit enable acknowledge flag is set */ while(__HAL_UART_GET_FLAG(&UartHandle,UART_FLAG_TEACK) == RESET) {} /* Loop until the end of Autobaudrate phase */ while(__HAL_UART_GET_FLAG(&UartHandle,UART_FLAG_ABRF) == RESET) {}

However the UART_FLAG_ABRF flag is always reset ! so this loop is blocked!

Hello,
Your configuration is OK! However, the receiver waits for the first character on the RX line (coming from the transmitter) which should be the frame 0x7F. Then it calculates the baud and updates the BRR by hardware.
The operation's completion is signaled by ABREF flag being set to 1.

So, make sure that the frame was sent correctly by transmitter by checking the TDR register.

Kind regards,