Bug when starting a UART port with UART inversion enabled on STM32303 and STM32F722
Hello ST
I have a project where I need to start and stop the UART during runtime, and I have noticed a possible bug in the stm32f3xx_hal_uart.c file.
The issue is that when initializing the UART to use the UART_ADVFEATURE_TXINVERT_INIT parameter, the Tx pin goes high for a very short time (~10us). I suspected that it was because the inversion of the pin took place after the UART was started, and i did some digging in the HAL code.
By setting the breakpoints as above, i concluded that the signal that was on the Tx pin was high after UART_SetConfig was called, and it went low again after UART_AdvFeatureConfig was called. This seems to me that the pin goes high (UART Idle), before the inversion takes place (UART idle low after inversion).
The Tx pin viewed under an oscilloscope where the code is initializing and deinitializing the UART every ~100ms, resulted in a consistent voltage spike.
I tried to confirm my suspicion by swapping the order the two functions were called, so the inversion took place before setting the config, and that seemed to fix the issue.
To check if it was a hardware specific issue, i also checked on an STM32F722, and the behavior was the same.
Uart parameters used:
BAUD: 100000
Databits: 8
Stopbits: 2
Parity: even
Tx inversion: enabled
HAL version on stm32f303: V1.5.6
