2024-01-07 09:02 AM
Hi,
I would like to understand why I don't have the right frequency on my PWM. I am working on STM32F103RG.
I would like to have a 8Khz PWM on Timer 3 channel 1, so I have configure my HSI to 8Mhz. APB2 Timer is set to 8Mhz. Prescaler to 10 and ARR to 100.
So theoretically, my frequency PWM is 8Mhz, but when I measure it, I have 7.22khz. Around 10% from 8Khz. And HSI can have around 2% tolerance so this not the problem...
Some one have this problem ? Why I can't be able to have 8Khz ?
Solved! Go to Solution.
2024-01-07 09:05 AM
You're off by one. Set PSC=9 and ARR=99.
8 MHz / (10 + 1) / (100 + 1) = 7.2 kHz
2024-01-07 09:05 AM
You're off by one. Set PSC=9 and ARR=99.
8 MHz / (10 + 1) / (100 + 1) = 7.2 kHz
2024-01-07 09:26 AM
Thanks ! Need to read datasheet careful with PSC bit !