Author Topic: ESP32 - Arduino framework vs ESP32-IDF?  (Read 1212 times)

0 Members and 1 Guest are viewing this topic.

Offline aneevuserTopic starter

  • Frequent Contributor
  • **
  • Posts: 252
  • Country: gb
ESP32 - Arduino framework vs ESP32-IDF?
« on: May 29, 2022, 06:48:15 pm »
I'm intending to develop a small project on an ESP32 board, and am planning to use VSCode+PlatformIO, with FreeRTOS.

I seem to have the option of choosing to create a project using the Arduino framework or ESP32-IDF, but it's not clear to me what the pros and cons are here.

For example, if I were to choose the Arduino framework, can I still freely make calls to the underlying ESP32-IDF code base, or are there strange and ill-documented problems that can arise were I to do that?

One point that strikes me: it seems that there are many more online resources for Arduino development (e.g. how does one assign an int. handler, configure an IO pin etc) and more people familiar with it, but I'm worried about being trapped in an Arduino environment when I suddenly find that I need access to ESP32-native features that haven't been translated into Arduino-speak.

Anyone with any useful experience to share?
 

Online DavidAlfa

  • Super Contributor
  • ***
  • Posts: 5904
  • Country: es
Re: ESP32 - Arduino framework vs ESP32-IDF?
« Reply #1 on: June 02, 2022, 10:01:43 am »
Try starting a DMA  memory transfer? Setting up the LCD peripheral? Bluetooth? Nope, not in Arduino.
Else than some basic SPI, UART and few other peripherals, Arduino framework lacks a lot of hardware functionality, which IDF has.

Arduino allows basic working in very few steps, which is fine for starting, but you won't get far.
See how, for example, LCDs are usually painfully slow.
Zero hardware-optimized libraries, everything is pretty much generic, software-based, no DMA, no hardware acceleration...
« Last Edit: June 02, 2022, 10:05:59 am by DavidAlfa »
Hantek DSO2x1x            Drive        FAQ          DON'T BUY HANTEK! (Aka HALF-MADE)
Stm32 Soldering FW      Forum      Github      Donate
 

Online globoy

  • Regular Contributor
  • *
  • Posts: 185
  • Country: us
Re: ESP32 - Arduino framework vs ESP32-IDF?
« Reply #2 on: June 02, 2022, 04:48:09 pm »
You can make IDF calls from within the Arduino environment.  You can use both cores, create FreeRTOS tasks and use the various native libraries.  You do have to worry on occasion if you use both the Arduino compatible calls and a native API for the same peripheral.  I would highly encourage you to look through the Arduino compatibility layer Espressif wrote.  It's fairly straightforward and reasonably done.  You can find it if you drill down into your Arduino installation or just search github for ESP32 Arduino.  Knowing it or at least knowing where to look in it is the best way to answer questions about it and look for interoperability issues.

I've written a fair bit of code using both environments.  Depending on your needs the Arduino environment may be just fine.  Very nice to be able to do things like create a web server with just a few lines of code.   On the other hand you might find you need the native (and more complex) API for higher performance or for some things that aren't implemented in the Arduino API.  If you are planning to share your project with others then using Arduino will make that much easier for them.  I've found that relatively few people who aren't already familiar with the IDF are willing to use it just to compile someone else's project.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf