cancel
Showing results for 
Search instead for 
Did you mean: 

Incorrect code generation for UART5 of F767

dungeonlords789
Senior III

I generate code for stm32f767. I use software package 1.16.0 I want to use UART5 in auto baud mode via 0x55 symbol. And USART3 the same. Why code is different?

static void MX_UART5_Init(void){
 /* USER CODE BEGIN UART5_Init 0 */
 /* USER CODE END UART5_Init 0 */
 /* USER CODE BEGIN UART5_Init 1 */
 /* USER CODE END UART5_Init 1 */
 huart5.Instance = UART5;
 huart5.Init.BaudRate = 115200;
 huart5.Init.WordLength = UART_WORDLENGTH_9B;
 huart5.Init.StopBits = UART_STOPBITS_1;
 huart5.Init.Parity = UART_PARITY_EVEN;
 huart5.Init.Mode = UART_MODE_TX_RX;
 huart5.Init.HwFlowCtl = UART_HWCONTROL_NONE;
 huart5.Init.OverSampling = UART_OVERSAMPLING_16;
 huart5.Init.OneBitSampling = UART_ONE_BIT_SAMPLE_DISABLE;
 huart5.AdvancedInit.AdvFeatureInit = UART_ADVFEATURE_NO_INIT;//wtf? ABRMOD0 and ABRMOD1 and ABREN will be 0
 huart5.AdvancedInit.AutoBaudRateMode = UART_ADVFEATURE_AUTOBAUDRATE_ON0X55FRAME;
 
 if (HAL_UART_Init(&huart5) != HAL_OK){
   Error_Handler();
 }
 
 /* USER CODE BEGIN UART5_Init 2 */
 /* USER CODE END UART5_Init 2 */
}

This is ok code for USART3:

static void MX_USART3_UART_Init(void){
 /* USER CODE BEGIN USART3_Init 0 */
 /* USER CODE END USART3_Init 0 */
 /* USER CODE BEGIN USART3_Init 1 */
 /* USER CODE END USART3_Init 1 */
 
 huart3.Instance = USART3;
 
 huart3.Init.BaudRate = 115200;
 
 huart3.Init.WordLength = UART_WORDLENGTH_9B;
 
 huart3.Init.StopBits = UART_STOPBITS_1;
 
 huart3.Init.Parity = UART_PARITY_EVEN;
 
 huart3.Init.Mode = UART_MODE_TX_RX;
 
 huart3.Init.HwFlowCtl = UART_HWCONTROL_NONE;
 
 huart3.Init.OverSampling = UART_OVERSAMPLING_16;
 
 huart3.Init.OneBitSampling = UART_ONE_BIT_SAMPLE_DISABLE;
 
 huart3.AdvancedInit.AdvFeatureInit = UART_ADVFEATURE_AUTOBAUDRATE_INIT;//looks ok
 
 huart3.AdvancedInit.AutoBaudRateEnable = UART_ADVFEATURE_AUTOBAUDRATE_ENABLE;
 
 huart3.AdvancedInit.AutoBaudRateMode = UART_ADVFEATURE_AUTOBAUDRATE_ON0X55FRAME;
 
 if (HAL_UART_Init(&huart3) != HAL_OK)
 
 {
 
   Error_Handler();
 
 }

10 REPLIES 10

@Jocelyn RICARD​ @Frantz LEFRERE​ any news?