2019-09-17 09:19 PM
STM32CubeMX : Version 5.3.0
Package : STM32CubeF1 Firmware Package V1.8.0
Project Settings : Toolchain / IDE = TrueSTUDIO
MCU : STM32F103C8Tx
USART1 > Mode = Single Wire (Half-Duplex) > Pin usage PB6
Lib : LL
In USART1 GPIO Configuration section of USART1 Initialization Function Generate the following code :
/**USART1 GPIO Configuration
PB6 ------> USART1_TX
*/
GPIO_InitStruct.Pin = LL_GPIO_PIN_6;
GPIO_InitStruct.Mode = LL_GPIO_MODE_ALTERNATE;
GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_MEDIUM;
GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_OPENDRAIN;
LL_GPIO_Init(GPIOB, &GPIO_InitStruct);
LL_GPIO_AF_EnableRemap_USART1();
When the program runs to LL_GPIO_AF_EnableRemap_USART1(), it will cause PB6 to issue a pull-down pulse, which will cause trouble to the UART receiver.
This problem can be ruled out by call LL_GPIO_AF_EnableRemap_USART1() before LL_GPIO_Init().