Hi, sorry if this question is regular here
But I’m trying to get into microcontroller programming. Platformio seems a pretty solid solution for me, but I’m not sure, what framework I need to use.
Arduino seems the most popular, but ESP-IDF should be native, right?
I’m trying to import esp32 libs, but it seems that most of them are supposed to be used with the Arduino framework. Any advice or links to guides are welcomed.
This is discussed quarterly or so in the reddit r/esp32 group. It’s two different camps.
Platformio supports either.
Arduino grew from 8-bit AVR up. It then grew “wide” to support multiple chips.
ESP-IDF came from “normal” C++ “down” to embedded. It only has to be as “wide” as many version as there are of ESP chips.
The ESP-IDF world tends to be more professional programmers that demand modern C++.
The Arduino world tends to not notice that Platformio’s G++ for Arduino is like GCC 8 instead of GCC13 as it is for ESP-IDF.
ESP-IDF code tends to be closer to the hardware. If you need things like quality Android/iOS apps that use BT to communicate your WiFi credentials instead of cross-platform kludges, that’s the kind of thing that tends to be more polished in ESP-IDF. Want an FFT that utilizes the opcodes of an S3? It’s there. Espressif's Frameworks - ESP32 - — ESP-IDF Programming Guide v5.2.3 documentation they tend to be very much ESP-IDF.
Arduino code is often written for memory constrained environments where everything is a global, threads don’t exist, etc. (I duly note that you CAN write good Arduino code, but I"m saying it’s not the common case with popular packages…) You’ll find Arduino’s weird String and not std::string, FS over std::filesystem, a subset of even C89’s time handling instead of std::chrono with timezones an dinternationalization as the norm.
ESP-IDF isn’t bound by political squabbling that have held back PlatformIO for a year, holding development and even bugfixes contributed from users hostage during business negotiations. If you want, say ESP32-C6 or the H family or P4, you can have those today (six months ago) in ESP-IDF. A community fork had to be created to get at least some of that work in motion for Arduino because PlatformIO has gummed it up. See some commentary on the great fork that’s routing around this squabble: pioarduino and Tasmota developers felt forced to fork Platformio's platform-espressif32 ( Espressif ESP32 Arduino Core development platform) in order to add support for Arduino ESP32 v3.0 and later · esphome/esphome · Discussion #7334 · GitHub
I know this is going to get hate mail from Arduino devs. If you’re wigging a few wires for one chip and logging them, Arduino is fine. If you’re managing a few dozen prioritized tasks with different scheduling priorities and needing to interoperate with code shared with your professional code bases, ESP-IDF is the clear place to start.
I’ve not explored it (I’m actually not a huge Platformio fan…I pop in here from time to time to see if any of my annoyances have been fixed. They rarely are.) but my understanding is that it actually offers three modes with frameworks dedicated to either and a third that’s more of a hybrid than I described the Arduino case already that lets you share packages. I’ll defer to expert Max: Framework = espidf, arduino - #2 by maxgerhardt
Pick whatever suits you. If you don’t like those choices, there’s always Nuttx, Zephyr, Blynk, Riot, and other options out there.
Thanks, Arduino seems much easier for me to get on track, I am just afraid, that someday I might need some of the low-level functionality, and Arduino won’t let me.
But this answer pretty helped me decide, which one to use, thank you again
Wow, I led you to the place I tried fairly hard to NOT lead you.
If I can’t save your soul from Arduino, at least I can offer some comfort on your concern. You can call a lot of the ESP-IDF support code from within Arduino. Is it possible you’ll never hit the ceiling on Arduino? Maybe. After about an hour, I’m cursing it, so that’s my own threshold of pain.
I have a suspicion that I may have a couple of decades of head start on that pain, though.
You start in Arduino and then decide you need to do networking while steering your robot AND computing a graceful deceleration, and you actually do need threads? Well, you don’t scrap the project; that’s the day you get to learn about having the two coexist.
Enjoy. And if you hit a wall, back up and pick a new direction.