Hi all,
Serial communication with baudrate 300 not working, why? Pls Help me
Hi all,
Serial communication with baudrate 300 not working, why? Pls Help me
Have a look at RM0008.pdf under the title "fractional baud rate generation", there it's written how the baud rate is configured:
Tx/Rx baud rate = fck / (16 * USARTDIV)
USARTDIV is a 12.4 fixed point number, it's maximal value therefore is 0xfff.f = 4095.9.
In the default configuration of the Maple boards, fck1=72e6 Hz for USART1 and fck2=36e6 Hz for USART2+3.
The minimal baud rate therefore is 1098.6 Hz for USART1 and 549.32 Hz for USART2,3.
If you want to go lower, you have to lower the clock rates fck1,2 of the MCU.
You may achieve this by changing the RCC_PRESCALERS in function "board_setup_clock_prescalers" in "libmaple/wirish/stm32f1/board_setup.cpp".
thx. I used maple 0.0.12 ide. Where do i change RCC_PRESCALERS? What value is set for 300baud? very thx
I don't use the ide, but the clock prescalers and multipliers seem to be set in function "setupClocks" in:
maple-ide-v0.0.12/hardware/leaflabs/cores/maple/boards.cpp
thx very much, it's works fine.
You must log in to post.