ESP32 timer issues

I need ESP32 Hardware timmersin my project. I found out functions i.e. timerGetFrequency are unknown. GROK recomends to update Arduino Framework greater 3.0.0
my platform.ini now has
ramework = arduino
platform_packages = framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32#2.0.3

That comes from Elecrow for their 5 inch Crowpanel which has a ESP32 S3 Chip with PSRAN on board

in my project I must use this display.

should I upgrade and how.

tanks for any helpfull answer

To get the latest Espressif Arduino 3.x you have to use pioarduino’s espressif32-platform. It is just a different platform setting in the platformio.ini. See here: GitHub - pioarduino/platform-espressif32: Espressif 32: pioarduino community platform compatible with PlatformIO

But i doubt the required timer function is available in the framework itself.

What do you want to acheive with this function?

Thank you for the quick answer

I think that I do not need this specific function for my project, I found it in an article in a code examble on the net where the ESP32 HW timers are explaind. I think it is more for debuging.

I always try to understand things I use in my programs.

What do you recommend in general for the future and other projects? Always update to latest version or not.

I rarely have seen accessing the HW timers directly in ESP32 projects. Usually you make use of the underlying FreeRTOS functions like starting a new task etc.

:+1:

Just my opinion:
I try to stick to the latest available version. Exceptions are when there are known bugs. Then I’ll stick to the latest version which does not have this bug until it is fixed in a future version.

Also another exception would be the use of a non compatible library. Yes, there are still libraries available which are not ported to 3.x and might cause trouble. If my project depends on such a library, I stick with the latest 2.x framework version.

Here you will find a table of available platform versions in relation to the Arduino Framework version: platform-espressif32 versions · GitHub

I got stuck in the 2.x 3.x mess recently and the tables around are really hard to follow (and CoPilot gave 100% wrong answers, probably trained on bad data). And some people telling you to switch to the pioarduino plugin (which brought its own set of problems).

In the end it was as simple as adding
platform = https://github.com/pioarduino/platform-espressif32/releases/download/stable/platform-espressif32.zip
To be using the most current 3.x environment

In my experience, with the libraries I’ve used, there are far more incompatibilities with the 2.x environment than 3.x especially with libraries that use timers and power management. Partly I’m guessing this is because those libraries (like my own Frugal-IoT) want to be usable on Arduino IDE as well.

I’m not an expert in this, but I wasted a good part of a day trying to solve this problem recently before someone gave me similar helpful information !

You do not need the pioarduino extension, but the pioarduino espressif 32 platform. Who and where told you that?

Don’t trust in AI!

Most libraries are 3rd party libraries and not created by espressif. So the maintainers of the libraries are responsible to keep them up to date.

Espressif released a migration guide - see Migration from 2.x to 3.0 - - — Arduino ESP32 latest documentation

Usually a change in the major version comes with breaking changes and require updates to existing projects.

I don’t remember WHERE I got the bad advice that I needed the Pioarduino extension,

I don’t trust AI - but it is often a pointer at things to try - especially when the information out there is really unclear (like that versions table, doesn’t point out the “stable” option, which makes sense for most cases)

Yes - library maintainers are responsible- my point is that, in my experience, most libraries are updated anyway because they work with the newer Arduino IDE, my own library no longer works with 2.x

Agreed - there are breaking changes - for example I just yesterday got caught by the while (!Serial) change, where it used to be good practice (required by some boards), and now, under 3.0, causes code to spin and not boot.

I also have seen problems with power management compatibility - especially esp_pm_config_t

1 Like