What is ESP IDF ?

GeorgeFlorian1
Posts: 160
Joined: Thu Jan 31, 2019 2:32 pm

What is ESP IDF ?

Postby GeorgeFlorian1 » Fri Feb 15, 2019 3:36 pm

Hello !

For the past 2 weeks I've been trying to learn to code on ESP32 using Arduino IDE. I still have no idea what I'm doing.

My main source of guides was from here.

The code was... simpler.

Code: Select all

#include "SPIFFS.h"
#include "WiFi.h"
#include "WiFiClient.h"
#include "WiFiAP.h"
#include "ESPAsyncWebServer.h"

const char* ssid1 = "ESP32_Test";
const char* password1 = "123456789";

IPAddress local_IP(192,168,1,2);
IPAddress subnet(255,255,255,0);

AsyncWebServer server(80);

void setup() {
  
  Serial.begin(115200);
  delay(2000);
  
  if(!SPIFFS.begin(true)) {
      Serial.println("An Error has occured while mounting SPIFFS");
      return;
    }
 
Serial.print("Setting soft-AP configuration ... ");
Serial.println(WiFi.softAPConfig(local_IP, local_IP, subnet) ? "Ready" : "Failed!"); 

//sau
//  WiFi.softAPConfig(local_IP, local_IP, subnet);

  Serial.print("Setting soft-AP ... ");
  Serial.println(WiFi.softAP(ssid1, password1) ? "Ready" : "WiFi.softAP failed ! (Password must be at least 8 characters long )");

//sau
//  if(!WiFi.softAP(ssid1, password1)) {
//      Serial.println("WiFi.softAP failed ! (Password must be at least 8 characters long )");
//      return;
//    }
    
  Serial.println();
  Serial.print("Soft-AP IP address = ");
  Serial.println(WiFi.softAPIP());



  server.on("/login", HTTP_GET, [](AsyncWebServerRequest *request) {
      request->send(SPIFFS, "/index.html", "text/html");
    });

  server.on("/login.css", HTTP_GET, [](AsyncWebServerRequest *request) {
      request->send(SPIFFS, "/login.css", "text/css");
    });

  server.on("/back-image.jpg", HTTP_GET, [](AsyncWebServerRequest *request) {
      request->send(SPIFFS, "/back-image.jpg", "image/jpeg");
  });

  server.on("/logo-metrici.png", HTTP_GET, [](AsyncWebServerRequest *request) {
      request->send(SPIFFS, "/logo.png", "image/png");
  });
  
    server.begin();

  Serial.println("index.html: ");
  Serial.print(SPIFFS.exists("/index.html"));
  Serial.println();
  Serial.println("login.css: ");
  Serial.print(SPIFFS.exists("/login.css"));
  Serial.println();
  Serial.println("back-image.jpg: ");
  Serial.print(SPIFFS.exists("/back-image.jpg"));
  Serial.println();
  Serial.println("logo.png: ");
  Serial.print(SPIFFS.exists("/logo.png"));
}

void loop() {
  
  }
But then I come across this forum and its sub-forums, namely this one: ESP32 IDF and notice that the code is a little different. It doesn't seem as simple as the one I used in Arduino IDE. Its syntax has a lot of underscores _ and a lot of it starts with esp/ESP. And when I put it in the Arduino IDE of course it didn't compile (probably because I needed to include some libraries for it to work).

Code: Select all

void wifiSetup_StopAP(void)
{
  wifi_mode_t currentMode;
  esp_wifi_get_mode(&currentMode);
  if(currentMode == WIFI_MODE_AP )
  {
    esp_wifi_stop();
    ESP_ERROR_CHECK( esp_wifi_set_mode(WIFI_MODE_NULL) );
  }
  else if (currentMode == WIFI_MODE_APSTA)
  {
    ESP_ERROR_CHECK( esp_wifi_set_mode(WIFI_MODE_STA) );
  }
}
I found Kolban's Book on ESP32 and thank you Mr. Neil Kolban for gathering and putting all of that information in one place.

The thing is that it has the same syntax as the one on this sub-forum, not the one I used in Arduino IDE and I have no idea how to apply what this man wrote in his book.

I don't know why the code looks similar, but is different and doesn't compile. How am I supposed to code ? Should I use Arduino IDE or code another way ? What is the other way ? What does IDF stand for ? Google says that it stands for Israel Defense Forces and it's nice that I learned something new but it wasn't the thing I wanted to learn.

I posted this here in hope that somebody will make me understand what's going on. In the mean time, I will do some research on my own, but I think that my safest bet was asking at the source: here.

Currently reading this : https://docs.espressif.com/projects/esp ... t-started/

As a ... side note, this is the project I am trying to do:
I am looking to make my little ESP32 do the following:
1 - boot ;
2 - read two (2) lines from a file (SSID and Password), if it has values in that file start in Station Mode and serve a webpage ;
2.1 - if the file doesn't exist or it's empty start in Acces Point Mode with "ESP32AP" name and "password123" as password and serve another webpage containing two (2) inputs: SSID and Password and a "Connect" Button
2.2 - when clicking on Button it will save the credentials in the above mentioned file, and restart

User avatar
ESP_krzychb
Posts: 400
Joined: Sat Oct 01, 2016 9:05 am
Contact:

Re: What is ESP IDF ?

Postby ESP_krzychb » Sat Feb 16, 2019 7:36 am

Hello GeorgeFlorian1 !

ESP-IDF stands for Espressif IoT Development Framework

Arduino ESP32 is a wrapper for ESP-IDF to make ESP32 easier to use for people without a background in electronics and programming.

The project you described can be implemented entirely in Arduino ESP32, there is no need to add some code directly from ESP-IDF.

Zeni241
Posts: 86
Joined: Tue Nov 20, 2018 4:28 am

Re: What is ESP IDF ?

Postby Zeni241 » Sat Feb 16, 2019 3:36 pm

I also started with Arduino, and I consider myself as beginner. I would say , if you are planning to go all the way then go for ESP IDF from the start. You will have to be proficient with C language and FreeRTOS. You can learn these as you go.

Ritesh
Posts: 1383
Joined: Tue Sep 06, 2016 9:37 am
Location: India
Contact:

Re: What is ESP IDF ?

Postby Ritesh » Sun Feb 17, 2019 11:17 am

GeorgeFlorian1 wrote:
Fri Feb 15, 2019 3:36 pm
Hello !

For the past 2 weeks I've been trying to learn to code on ESP32 using Arduino IDE. I still have no idea what I'm doing.

My main source of guides was from here.

The code was... simpler.

Code: Select all

#include "SPIFFS.h"
#include "WiFi.h"
#include "WiFiClient.h"
#include "WiFiAP.h"
#include "ESPAsyncWebServer.h"

const char* ssid1 = "ESP32_Test";
const char* password1 = "123456789";

IPAddress local_IP(192,168,1,2);
IPAddress subnet(255,255,255,0);

AsyncWebServer server(80);

void setup() {
  
  Serial.begin(115200);
  delay(2000);
  
  if(!SPIFFS.begin(true)) {
      Serial.println("An Error has occured while mounting SPIFFS");
      return;
    }
 
Serial.print("Setting soft-AP configuration ... ");
Serial.println(WiFi.softAPConfig(local_IP, local_IP, subnet) ? "Ready" : "Failed!"); 

//sau
//  WiFi.softAPConfig(local_IP, local_IP, subnet);

  Serial.print("Setting soft-AP ... ");
  Serial.println(WiFi.softAP(ssid1, password1) ? "Ready" : "WiFi.softAP failed ! (Password must be at least 8 characters long )");

//sau
//  if(!WiFi.softAP(ssid1, password1)) {
//      Serial.println("WiFi.softAP failed ! (Password must be at least 8 characters long )");
//      return;
//    }
    
  Serial.println();
  Serial.print("Soft-AP IP address = ");
  Serial.println(WiFi.softAPIP());



  server.on("/login", HTTP_GET, [](AsyncWebServerRequest *request) {
      request->send(SPIFFS, "/index.html", "text/html");
    });

  server.on("/login.css", HTTP_GET, [](AsyncWebServerRequest *request) {
      request->send(SPIFFS, "/login.css", "text/css");
    });

  server.on("/back-image.jpg", HTTP_GET, [](AsyncWebServerRequest *request) {
      request->send(SPIFFS, "/back-image.jpg", "image/jpeg");
  });

  server.on("/logo-metrici.png", HTTP_GET, [](AsyncWebServerRequest *request) {
      request->send(SPIFFS, "/logo.png", "image/png");
  });
  
    server.begin();

  Serial.println("index.html: ");
  Serial.print(SPIFFS.exists("/index.html"));
  Serial.println();
  Serial.println("login.css: ");
  Serial.print(SPIFFS.exists("/login.css"));
  Serial.println();
  Serial.println("back-image.jpg: ");
  Serial.print(SPIFFS.exists("/back-image.jpg"));
  Serial.println();
  Serial.println("logo.png: ");
  Serial.print(SPIFFS.exists("/logo.png"));
}

void loop() {
  
  }
But then I come across this forum and its sub-forums, namely this one: ESP32 IDF and notice that the code is a little different. It doesn't seem as simple as the one I used in Arduino IDE. Its syntax has a lot of underscores _ and a lot of it starts with esp/ESP. And when I put it in the Arduino IDE of course it didn't compile (probably because I needed to include some libraries for it to work).

Code: Select all

void wifiSetup_StopAP(void)
{
  wifi_mode_t currentMode;
  esp_wifi_get_mode(&currentMode);
  if(currentMode == WIFI_MODE_AP )
  {
    esp_wifi_stop();
    ESP_ERROR_CHECK( esp_wifi_set_mode(WIFI_MODE_NULL) );
  }
  else if (currentMode == WIFI_MODE_APSTA)
  {
    ESP_ERROR_CHECK( esp_wifi_set_mode(WIFI_MODE_STA) );
  }
}
I found Kolban's Book on ESP32 and thank you Mr. Neil Kolban for gathering and putting all of that information in one place.

The thing is that it has the same syntax as the one on this sub-forum, not the one I used in Arduino IDE and I have no idea how to apply what this man wrote in his book.

I don't know why the code looks similar, but is different and doesn't compile. How am I supposed to code ? Should I use Arduino IDE or code another way ? What is the other way ? What does IDF stand for ? Google says that it stands for Israel Defense Forces and it's nice that I learned something new but it wasn't the thing I wanted to learn.

I posted this here in hope that somebody will make me understand what's going on. In the mean time, I will do some research on my own, but I think that my safest bet was asking at the source: here.

Currently reading this : https://docs.espressif.com/projects/esp ... t-started/

As a ... side note, this is the project I am trying to do:
I am looking to make my little ESP32 do the following:
1 - boot ;
2 - read two (2) lines from a file (SSID and Password), if it has values in that file start in Station Mode and serve a webpage ;
2.1 - if the file doesn't exist or it's empty start in Acces Point Mode with "ESP32AP" name and "password123" as password and serve another webpage containing two (2) inputs: SSID and Password and a "Connect" Button
2.2 - when clicking on Button it will save the credentials in the above mentioned file, and restart
Hi,

I am working on ESP32 IDF and I have developed almost 5 to 6 different products using that.

So, If you have knowledge of C and WiFi Networking then you can develop your application easily over ESP32 IDF with application examples. There are few examples provided with ESP32 IDF which will be helpful for any beginner to understand and developed application easily.

There are read the docs provided by Espressif Systems which will be helpful to create setup like toolchain, IDF itself and how to create & load application into ESP32 Development Kit.

I believe you will find lots of examples and documents for ESP32 IDF and application for that.

Still, Let me know if you need any help for that or stuck into any issue.
Regards,
Ritesh Prajapati

JeffWilliams
Posts: 17
Joined: Thu Mar 09, 2017 2:06 am

Re: What is ESP IDF ?

Postby JeffWilliams » Sun Feb 17, 2019 12:06 pm

Here is an aspect others have not pointed out. Arduino effectively hides you from project structure and build process. Arduino gives you the editor and a menu stucture to build the code and upload it to the MCU.

The IDF you can pick what editor you want (I use eclipse) , you can use c or c++ and you can either do the builds manually or integrate the build commands into the IDE/editor of your choice.

I personally moved from Arduino to IDF purely because I don't like the Arduino IDE, it's too simple for what I was used to C dev wise. But for some firends I have that don't have the background they prefer it as they don't need to understand the workings behind the scenes.


Jeff

Ritesh
Posts: 1383
Joined: Tue Sep 06, 2016 9:37 am
Location: India
Contact:

Re: What is ESP IDF ?

Postby Ritesh » Sun Feb 17, 2019 4:27 pm

JeffWilliams wrote:
Sun Feb 17, 2019 12:06 pm
Here is an aspect others have not pointed out. Arduino effectively hides you from project structure and build process. Arduino gives you the editor and a menu stucture to build the code and upload it to the MCU.

The IDF you can pick what editor you want (I use eclipse) , you can use c or c++ and you can either do the builds manually or integrate the build commands into the IDE/editor of your choice.

I personally moved from Arduino to IDF purely because I don't like the Arduino IDE, it's too simple for what I was used to C dev wise. But for some firends I have that don't have the background they prefer it as they don't need to understand the workings behind the scenes.


Jeff
Yes. You are absolutely correct. You can get proper understanding and better while using IDF compare to Arduino.
Regards,
Ritesh Prajapati

GeorgeFlorian1
Posts: 160
Joined: Thu Jan 31, 2019 2:32 pm

Re: What is ESP IDF ?

Postby GeorgeFlorian1 » Mon Feb 18, 2019 8:41 am

Wow ! Thank you for all of your great replies ! Great to know that this forum is this active !

I am planning to study and learn to make projects using the ESP32 and probably more and I am almost sure I will have lots of questions.

Ritesh
Posts: 1383
Joined: Tue Sep 06, 2016 9:37 am
Location: India
Contact:

Re: What is ESP IDF ?

Postby Ritesh » Tue Feb 19, 2019 3:37 am

GeorgeFlorian1 wrote:
Mon Feb 18, 2019 8:41 am
Wow ! Thank you for all of your great replies ! Great to know that this forum is this active !

I am planning to study and learn to make projects using the ESP32 and probably more and I am almost sure I will have lots of questions.
Hi,

Thanks for understanding it.

Still, Let us know if you find any difficulties while understanding and using ESP32-IDF in your development phase.
Regards,
Ritesh Prajapati

Who is online

Users browsing this forum: Baidu [Spider] and 158 guests