AnsweredAssumed Answered

Keil, initial clock configuration.

Question asked by jargin.matt on Nov 10, 2012
Latest reply on Nov 11, 2012 by Clive One
I'm writing my own USART code to work with USART1. I need to know what the start-up code that keil gives you sets the clock initially at. I can change it manually but id like to know where the code is. Also USART1 is running off of APB2 clock, how do I figure out what the clock speed is so I can figure out what I should write in the USART_BRR register? 

As I understand it, APBx clock comes from the system clock (HSI,HSE,PLL), then through AHB prescaler (if is has one) then through the APBx prescaler. Is this correct? 

I would like to edit the keil start up code to enable the HSI with PLL to make system clock 168Mhz, then have APB2 clock run at 12Mhz (There is a table for BRR register at this speed). 

I'm using the system_stm32f4xx.c and startup_stm32f4xx.c.

Thanks for the advise.

Outcomes