2012-12-12 06:27 AM
Hi
I've connected my ST32F4 Recovery to PC by USB connection. I create this function to display message to minicom 2.5.int
PUTC(
int
ch)
{
/* Loop until transmit data register is empty */
while
(USART_GetFlagStatus(USART2, USART_FLAG_TXE) == RESET);
USART_SendData(USART2, (uint8_t) ch);
return
ch;
}
void
PUTS(
char
*str)
{
char
c;
while
((c = *str++) !=
'\0'
)
PUTC(c);
}
It works because i choose the BaudRate Value = 921600*3.
usart_init.USART_BaudRate = 921600*3;
But if i change this BaudRate it doesn't works.
Do you know why it works only with this value ?
And how it is calculated?
Excuse me for for question but I'm a beginner.
thanks
2012-12-12 08:29 AM
Most baud rate issues with STM32 projects occur because of a disagreement between what the HSE physically is, and what HSE_VALUE is defined as in software.
The STM32F4-Discovery has an 8 MHz HSE, other boards, and the presumed default for HSE_VALUE is often 25000000 25/8 = 3.125 Make sure your compiler/toolchain pass in a HSE_VALUE define of 8000000. Make sure that you system_stm32f4xx.c has/uses the appropriate PLL and HSE settings.2012-12-13 09:06 AM
Yes exactly
HSE_VALUE
is
a constant defined
in
stm32f4xx.h file (
default
value 25 MHz)
HSE Frequency(Hz) = 8000000
I don't understand yet my
BaudRate = 921600*3
= 2
'
764'800 baudhow is it calculated
?
thanks
2012-12-13 10:08 AM
I'm not sure of you exact situation, or how you are using/testing different baud rates.
The library computes a baud rate divider setting based on internal/external clocks, pll settings, and bus dividers. Having the right HSE_VALUE ensures the math comes up with the right answer.