2015-09-25 03:38 AM
The Code (generated by mxcube)
void MX_USART6_UART_Init(void)
{
huart6.Instance = USART6;
huart6.Init.BaudRate = 3000000;
huart6.Init.WordLength = UART_WORDLENGTH_8B;
huart6.Init.StopBits = UART_STOPBITS_1;
huart6.Init.Parity = UART_PARITY_NONE;
huart6.Init.Mode = UART_MODE_TX_RX;
huart6.Init.HwFlowCtl = UART_HWCONTROL_NONE;
huart6.Init.OverSampling = UART_OVERSAMPLING_16;
HAL_UART_Init(&huart6);
}
do not set the BRR register correct.
With PCLK1 = 42MHz and PCLK2 = 84MHz
Brr is 0x1C
If i change the code from
#define UART_BRR_SAMPLING8(_PCLK_, _BAUD_) ((UART_DIVMANT_SAMPLING8((_PCLK_), (_BAUD_)) << 4)|(UART_DIVFRAQ_SAMPLING8((_PCLK_), (_BAUD_)) & 0x0F))
to
#define UART_BRR_SAMPLING8(_PCLK_, _BAUD_) ((UART_DIVMANT_SAMPLING8((_PCLK_), (_BAUD_)) <<
4
)|((UART_DIVFRAQ_SAMPLING8((_PCLK_), (_BAUD_)) & 0x0F)>>1))
Brr is 0x16
Can some one fix this bug.
#stm32f4-uart-brr-sampling-8
2016-03-11 04:12 AM
Hi bruenig.dirk,
The issue of the wrong BRR calculation in oversampling by 8 is fixed in firmware package STM32CubeF4 V1.11.0.Thank you very much for your contribution to the enhancement of our STM32 related solutions.-Syrine-