Hi all,
I am working with the STM32F7 Disco, trying to use USART6 with CMSIS Drivers and RTOS (v1). With the ARM_USART_Control function, I can control the argument of Baud Rate, such as 9600, 115200... I had already tried on MCB1768 and it was working as expected. With the Disco board, I can send and receive bytes, but the baud rate is not correct. By instance, if I want a baud rate of 115200, the argument has to be about 10700 (this value obtained after some "scaling" tests) instead of 115200.
Do you have an idea where this is coming from?
Thank you, best regards
Xavier
There is no way to make PCLK2 16MHz if your Sysclock is 216MHz.
There are 4 clocks that can be used by USART6
PCLK2, SYSCLK, HSI, LSE
PCLK2 can be a maximum of SYSCLK DIV 2
SYSCLK is Sysclk
HSI is 16MHZ
LSE is externl...
I am pretty sure you have selected the HSI clock for for USART6 but are calculating the baud rate as if the frequency is that of PCKL2.
If the calculation thinks it is using PCLK2 (108MHz) but it is actually using HSI (16MHZ) then Baud rate would need to be adjusted by 16 / 108 ( 1 / 6.75). This is the same number as 2*16 / 216 (also 1 / 6.75)).
Pretty sure:
PCLK2 is 108MHz
Sysclk is 216MHz
The calculation for the baud rate needs to us the the actual frequency for the actual clock selected. If this happens you will no longer need to apply any kind of "fudge factor" to the Baud rate calculation.
I am not sure why it is using the PCLK2 value in the calculation when it is pretty clear the Clock Selected is the HSI clock. The default clock is PCLK2. This would need to be over written to make it different.