Core/Src/main.c
static void MX_USART3_UART_Init(void)
{

  /* USER CODE BEGIN USART3_Init 0 */

  /* USER CODE END USART3_Init 0 */

  LL_USART_InitTypeDef USART_InitStruct = {0};

  LL_GPIO_InitTypeDef GPIO_InitStruct = {0};

  /* Peripheral clock enable */
  LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_USART3);

  LL_AHB4_GRP1_EnableClock(LL_AHB4_GRP1_PERIPH_GPIOD);
  /**USART3 GPIO Configuration
  PD8   ------> USART3_TX
  PD9   ------> USART3_RX
  */
  GPIO_InitStruct.Pin = LL_GPIO_PIN_8|LL_GPIO_PIN_9;
  GPIO_InitStruct.Mode = LL_GPIO_MODE_ALTERNATE;
  GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_LOW;
  GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL;
  GPIO_InitStruct.Pull = LL_GPIO_PULL_NO;
  GPIO_InitStruct.Alternate = LL_GPIO_AF_7;
  LL_GPIO_Init(GPIOD, &GPIO_InitStruct);

  /* USART3 interrupt Init */
  NVIC_SetPriority(USART3_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(),1, 0));
  NVIC_EnableIRQ(USART3_IRQn);

  /* USER CODE BEGIN USART3_Init 1 */

  /* USER CODE END USART3_Init 1 */
  USART_InitStruct.PrescalerValue = LL_USART_PRESCALER_DIV1;
  USART_InitStruct.BaudRate = 2000000;
  USART_InitStruct.DataWidth = LL_USART_DATAWIDTH_8B;
  USART_InitStruct.StopBits = LL_USART_STOPBITS_1;
  USART_InitStruct.Parity = LL_USART_PARITY_NONE;
  USART_InitStruct.TransferDirection = LL_USART_DIRECTION_TX_RX;
  USART_InitStruct.HardwareFlowControl = LL_USART_HWCONTROL_NONE;
  USART_InitStruct.OverSampling = LL_USART_OVERSAMPLING_16;
  LL_USART_Init(USART3, &USART_InitStruct);
  LL_USART_SetTXFIFOThreshold(USART3, LL_USART_FIFOTHRESHOLD_1_8);
  LL_USART_SetRXFIFOThreshold(USART3, LL_USART_FIFOTHRESHOLD_1_8);
  LL_USART_DisableFIFO(USART3);
  LL_USART_ConfigAsyncMode(USART3);

  /* USER CODE BEGIN WKUPType USART3 */

  /* USER CODE END WKUPType USART3 */

  LL_USART_Enable(USART3);

  /* Polling USART3 initialisation */
  while((!(LL_USART_IsActiveFlag_TEACK(USART3))) || (!(LL_USART_IsActiveFlag_REACK(USART3))))
  {
  }
  /* USER CODE BEGIN USART3_Init 2 */
    LL_USART_EnableIT_RXNE_RXFNE(USART3);
  /* USER CODE END USART3_Init 2 */

}
/**
  * @brief USART3 Initialization Function
  * @param None
  * @retval None
  */
@brief USART3 Initialization Function
@param None
@retval None
@brief USART3 Initialization Function @param None @retval None
static void MX_USART3_UART_Init(void)
{
  LL_USART_InitTypeDef USART_InitStruct = {0};
  LL_GPIO_InitTypeDef GPIO_InitStruct = {0};
  LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_USART3);
  LL_AHB4_GRP1_EnableClock(LL_AHB4_GRP1_PERIPH_GPIOD);
  GPIO_InitStruct.Pin = LL_GPIO_PIN_8|LL_GPIO_PIN_9;
  GPIO_InitStruct.Mode = LL_GPIO_MODE_ALTERNATE;
  GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_LOW;
  GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL;
  GPIO_InitStruct.Pull = LL_GPIO_PULL_NO;
  GPIO_InitStruct.Alternate = LL_GPIO_AF_7;
  LL_GPIO_Init(GPIOD, &GPIO_InitStruct);
  NVIC_SetPriority(USART3_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(),1, 0));
  NVIC_EnableIRQ(USART3_IRQn);
  USART_InitStruct.PrescalerValue = LL_USART_PRESCALER_DIV1;
  USART_InitStruct.BaudRate = 2000000;
  USART_InitStruct.DataWidth = LL_USART_DATAWIDTH_8B;
  USART_InitStruct.StopBits = LL_USART_STOPBITS_1;
  USART_InitStruct.Parity = LL_USART_PARITY_NONE;
  USART_InitStruct.TransferDirection = LL_USART_DIRECTION_TX_RX;
  USART_InitStruct.HardwareFlowControl = LL_USART_HWCONTROL_NONE;
  USART_InitStruct.OverSampling = LL_USART_OVERSAMPLING_16;
  LL_USART_Init(USART3, &USART_InitStruct);
  LL_USART_SetTXFIFOThreshold(USART3, LL_USART_FIFOTHRESHOLD_1_8);
  LL_USART_SetRXFIFOThreshold(USART3, LL_USART_FIFOTHRESHOLD_1_8);
  LL_USART_DisableFIFO(USART3);
  LL_USART_ConfigAsyncMode(USART3);
  LL_USART_Enable(USART3);
  while((!(LL_USART_IsActiveFlag_TEACK(USART3))) || (!(LL_USART_IsActiveFlag_REACK(USART3))))
  {
  }
    LL_USART_EnableIT_RXNE_RXFNE(USART3);
}
static void MX_USART3_UART_Init ( void ) { LL_USART_InitTypeDef USART_InitStruct = { 0 } ; LL_GPIO_InitTypeDef GPIO_InitStruct = { 0 } ; LL_APB1_GRP1_EnableClock ( LL_APB1_GRP1_PERIPH_USART3 ) ; LL_AHB4_GRP1_EnableClock ( LL_AHB4_GRP1_PERIPH_GPIOD ) ; GPIO_InitStruct . Pin = LL_GPIO_PIN_8 | LL_GPIO_PIN_9 ; GPIO_InitStruct . Mode = LL_GPIO_MODE_ALTERNATE ; GPIO_InitStruct . Speed = LL_GPIO_SPEED_FREQ_LOW ; GPIO_InitStruct . OutputType = LL_GPIO_OUTPUT_PUSHPULL ; GPIO_InitStruct . Pull = LL_GPIO_PULL_NO ; GPIO_InitStruct . Alternate = LL_GPIO_AF_7 ; LL_GPIO_Init ( GPIOD , & GPIO_InitStruct ) ; NVIC_SetPriority ( USART3_IRQn , NVIC_EncodePriority ( NVIC_GetPriorityGrouping ( ) , 1 , 0 ) ) ; NVIC_EnableIRQ ( USART3_IRQn ) ; USART_InitStruct . PrescalerValue = LL_USART_PRESCALER_DIV1 ; USART_InitStruct . BaudRate = 2000000 ; USART_InitStruct . DataWidth = LL_USART_DATAWIDTH_8B ; USART_InitStruct . StopBits = LL_USART_STOPBITS_1 ; USART_InitStruct . Parity = LL_USART_PARITY_NONE ; USART_InitStruct . TransferDirection = LL_USART_DIRECTION_TX_RX ; USART_InitStruct . HardwareFlowControl = LL_USART_HWCONTROL_NONE ; USART_InitStruct . OverSampling = LL_USART_OVERSAMPLING_16 ; LL_USART_Init ( USART3 , & USART_InitStruct ) ; LL_USART_SetTXFIFOThreshold ( USART3 , LL_USART_FIFOTHRESHOLD_1_8 ) ; LL_USART_SetRXFIFOThreshold ( USART3 , LL_USART_FIFOTHRESHOLD_1_8 ) ; LL_USART_DisableFIFO ( USART3 ) ; LL_USART_ConfigAsyncMode ( USART3 ) ; LL_USART_Enable ( USART3 ) ; while ( ( ! ( LL_USART_IsActiveFlag_TEACK ( USART3 ) ) ) || ( ! ( LL_USART_IsActiveFlag_REACK ( USART3 ) ) ) ) { } LL_USART_EnableIT_RXNE_RXFNE ( USART3 ) ; }
@brief USART3 Initialization Function
 @param None
 @retval None
@brief USART3 Initialization Function @param None @retval None
/* USER CODE BEGIN USART3_Init 0 */ /* USER CODE END USART3_Init 0 */ /* Peripheral clock enable */ /**USART3 GPIO Configuration
  PD8   ------> USART3_TX
  PD9   ------> USART3_RX
  */ /* USART3 interrupt Init */ /* USER CODE BEGIN USART3_Init 1 */ /* USER CODE END USART3_Init 1 */ /* USER CODE BEGIN WKUPType USART3 */ /* USER CODE END WKUPType USART3 */ /* Polling USART3 initialisation */ /* USER CODE BEGIN USART3_Init 2 */ /* USER CODE END USART3_Init 2 */