Can the ESP32 do SPWM (Sinusoidal PWM)

mikemoy
Posts: 626
Joined: Fri Jan 12, 2018 9:10 pm

Can the ESP32 do SPWM (Sinusoidal PWM)

Postby mikemoy » Sun May 26, 2019 1:08 pm

I would like to start learning to play with SPWM (Sinusoidal PWM) to generate a sine wave via PWM to control a 3 phase DC brushless motor. I would like to try to mimic what others have done using an Atmel micro. Like this one.
https://github.com/Terbytes/Arduino-Atmel-sPWM

Annotation 2019-05-26 080336.jpg
Annotation 2019-05-26 080336.jpg (50.67 KiB) Viewed 7968 times


I have tried the MCPWM BLDC motor control example just to get all the hardware proved out.
https://github.com/espressif/esp-idf/tr ... dc_control

Atmel has OCRxA & OCRxB registers (Output Compare Register), which (unless I am wrong) the ESP32 does not. So I am trying to figure out a way to overcome this. The second thing that has me wondering if this is even possible is that the ESP32 is running the RTOS which is great but not really geared towards this kind of thing, so I am not sure if this is something I should even bother with doing because of the latency issues.

Anyone have any thoughts about this?

KlausKleister
Posts: 1
Joined: Wed Jul 10, 2019 7:00 pm

Re: Can the ESP32 do SPWM (Sinusoidal PWM)

Postby KlausKleister » Wed Jul 10, 2019 7:04 pm

Hi, i would like to do the exact same thing. I want to drive a dc motor with a damped sine function. Did you have any success?
Im am a total newbie btw but i need this for my thesis.

mikemoy
Posts: 626
Joined: Fri Jan 12, 2018 9:10 pm

Re: Can the ESP32 do SPWM (Sinusoidal PWM)

Postby mikemoy » Thu Jul 11, 2019 2:03 am

Nope, just wound up using the BLDC example with some tweaking.

Who is online

Users browsing this forum: Bing [Bot] and 125 guests