cancel
Showing results for 
Search instead for 
Did you mean: 

Issue when generating PWM on STM32F769

vamshi_kumar
Associate II

Hello Team,

 I am using stm32f769 controller. I am using timer 1 channel 4 for pwm output, and my APB1 clock is 180MHZ here I am taking prescaler : 17999 and ARR=1999 and ccr=1000 for this values I can see output of pwm by generating 5hz pulses. But when I want to generate 486 pulses where my psc:17999 , ARR=19, ccr=10, I cant see any output pulses, my pwm is not responding. 

(ARR+1)(psc+1)=180MHZ/frequency

(ARR+1)(psc+1)=180MHZ/486

(ARR+1)(psc+1)= 370370

ARR+1=370370/18000

ARR+1=20

ARR=19

 

for some values upto ARR= 40 i am getting output over pwm but from values ARR=20 i am not getting output

could you please help me

 

Thanks

vamshi kumar

5 REPLIES 5
TDK
Super User

There's nothing wrong with what you've presented.

There is likely a bug in your code or a misinterpretation of how you are interpreting results.

Ensure the pin speed is set to VERY_HIGH.

If you feel a post has answered your question, please click "Accept as Solution".
Gyessine
ST Employee

Hello @vamshi_kumar 
just to be sure, do you mean 486pulses/second right?
And based on F769 datasheet

TIM1 is linked to APB2 not APB1, so can you precise your APB2 timer clocks frequency?
and are you sure that your frequency is 180MHZ
because APB1 max frequency is set to 54MHZ and APB2 is 108MHZ

Gyessine_0-1770047884665.png

BR
Gyessine

 

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Hello Gyessine,

Sorry there I have mentioned APB1 instead of APB2. so my timer1 channel4 is connected on APB2 which is running at 180MHZ.

vamshi_kumar_0-1770096247416.png

for lower frequency pwm is generating the required pulses which i can observe using captures when the frequency is getting increased I am not getting capture interrupt.

 

could you please help me.

 

Thanks

Gyessine
ST Employee

Hello @vamshi_kumar 
I attempted to replicate your case and honestly, I did not encounter the issue you described.
I set PSC to 17999 and ARR to 19, and I obtained a 500 Hz signal, which is the expected result for this configuration, not 486 Hz.

Gyessine_0-1770109614997.png

I can attach the project if you want to test it.
You can track the PWM signal from PA11 by using a logic analyzer or an oscilloscope.
If the problem still persists on your side, try configuring PSC to 999 and ARR to 369.
With a 180 MHz frequency, this combination also produces a 486 Hz signal.
BR
Gyessine



To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

If I understand correctly, you are not monitoring the timer output with an oscilloscope, but are using another timer for this purpose. It is very likely that the error lies in the way you are detecting the timer output.

Check the timer output with an oscilloscope.

If you do not have one, you can also check it with a simple low-pass filter (RC circuit) with a multimeter at the output.

Another option is to set the DBG_TIM1_STOP bit in the DBGMCU_APB2_FZ register, which will ensure that the timer does not run when the program is paused. When you run and pause the program in the debugger and monitor the ODR or IDR register of your port, you can see if the state of the pin changes.