MCPWM module (Changing the Speed of the motor)

Jqn.be
Posts: 1
Joined: Wed May 22, 2024 2:12 pm

MCPWM module (Changing the Speed of the motor)

Postby Jqn.be » Wed May 22, 2024 2:39 pm

Dear Community,

I am trying to implement Mcpwm funcionality to my ESP32 Wroom. Currently I try to understand the included headerfiles for mcpwm for ESP-IDF 5.2.1. I uploaded the example Code from
https://github.com/espressif/esp-idf/bl ... ple_main.c
, simulated the Hallsensor values and changed the gpios for PWM to my desire. I hooked up the PWM outputs and got the predicted sinusodial PWM. My Question is, how do I modulate the frequency of this PWM signal to controll the motor speed. In the example code is mentioned, that the "update_motor_speed_callback()" function should be used for this case. Wich values should be given to the function and how do they affect the frequency?
I have search for a suitable solution for this problem for days and it seems like I am not alone with being confused about how to controll the frequency in esp-idf v5.
I would be happy to receive feedback to this topic! Thanks!

MicroController
Posts: 1704
Joined: Mon Oct 17, 2022 7:38 pm
Location: Europe, Germany

Re: MCPWM module (Changing the Speed of the motor)

Postby MicroController » Fri May 24, 2024 7:33 pm

Seems like all you'd have to do to change the speed is here: https://github.com/espressif/esp-idf/bl ... ain.c#L173

Who is online

Users browsing this forum: akasaka_spk and 71 guests