ESP32: Use Arduino or ESP-IDF?
ESP32: Use Arduino or ESP-IDF?
Hello community,
I was wondering if i should use the official ESP-IDF or Arduino for my project...
First the hardware:
WeMos Lolin32
DS3231 RTC
MAX17043 Fuel Gauge
My Plan:
I want to use an external RTC to wake the ESP32 for a specific date and time. Are external RTCs and their wakeups supported by Arduino? Also i want to use i2c communcation for the MAX17043 Module which tells me how much battery charge is left. The modules have libraries for Arduino but i am not sure if my project will work on Arduino since everything isnt supported yet. Also I want to clock the ESP32 down to 80MHz all the time, since I dont need the speed. Can i adjust the hardware from the ESP32 with Arduino? In the ESP-IDF i just do an "make menuconfig" and a menu appears...
I really need some advices. Thank you in advance!
I was wondering if i should use the official ESP-IDF or Arduino for my project...
First the hardware:
WeMos Lolin32
DS3231 RTC
MAX17043 Fuel Gauge
My Plan:
I want to use an external RTC to wake the ESP32 for a specific date and time. Are external RTCs and their wakeups supported by Arduino? Also i want to use i2c communcation for the MAX17043 Module which tells me how much battery charge is left. The modules have libraries for Arduino but i am not sure if my project will work on Arduino since everything isnt supported yet. Also I want to clock the ESP32 down to 80MHz all the time, since I dont need the speed. Can i adjust the hardware from the ESP32 with Arduino? In the ESP-IDF i just do an "make menuconfig" and a menu appears...
I really need some advices. Thank you in advance!
Re: ESP32: Use Arduino or ESP-IDF?
The discussion on using Arduino APIs vs native ESP-IDF APIs is liable to open up a "red vs blue" discussion. For me, the answer falls to two major concepts:
1. Is there a library I want to use that has been written for the Arduino?
2. Do I desire to run this application on an MCU other than the ESP32?
If the answer to either of the above are true, then for me, the Arduino API is very much a contender.
If both of the above are false, then, for me personally, I would design against the ESP-IDF directly. I say that, because I have invested time studying the ESP-IDF APIs and have a "comfort" level there. If a chap had exclusively studied Arduino APIs and knew them inside and out, then one would have to weigh the cost/challenge of studying ESP-IDF.
The benefit of ESP-IDF (over Arduino APIs) is that the ESP-IDF is native to the ESP32 (by definition). It is the API (short of register poking) that will give you the highest fidelity against the ESP32 device itself. There are capabilities available in ESP-IDF that aren't (yet?) present in mapped Arduino APIs. They could quite easily be mapped by a programmer but that then implies one already has an ESP-IDF skill level.
Also realize that these are not necessarily exclusive options. The Arduino APIs can be leveraged in a native ESP-IDF application by building the app with Arduino as a component.
I am ignoring the Arduino IDE and build/flash story in this story.
1. Is there a library I want to use that has been written for the Arduino?
2. Do I desire to run this application on an MCU other than the ESP32?
If the answer to either of the above are true, then for me, the Arduino API is very much a contender.
If both of the above are false, then, for me personally, I would design against the ESP-IDF directly. I say that, because I have invested time studying the ESP-IDF APIs and have a "comfort" level there. If a chap had exclusively studied Arduino APIs and knew them inside and out, then one would have to weigh the cost/challenge of studying ESP-IDF.
The benefit of ESP-IDF (over Arduino APIs) is that the ESP-IDF is native to the ESP32 (by definition). It is the API (short of register poking) that will give you the highest fidelity against the ESP32 device itself. There are capabilities available in ESP-IDF that aren't (yet?) present in mapped Arduino APIs. They could quite easily be mapped by a programmer but that then implies one already has an ESP-IDF skill level.
Also realize that these are not necessarily exclusive options. The Arduino APIs can be leveraged in a native ESP-IDF application by building the app with Arduino as a component.
I am ignoring the Arduino IDE and build/flash story in this story.
Free book on ESP32 available here: https://leanpub.com/kolban-ESP32
Re: ESP32: Use Arduino or ESP-IDF?
kolban wrote:The discussion on using Arduino APIs vs native ESP-IDF APIs is liable to open up a "red vs blue" discussion. For me, the answer falls to two major concepts:
1. Is there a library I want to use that has been written for the Arduino?
2. Do I desire to run this application on an MCU other than the ESP32?
Hello Neil,
Both, the DS3231 and the MAX17043 already have libraries for the Arduino. I dont want to use the code for other MCUs. Do you know if an external RTC like the DS3231 can be used in Arduino as a wakeup source for the Deep Sleep of the ESP32?
Re: ESP32: Use Arduino or ESP-IDF?
A quick look at the datasheet here:
https://datasheets.maximintegrated.com/en/ds/DS3231.pdf
Seems to show that Pin 3 of the DS3231 is an interrupt pin which at first glance has a mode that can be configured to toggle when an "alarm" value is reached. I'm going to believe that a signal change on the output pin can be used as a trigger to wake the ESP32 out of some deep sleep mode.
https://datasheets.maximintegrated.com/en/ds/DS3231.pdf
Seems to show that Pin 3 of the DS3231 is an interrupt pin which at first glance has a mode that can be configured to toggle when an "alarm" value is reached. I'm going to believe that a signal change on the output pin can be used as a trigger to wake the ESP32 out of some deep sleep mode.
Free book on ESP32 available here: https://leanpub.com/kolban-ESP32
Re: ESP32: Use Arduino or ESP-IDF?
Hi,
I have worked with esp8266 but using Arduino library on Eclipse. Now I plan to start with ESP32. Actually I am quite comfortable with Arduino library. As I understand ESP IDF is more powerful than Arduino library. So can I work in arduino environment and access ESP IDF apis whenever needed from that environment?
One more specific question: Can I use multi-threaded programming using Arduino library, means running two threads that will run in parallel.
Thanks,
Debojit
I have worked with esp8266 but using Arduino library on Eclipse. Now I plan to start with ESP32. Actually I am quite comfortable with Arduino library. As I understand ESP IDF is more powerful than Arduino library. So can I work in arduino environment and access ESP IDF apis whenever needed from that environment?
One more specific question: Can I use multi-threaded programming using Arduino library, means running two threads that will run in parallel.
Thanks,
Debojit
-
- Posts: 9757
- Joined: Thu Nov 26, 2015 4:08 am
Re: ESP32: Use Arduino or ESP-IDF?
The ESP32 Arduino SDK is built on top of ESP-IDF, so you should be able to use most ESP-IDF functionality as is. This includes multitasking; be aware that as far as I am aware Arduino doesn't have specific support for this so you have to fall back to the FreeRTOS primitives to do this. I know that multiple people have tutorials on how to do this, however.
Re: ESP32: Use Arduino or ESP-IDF?
Hello everyone,
I am looking for a really convinced reason why ESP-IDF is a good choice for professional reason. The reason I use ESP-IDF is that it comes with the freeRTOS, which I am comfortable with. However, I don't know much about Arduino, it looks ok to me, except it works like magic boxs. Could anyone please teach me some examples of why ESP-IDF is better, for professional reasons?
I am looking for a really convinced reason why ESP-IDF is a good choice for professional reason. The reason I use ESP-IDF is that it comes with the freeRTOS, which I am comfortable with. However, I don't know much about Arduino, it looks ok to me, except it works like magic boxs. Could anyone please teach me some examples of why ESP-IDF is better, for professional reasons?
Re: ESP32: Use Arduino or ESP-IDF?
Flash encryption and secured boot. You dont have it out of the box in arduino.
Re: ESP32: Use Arduino or ESP-IDF?
You dont get all the extra flexibility from menuconfig to do enhancements and fine tuning.
-
- Posts: 9757
- Joined: Thu Nov 26, 2015 4:08 am
Re: ESP32: Use Arduino or ESP-IDF?
Also, note it's not an exclusive choice. You can use most ESP-IDF features from Arduino and you can import the Arduino library into ESP-IDF. (There still are some small downsides to both solutions: you can't use the Arduino IDE in ESP-IDF and you can't use Menuconfig from Arduino, as stated above.)
Who is online
Users browsing this forum: No registered users and 208 guests