cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F4 APB1 Prescaling Issue

jono-tree
Associate II
Posted on April 19, 2014 at 10:54

Hi all,

I'm curious about prescaling APB1 for the STM32F4. I'm building a triangle wave generator and frequency meter, for which it is conveniant for me to have a high as possible clock frequency for Timers 4 and 6. Therefore I've been playing with the APB1 prescaler (ie bits 12:10 of RCC_CFGR).

I have a function adapted from the STM DAC output example which produces a triangle wave, using TIM6 as its clock base. I've got a function written so I can basically get any frequency in the range 1Hz to 166kHz.

By default (according to my

system_stm32f4xx.c

) the APB1 has a prescaler of 4 from a HCLK which I happen to know is running at 168MHz. When I change the APB1 prescaler to 2, my output frequency accordingly doubles. When I try to change it 1 however, it just prescales it to 2.

Then I noticed the ref manual (RM0090) says you can't prescale the APB1 below 42MHz which kind of explains it, but doesnt explain why it manages to prescale the APB1 by a value of 2 when its initially 42MHz .Any thoughts about this, anyone with experience prescaling APB1?

Thanks,

Jonathan

#stm32f4 #apb1 #prescaler
1 REPLY 1
Posted on April 19, 2014 at 13:18

Read the manual carefully.

1. You should not set APB1clock to more than 42MHz.

2. If the prescaler is 1, the *timers'* clock is equal to APB clock; if the prescaler is 2 and more, the timers' clock is twice the APB clock.

JW