ESP32 core version 3.x.x has some “breaking changes”

Last week Espressif announced the release of version 3.0.0 of the ESP32 core.

The new core version has a different URL, so won’t appear as an upgrade option in the Arduino IDE’s Board Manager unless you change the URL used in the “Additional Board Manager URLs” section.

But, before you rush out and do this, you should carry-on reading…

The Espressif announcement says:

The new Arduino ESP32 core is still under development, however, you can test the development version.

Since this is a development version, you might encounter some issues. You can report them to Arduino ESP32 GitHub issue tracker.

The expected stable release of the latest version is December 2023 and the 2.0.x will be under support maintenance until July 2024 then will be discontinued.

You can read the full announcement here:
https://blog.espressif.com/announcing-the-arduino-esp32-core-version-3-0-0-3bf9f24e20d4

Before you think about updating to version 3.x.x of the ESP32 core, you should study this Migration Guide:

https://docs.espressif.com/projects/arduino-esp32/en/latest/migration_guides/2.x_to_3.0.html

I’ve had a quick look through it, and one of the things that jumped out at me is the changes to the LEDC functionality.

LEDC is used as an alternative to the analogWrite() command that’s available for the ESP8266, and is used to vary the brightness of physical LEDs.
The ESP32 3.x.x core deletes the ledcSetup and ledcAttachPin commands and replaces them with a new combined command, as well as adding new LEDC functionality.

This is important because the Blynk Edgent_ESP32 example uses the ledcSetup and ledcAttachPin commands in the indicator.h file, so attempting to compile the current Edgent_ESP32 example will result in compilation errors if you’re using the 3.x.x version of the core.

This is obviously something for @vshymanskyy to take a look at, but I’m guessing that many Blynk users also use the LEDC functionality in their own projects.
I’m guessing that libraries like FastLED will also be affected by this change, and will require an update to enable them to work under version 3.x.x of the core.

There are also quite a few other “breaking changes” (changes that will break your existing code) highlighted in the migration guide linked above. So, if you’re an ESP32 “power user” you need to read the migration guide and assess the impact on your existing projects.

Personally, I won’t be upgrading to the new core until it’s at least at “stable release” status, but as support for version 2.x.x will end in mid 2024, I’ll need to make the move fairly soon.

Pete.

4 Likes

Yes, we’re aware of it and preparing the relevant updates on our end.

2 Likes

So I am a new uses since last week using ESP32, and have been so happy to be able to compile and execute code, build dashboards and succesfully do OTA updates on a LOLINESP32, however…
Since this is a custom board, if I define BOARD_LED_PIN in settings.h, I get this error.
Indicator.h:116:4: error: ‘ledcSetup’ was not declared in this scope
116 | ledcSetup(BOARD_LEDC_CHANNEL_1, BOARD_LEDC_BASE_FREQ, BOARD_LEDC_TIMER_BITS);

it seems in Indicator.h, that this calls the ledcSetup

#elif defined(BOARD_LED_PIN) // Single color LED
void initLED() {
ledcSetup(BOARD_LEDC_CHANNEL_1, BOARD_LEDC_BASE_FREQ, BOARD_LEDC_TIMER_BITS);
ledcAttachPin(BOARD_LED_PIN, BOARD_LEDC_CHANNEL_1);
}

If I do not define any LED pin config, i can compile and proceed, although this is not strictly correct.

Is this related to this issue?
Thanks for a great product.

Yep, you are right!,

If I remove the 3.0.0 ESP32 board library, I no longer get theledcSetup errors with LED pins defined.

THANKS

This is helpful, thanks @PeteKnight

Arduino IDE is now pushing the Espressif ESP32 3.0.0 board package.
We’re all going to hit this speed bump now.

I’m seeing it first with ledcSetup and ledcAttachPin.
Much appreciated.

There also seems to be a “wifi not declared” issue too…

Pete.

Thanks again @PeteKnight

Might have to back down from ESP32 3.0.0 for a while. Dang. Returning to 2.0.17.

  • Ran into the compile error: 'WiFi' was not declared in this scope
    I’m using this WiFi command WiFi.macAddress(mac); in my OTA routine.
  • Also having Telnet compile problems.

Not sure how to proceed…

All Thoughts Welcome…

Fixing the ledc issue was simple. Here’s what I had to do:

  • Combine each ledcSetup and ledcAttachPin command to a single command:
    ledcAttach ( LEDchannel, PWMfrequency, PWMresolution );
    Espressif now refers to the first parameter as the “pin” not the channel.

  • Change the ledcWrite ( pin, value ); first parameter to the pin number, not the channel.

  • Change any ledcDetachPin commands to ledcDetach (uint_8 pin );

Re-referencing Pete’s link to the Espressif ESP32 3.0.0 doc
https://docs.espressif.com/projects/arduino-esp32/en/latest/migration_guides/2.x_to_3.0.html

I just came across this…

Which says that #include "WiFi.h" is now mandatory in 3.0.x whereas it was optional in 2.x.x

Pete.

1 Like

Thanks again, @PeteKnight
Adding #include "WiFi.h" nailed the compiler WiFi issue.
Modifying the ledc… code, as posted above, worked, too. I appreciate your help.

An Inspirational Moment:
My last 3.0.0 glitch was in the TelnetStream library, which I use religiously for OTA debugging and monitoring. The author, Juraj Andrassy, made a fix and posted it within an hour of my Github Issue post. This is a model for us all!
https://github.com/JAndrassy/TelnetStream

I am now compiling ESP32 3.0.0 with only the ledc and WiFi.h mods we discussed.

Sheesh. Thank you.

I guess @Juraj is the best person to ask about that one :grinning:

Might possibly be something to do with this…

WiFiServer had unimplemented write functions inherited from Print class. These are now removed.

https://docs.espressif.com/projects/arduino-esp32/en/latest/migration_guides/2.x_to_3.0.html

Pete.

Yes, he modified NetAPiHelpers deep down and posted the fix immediately. Impressive.

1 Like

Very!

Pe5e.

Off topic.
I notice that my ESP32 3.0.0 compilations are substantially larger (17% larger) than those from 2.0.17.

Does whining to Espressif help?

I have no idea, but it’s maybe worth flagging-up.

Pete.

I made the change in esp32 platform which required the change in NetApiHelpers library used by the TelnetStream library. I just forgot to release the new version of NetApiHelper. so nothing impressive :slight_smile:

2 Likes