Electronic – the AHB1 clock rate

armclock-speedembedded

I am working with an ARM Cortex M3 chip (reference manual available here). I'm trying to get the baud rate of my USART communications right. Reading pages 613 onwards, I understand that the value I should set for USARTDIV depends on the clock rate of AHB1 (since I am working with USART3, governed by the AHB1 clock).

Looking at pages 614 onwards, I see that the clock rate f_PCLK can take many different values (8MHz, 12Mhz, etc.). However, I cannot see anywhere where I can set the speed of that clock.

How can I measure/change/read the speak of the AHB1 clock?

Best Answer

Page 83 of the reference manual has a clock tree diagram. This will help you see where the clocks come from.

The PCLK is a peripheral clock and will depend on the clock source and the prescaler values. The AHB, APB and other prescaler values are set in the system_stm32f2xx.c file.