Page 1 of 1

Set frequecy pwm

Posted: Tue Mar 24, 2020 2:05 am
by paulocapel
Hi, guys.
i'm noob with stm32

I have a problem. i use the library dan.drown.org and i'm not able to use the hardwaretimer.h.
wanted to change the frequency of the pwm for 25khz with variable duty cycle.

I haven't worked with the timers of stm32 yet.

library
https://github.com/rogerclarkmelbourne/ ... Serial.cpp
https://github.com/rogerclarkmelbourne/ ... reSerial.h


Can someone help me please ??

Re: Set frequecy pwm

Posted: Tue Mar 24, 2020 9:33 am
by ag123
try the examples here
http://docs.leaflabs.com/static.leaflab ... dwaretimer
duty cycle has to do with

Code: Select all

TimerX.setOverflow(Y)
http://docs.leaflabs.com/static.leaflab ... r.html#id2

cross reference RM0008 on timers
https://www.st.com/resource/en/referenc ... ronics.pdf
about output compare mode and pwm mode. the duty cycle is controlled by the capture compare register CCRx
which is the library called it the 'overflow'

Re: Set frequecy pwm

Posted: Wed Mar 25, 2020 9:29 am
by stevestrong
Have a look here: viewtopic.php?p=1752#p1752