AnsweredAssumed Answered

STM32F051 auto baud feature delay with StdPeriphLib

Question asked by Koscheck.David on May 16, 2017
Latest reply on May 16, 2017 by Nesrine M

I'm trying to use auto baud feature on STM32F051 with STM32F0xx_StdPeriphLib drivers (V1.5.0) to adjust my baud rate to sync-bytes that I receive from another MCU over UART1.

The relevant code looks like that:

 

/* UART1 already configured and running */

 USART_Cmd(USART1, DISABLE);
 USART_AutoBaudRateConfig(USART1, USART_AutoBaudRate_StartBit); 
 USART_AutoBaudRateCmd(USART1, ENABLE);
 USART_Cmd(USART1, ENABLE);

 

The procedure itself works fine, however I encounter delays of ~17 milliseconds until the baud rate adjustment is completed (until UART_FLAG_ABRF becomes set). This delay stays the same no matter how many sync-bytes are sent from the other device during this period.

 

I tried to use Cuba_Hal Lib for comparison with the following code (taken from an ST example):

 

huart1.AdvancedInit.AdvFeatureInit = UART_ADVFEATURE_AUTOBAUDRATE_INIT;
huart1.AdvancedInit.AutoBaudRateEnable = UART_ADVFEATURE_AUTOBAUDRATE_ENABLE;

huart1.AdvancedInit.AutoBaudRateMode = UART_ADVFEATURE_AUTOBAUDRATE_ONSTARTBIT;

if (HAL_UART_Init(&huart1) != HAL_OK)
{
    /* Initialization Error */
    Error_Handler();
}

 

With this code the auto baud procedure is completed in under 1ms.

 

Does anybody know why this delay occurs with StdPeriphLib and how I can fix it?

 

Many thanks in advance!

Outcomes