2020-09-16 06:18 PM
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();
}
2020-09-22 01:58 AM
Hello dungeonlords789,
Thank you for your post . Issue confirmed and raised internally for correction. We will give you an update as soon as possible.
Regards,
Khouloud.
2020-10-16 11:32 AM
@Khouloud OTHMAN any questions/solutions?
2020-10-19 03:34 AM
Hello dungeonlords789,
Sorry for the inconvenience. The problem has been corrected and the fix will be available in the next release.
Thanks for your patience.
Regards,
Khouloud.
2021-02-24 04:40 PM
Any news? @Khouloud OTHMAN
2021-02-25 01:22 AM
Hi @dungeonlords789 ,
Actually this issue has been fixed in the STM32CubeMX version 6.1.0. Did you try with the latest STM32CubeMX version ?
Khouloud.
2021-03-21 04:42 PM
Now I use pack 1.16.1
and I try to use UART5 on my stm32f767
I select autobauderate:
Than I connect stm32f767 to my uart device with 9600 baud. I transmit 'U'. But I am going to Error_Handler.
if (__HAL_UART_GET_FLAG(&huart5, UART_FLAG_ABRE)!= RESET){
Error_Handler();
}
I try to understand what happend and I find MX_UART5_Init with
huart5.Init.BaudRate = 115200;
Yes, I did not set baud! Why CubeIDE generate 115200? And why it is important? When I set 9600 on my prog no Error_Handler()!
2021-03-21 05:17 PM
2021-03-23 03:44 PM
I also find very interesting code in stm32f767xx.h. Does UART5 support auto baud? How check it? I can't see list of supported UART in stm32f76xx datasheet and AN4908 Rev 2 is very old (no stm32f767)...
/****************** UART Instances : Auto Baud Rate detection ****************/
#define IS_USART_AUTOBAUDRATE_DETECTION_INSTANCE(__INSTANCE__) (((__INSTANCE__) == USART1) || \
((__INSTANCE__) == USART2) || \
((__INSTANCE__) == USART3) || \
((__INSTANCE__) == USART6))
@Imen DAHMEN
2021-07-18 04:48 AM
@Khouloud OTHMAN