2016-06-30 03:38 AM
hi
i wanna connect stm32f407discovery board to stm32f429 via uart communication. how can I calculate the closest baud rate to 5Mbps for these 2 board? I use following cod and it work but I want to be sure about minimum Error bit: USART_InitStruct.USART_BaudRate = 5000000; USART_InitStruct.USART_HardwareFlowControl = USART_HardwareFlowControl_None; USART_InitStruct.USART_Mode = USART_Mode_Tx | USART_Mode_Rx; USART_InitStruct.USART_Parity = USART_Parity_No; USART_InitStruct.USART_StopBits = USART_StopBits_1; USART_InitStruct.USART_WordLength = USART_WordLength_8b; USART_Init(USART1, &USART_InitStruct); USART_Cmd(USART1, ENABLE);2016-06-30 04:56 AM
Hi sanaz,
Please have a look to the Fractional baud rate generation paragraph in the USART section in your related reference manual to have idea on how the USARTx_BRR register is programmed and about the error calculation for programmed baud rates.-Syrine-2016-06-30 05:52 AM
5Mbps is awfully high for such an interface.
I'd divide the 5 MHz into the APB clock, create an integer and then divide that into the the APB clock, and then do a percentage of that vs the original 5,000,000 You could check that the BRR matches the number you got.The STM32 is going to favour clean division. so a 180 MHz CPU with a 90 or 45 MHz APB is going to do a lot better than a 168, 84, 42 one. I'd tend to pick system clocks that favour the outcome I want, so running the part at 160 MHz might be preferable, though it would preclude USB without a PHY