Support for esp32 c3

Is there any support plan for esp32 c3?

There is no current plan to bring support to it, but it might be possible using the LED PWM peripheral since they got rid of the MCPWM unit on the C3 version.

It may be possible. At 40MHz (max PWM frequency) the duty drops to 1 bit. You would need at least 20MHz (2 bits resolution, ridiculous) to reliably drive three mosfets, else the noise will be audible and impractical.


Supported Range of Frequency and Duty Resolutions
The LED PWM Controller is designed primarily to drive LEDs. It provides a large flexibility of PWM duty cycle settings.
The LEDC API is designed to report an error when trying to set a frequency and a duty resolution that exceed the range of LEDC’s hardware. For example, an attempt to set the frequency to 20 MHz and the duty resolution to 3 bits will result in the following error reported on a serial monitor:

E (196) ledc: requested frequency and duty resolution cannot be achieved, try reducing freq_hz or duty_resolution. div_param=128

In such a situation, either the duty resolution or the frequency must be reduced. For example, setting the duty resolution to 2 will resolve this issue and will make it possible to set the duty cycle at 25% steps, i.e., at 25%, 50% or 75%.
Reference: LED Control (LEDC) - ESP32-C3 - — ESP-IDF Programming Guide latest documentation

Are you thinking of 20 kHz?

My first ESP32 implementation with SimpleFOC was with LEDC a long time ago.

Typo. I think. Hold on, I may have read the docs incorrectly.

I read the actual documentation (PDF). It is possible to do it, and most importantly it is possible to change it on the fly. I’m modifying the post above.

That’s actually good news because I was always under the impression the LED PWM was handicapped and the frequency fixed and could not be gradually changed. Also, C3 has 6 PWM which is sufficient for the three phases.

Nice. Thanks.


PS Also JLC / EASYEDA have it available for SMD and it’s in stock. Perhaps I could test out a dev board to see if it’s feasible to be assembled.

PS2 This chip is really small… I mean not enough pins. You may be able to squeeze some functionality out of it but you need 6 pins for PWM, 4 pins for SPI or hall sensors, 2 pins for serial or I2C control. Looking at the specs, it is possible but you will need a dedicated board for that. The one at JLC has 15 pins, and it will require a development board to be created to test the functionality, which means a hardware development effort, too.

If you want to try it out, check out:


The plan is definately to integrate this code, just need to get round to it…

1 Like