microbuilder / LPC810_CodeBase

Open source code base for the ARM Cortex M0+ LPC810 family from NXP
85 stars 43 forks source link

uart0Init baudrate calculation fails if SYSAHBCLKDIV not 1 #1

Closed kimmoli closed 11 years ago

kimmoli commented 11 years ago

Currently in function uart0Init the clk -value is calculated from SystemCoreClock.

SystemCoreClock is main clock divided by SYSAHBCLKDIV. If i use PLL or higher main clock so that i need to set SYSAHBCLKDIV > 1 , the clk is calculated wrongly resulting in higher baudrate as desired.

clk should be calculated from main clock rate e.g. __MAIN_CLOCK as the main clock is used for USART fractional divider (UM10601 Fig 27)

cpldcpu commented 11 years ago

This should be fixed in my pull request.