Page 1 of 1

ESP32 C3 problems with IDF5.3

Posted: Mon Sep 16, 2024 5:26 pm
by MJU20
I've been having problems with a few things in FC10 with the ESP32 C3 (super)mini board.
I've managed to update the IDF to the latest version :

Code: Select all

Python 3.12.5
git version 2.46.0.windows.1
ESP toolchain found at "C:\Espressif\frameworks\esp-idf-v5.3\"
And this setup works for other ESP dev boards (Wroom 32 etc), but gives a lot of problems with the C3 board.

PWM does not compile (after initialisation ), interrupts don't work (after initialisation)...

Can someone please look into this?
Is this a specific C3 problem, or is it a problem with the used IDF?

Re: ESP32 C3 problems with IDF5.3

Posted: Wed Sep 18, 2024 10:19 am
by BenR
Hello,

I've just tried the C6 supermini and this is working fine with PWM. I don't currently have any C3 hardware so I'll get some on order but in the mean time i'll also look into the compile issue for you.

Re: ESP32 C3 problems with IDF5.3

Posted: Wed Sep 18, 2024 10:28 am
by BenR
It looks like the C3 has a different PWM module to all the other ESP32 devices named LEDC.

https://docs.espressif.com/projects/esp ... /ledc.html

I'll see if we can support this alternative module in the CAL code.

Re: ESP32 C3 problems with IDF5.3

Posted: Wed Sep 18, 2024 4:11 pm
by BenR
Hello,

Right hopefully this is now resolved for you with the latest library updates. I've confirmed it's working, I managed to find a C3 in my pile of ESP32 bits.

Please note the maximum period overflow for the C3 devices seems to be 16383 (14-bit) rather then the usual 65535 (16-bit).

Now to investigate interrupts. Is it specifically timers that are giving you problems?

Re: ESP32 C3 problems with IDF5.3

Posted: Wed Sep 18, 2024 10:24 pm
by MJU20
Hey BenR,

Thanks for checking this out.

The PWM Cal component has now new settings like the LEDC timers.
This compiles now, that is a great success!

I've tried several times to get an LED on pin0 to dim via the PWM signal, but can't find the right settings.

There are LEDC settings, pin settings channel settings, frequency settings etc.

Can you please post a chart that you've got working? I just want to be able to dim an LED on pin0 (or other).

The interrupt seems to be working OK now? Can't explain this last one...

Re: ESP32 C3 problems with IDF5.3

Posted: Thu Sep 19, 2024 9:30 am
by BenR
Hello,

Excellent sounds like we're making good progress.

The frequency can be whatever you like but the duty can only go from 0 to 16383.

This program uses IO pin 8 as the LED and PWM output pin.
ESP_C3_Test.fcfx
(13.54 KiB) Downloaded 546 times

Re: ESP32 C3 problems with IDF5.3

Posted: Thu Sep 19, 2024 5:34 pm
by MJU20
Thank you again BenR,

This works fine and also on other pins. Thanks!!

What I did was use the CAL_PWM component and that one doesn't work.
Can't always find out, which component I've got to use.

Re: ESP32 C3 problems with IDF5.3

Posted: Fri Sep 20, 2024 11:45 am
by BenR
Hello,

The CAL component should work too but you have to call the SetPeriod macro to setup the clock prior to enabling the channel. This is the same for most MCU families.

The top level PWM output component uses the CAL component but simply does the SetPeriod call for you inside the Enable function.

Re: ESP32 C3 problems with IDF5.3

Posted: Sat Sep 21, 2024 5:12 pm
by MJU20
Thanks, this too works!

I haven't fount a setPeriod macro so I used the changePeriod macro in the CAL PWM..

Too bad these things aren't mentioned in the Wiki pages of the component:
https://www.flowcode.co.uk/wiki/index.p ... AL)_(Misc)

For newer users this could be very handy..