Set frequecy pwm

Post here all questions related to LibMaple core if you can't find a relevant section!
Post Reply
paulocapel
Posts: 1
Joined: Tue Mar 24, 2020 1:23 am

Set frequecy pwm

Post 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 ??
ag123
Posts: 1668
Joined: Thu Dec 19, 2019 5:30 am
Answers: 25

Re: Set frequecy pwm

Post 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'
stevestrong
Posts: 502
Joined: Fri Dec 27, 2019 4:53 pm
Answers: 8
Location: Munich, Germany
Contact:

Re: Set frequecy pwm

Post by stevestrong »

Have a look here: viewtopic.php?p=1752#p1752
Post Reply

Return to “General discussion”