I need to drive my h-bridges fro my motors at a freq of about 40,000Hz and also drive a servo at a freq of 50Hz
I have been driving my robot around fine using the H-bridges at 40,000Hz but I am now adding the control of a servo and when I create the PWM for the servo at 50Hz it also changes the the freq of the H-bridge freq to 50Hz which is to slow.
How can I select which timer is used for each PWM instance??
I have had to go back to old firmware as the newer versions couldn't create PWM at 50Hz
this is the firmware that I have gone back too
setting PWM timers
Re: setting PWM timers
There is a PR #8210 fixing the PWM bug not allowing frequencies below 611 Hz. It is waiting for getting approved & merged by Damien.
-
- Posts: 847
- Joined: Mon Nov 20, 2017 10:18 am
Re: setting PWM timers
Thanks.
I have found a work around for my current needs. I Found that v.16 will do a freq of 50Hz for the servo so I am using it. To be able to drive my servo and motors I stop the motors and change the freq to 50Hz then set the servo position then set duty to 0 then change the freq back to 40,000Hz for my motors then drive agaian. This way I can operate both just not at the same time.
Robert I look forward to your PR when both freq can be used at the same time and low freq can be used as well
Re: setting PWM timers
@OutoftheBOTS_ Can you share link for the work you found, it might be helpful to me as I am looking for example to work with PWM timers accessed periodically with uneven duty cycles.OutoftheBOTS_ wrote: ↑Sat Jan 29, 2022 9:51 pm
Thanks.
I have found a work around for my current needs. I Found that v.16 will do a freq of 50Hz for the servo so I am using it. To be able to drive my servo and motors I stop the motors and change the freq to 50Hz then set the servo position then set duty to 0 then change the freq back to 40,000Hz for my motors then drive agaian. This way I can operate both just not at the same time.
Robert I look forward to your PR when both freq can be used at the same time and low freq can be used as well
Re: setting PWM timers
Pwm on esp32 is now fixed.
-
- Posts: 847
- Joined: Mon Nov 20, 2017 10:18 am