cancel
Showing results for 
Search instead for 
Did you mean: 

PWM frequency, I do not get the expected values​​, why?

orn
Associate II
Posted on October 12, 2012 at 12:53

 

 

The original post was too long to process during our migration. Please click on the attachment to read the original post.
4 REPLIES 4
Posted on October 12, 2012 at 13:30

Doesn't sound like you're running at 168 MHz. Make sure HSE_VALUE is correct.

You could also address your fractional problems by picking better factors.

TIM_TimeBaseStructure.TIM_Period
= 

2000-1

;

TIM_TimeBaseStructure.TIM_Prescaler
= 

0

;
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
orn
Associate II
Posted on October 12, 2012 at 16:10

Clive a thousand thanks! :D

Your help has saved me many times! :D

I solved it by changing the value in the file PLL_N system_stm32f4xx.c

PLL_VCO = (HSE_VALUE or HSI_VALUE / PLL_M) * PLL_N

I'm new in the world of microcontrollers, and still do not understand things very well!

you could tell me where I learn the meaning of PLL_VCO and PLL_N? oh maybe give me a brief explanation? thanks again for all your help!

Posted on October 12, 2012 at 17:33

VCO stands for Voltage Controlled Oscillator, it runs very fast and is tuned up/down with a control voltage generated by a phase comparator. The comparison frequency for STM32F4 parts should fall in the 1-2 MHz range, your input source (aka reference) is divided down by PLL_M, the VCO clock is divided down by PLL_N. The comparison of phase acts as a feedback loop of the PLL (Phase Locked Loop)

Lock occurs when the control voltage, and the VCO, stabilize.

PLL_P is a used to divide the VCO clock as an input into the CPU, typically at least 2 so that the processor has a symmetrical clock (ie 50/50 duty).
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
orn
Associate II
Posted on October 13, 2012 at 16:36

very kind :D thanks