cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F051 auto baud feature delay with StdPeriphLib

davidkoscheck9
Associate II
Posted on May 16, 2017 at 09:41

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!

#rate #stm32f0 #cube_hal #auto-baud #stdperiph_driver
1 REPLY 1
Nesrine M_O
Lead II
Posted on May 16, 2017 at 11:38

Hi

Koscheck.David

,

  • Have you try to start from ready example under the STM32 standard peripherals library :

STM32F0xx_StdPeriph_Lib_V1.5.0\Projects\STM32F0xx_StdPeriph_Examples\USART\USART_AutoBaudRate

-Nesrine-