AnsweredAssumed Answered

STM32L4 uart wrong init order

Question asked by Till Rachow on Apr 24, 2018

Hi Dev Team,


I found a bug in the HAL_UART_Init function provided by the above library. The advanced features are applied with UART_AdvFeatureConfig after the standard features are applied with UART_SetConfig.
I configured my TX Pin to invert its active level, this is one of the advanced features.
So if you run HAL_UART_Init, the TX pin will be set high in UART_SetConfig as this is IDLE level for UART. After that, the TX pin will be set low in UART_AdvFeatureConfig, as the inverted IDLE level is of course low.
This leads to a high-spike of a few us on the TX line, that needs to be low for my application.
Running UART_AdvFeatureConfig before UART_SetConfig fixes this, the TX pin will never be high.

Maybe you guys could consider calling the UART_AdvFeatureConfig before UART_SetConfig? Maybe the same also applies for other peripherals..