ESP32: Difference between revisions
| (4 intermediate revisions by the same user not shown) | |||
| Line 120: | Line 120: | ||
= Flashing = | = Flashing = | ||
Note: when using USB cables, make sure it is a data transfer cable and not a charge only cable! | |||
== Using the Download Tool == | |||
In the SPIDownload you will need to not only select the bin file, but also input the address to flash it to behind that (after the @). | |||
https://docs.espressif.com/projects/esp-at/en/latest/esp32/Get_Started/Downloading_guide.html | |||
https://docs.espressif.com/projects/esp-test-tools/en/latest/esp32/production_stage/tools/flash_download_tool.html | |||
https://www.martinloren.com/how-to/fashing-esp32/ | |||
https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/startup.html | |||
show that the standard addresses are | |||
0x0 or 0x0000 if there is no fancy partitioning | |||
0x1000 for the second stage bootloader | |||
0x8000 for the partition table | |||
0x10000 for the app | |||
== SPI Modes == | |||
In the Dowload tool, the SPI Speed can be found in the ChipInfoDump tab, crystal speed. The SPI Modes the chip can do are found in the [https://www.espressif.com/documentation/esp32_technical_reference_manual_en.pdf#spi Technical reference manual] under chapter: SPI Controller (SPI). The way the modes work is explained [https://docs.espressif.com/projects/esptool/en/latest/esp32/advanced-topics/spi-flash-modes.html here]. If it has 4 pins for data communication (MOSI, MISO, CLK, CS) then is supports QIO / Quad I/O which is the fastest. The ESP32 should have this. | |||
You can also look at the chipinfodump | |||
Status value: 0x400200 | |||
And the popup in the Flash Download tool will tell you what the 3rd character means (in this case FASTRD) | |||
== Manually Setting the ESP32 to flash mode == | == Manually Setting the ESP32 to flash mode == | ||
| Line 138: | Line 169: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
= Development = | = Development = | ||
| Line 154: | Line 176: | ||
https://docs.espressif.com/projects/esp-idf/en/latest/esp32/index.html Programming Guide | https://docs.espressif.com/projects/esp-idf/en/latest/esp32/index.html Programming Guide | ||
https://esphome.io/ - smart home easily | |||
Latest revision as of 04:16, 3 October 2025
Hardware
You can find the differences between the hardware types here: https://www.espressif.com/en/products/socs
The technical documentation can be found here: https://www.espressif.com/en/support/documents/technical-documents
The datasheets (the PDF files explain the different naming conventions in ESP32 Series Comparison page) here: https://docs.espressif.com/projects/arduino-esp32/en/latest/boards/boards.html
But some more on naming conventions: https://developer.espressif.com/blog/2025/03/espressif-part-numbers-explained/
https://docs.espressif.com/projects/esp-idf/en/latest/esp32/hw-reference/index.html
Tools
Espressif has several tools to write and test with, you can find here:
https://docs.espressif.com/projects/esp-test-tools/en/latest/esp32/index.html#
https://www.espressif.com/en/support/download/other-tools
Detecting the type of chip
The Flash Download Tools writes binary images but can also be used for testing with the ChipInfoDump tab. Select the com port and baudrate and click Chipinfo. It will tell you the kind of chip it really is , how many cores and how fast it can go. If you select the wrong chip type at startup, it will tell you.
Testing the chip
The easiest way to test is by using this video guide which uses the Arduino IDE to load up ESP32_Test.ino. You change the SSID and password, then select the chip (nb my esp32-d0wd-v3 is not in the list but the AI Thinker ESP32-CAM works). Click the arrow facing right in the top left to compile and send the ino to the esp32. Then in top right, click the serial monitor, set the baud rate to 115200 and repower the esp32. This will show you the IP address you can visit in a browser to turn the LED light on and off.
/*
In this program, we will test the ESP32 by creating a simple web server that can be accessed from any device connected to the same router.
The web server will display LED ON and LED OFF buttons.
Clicking these buttons will control the onboard LED of the ESP32, which is connected to GPIO2.
When you click LED ON, the onboard LED will turn on, and clicking LED OFF will turn it off.
This provides a simple and interactive way to test the ESP32's functionality.
*/
#include <WiFi.h>
#include <WebServer.h>
// Replace with your network credentials
const char* ssid = "Perfect";
const char* password = "24242424";
WebServer server(80); // Web server on port 80
const int ledPin = 2; // Onboard LED pin (GPIO2 for ESP32)
bool ledState = false; // Track LED state
// HTML content for the web page
String HTMLPage() {
String html = "<!DOCTYPE html><html>";
html += "<head><title>ESP32 LED Control</title></head>";
html += "<body style='text-align: center; font-family: Arial;'>";
html += "<h1>ESP32 LED Control</h1>";
html += ledState ? "<p>LED is <strong>ON</strong></p>" : "<p>LED is <strong>OFF</strong></p>";
html += "<a href='/on' style='padding: 10px 20px; background-color: green; color: white; text-decoration: none;'>Turn ON</a> ";
html += "<a href='/off' style='padding: 10px 20px; background-color: red; color: white; text-decoration: none;'>Turn OFF</a>";
html += "</body></html>";
return html;
}
// Handle the root path "/"
void handleRoot() {
server.send(200, "text/html", HTMLPage());
}
// Handle LED ON request
void handleLEDOn() {
ledState = true;
digitalWrite(ledPin, HIGH);
server.send(200, "text/html", HTMLPage());
}
// Handle LED OFF request
void handleLEDOff() {
ledState = false;
digitalWrite(ledPin, LOW);
server.send(200, "text/html", HTMLPage());
}
void setup() {
Serial.begin(115200);
// Initialize onboard LED pin as output
pinMode(ledPin, OUTPUT);
digitalWrite(ledPin, LOW); // Start with LED off
// Connect to Wi-Fi
WiFi.begin(ssid, password);
Serial.print("Connecting to Wi-Fi");
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println("\nConnected to Wi-Fi");
Serial.println(WiFi.localIP());
// Define server routes
server.on("/", handleRoot);
server.on("/on", handleLEDOn);
server.on("/off", handleLEDOff);
// Start the server
server.begin();
Serial.println("Server started");
}
void loop() {
server.handleClient(); // Handle client requests
}
Espressif Production Testing Guide
Inside the guide above is a link to the Production Testing tool / Factory testing tool / customer testing tool. First in Dut Config tab you select the chip detected in the download tool and the com port. In Test Flow tab you can select the tests to be performed. In DUT Status tab you can run the tests.
The ESP RF Test Tool and Test Guide tool allows you to test the different firmwares and bluetooth, wifi, etc.
esptool is the command line system
Inside the
To see what is going on, you can connect a terminal program such as RealTerm or Serial Tool. NB only one program can access the com port at any one go.
Flashing
Note: when using USB cables, make sure it is a data transfer cable and not a charge only cable!
Using the Download Tool
In the SPIDownload you will need to not only select the bin file, but also input the address to flash it to behind that (after the @).
https://docs.espressif.com/projects/esp-at/en/latest/esp32/Get_Started/Downloading_guide.html
https://www.martinloren.com/how-to/fashing-esp32/
https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/startup.html
show that the standard addresses are
0x0 or 0x0000 if there is no fancy partitioning
0x1000 for the second stage bootloader
0x8000 for the partition table
0x10000 for the app
SPI Modes
In the Dowload tool, the SPI Speed can be found in the ChipInfoDump tab, crystal speed. The SPI Modes the chip can do are found in the Technical reference manual under chapter: SPI Controller (SPI). The way the modes work is explained here. If it has 4 pins for data communication (MOSI, MISO, CLK, CS) then is supports QIO / Quad I/O which is the fastest. The ESP32 should have this.
You can also look at the chipinfodump
Status value: 0x400200
And the popup in the Flash Download tool will tell you what the 3rd character means (in this case FASTRD)
Manually Setting the ESP32 to flash mode
Press and hold the boot button and then press the EN button. In RealTerm you should see something like
rst:0x1 (POWERON_RESET),boot:0x3 (DOWNLOAD_BOOT(UART0/UART1/SDIO_REI_REO_V2))
waiting for download
If you then press the EN button it will reset and give you some information
rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0030,len:4980
load:0x40078000,len:16612
load:0x40080400,len:3480
entry 0x400805b4
E (308) quad_psram: PSRAM ID read error: 0xfffff�†¸� ‚MI�5chip not found or
not supported
Development
https://developer.espressif.com/
https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/index.html
https://docs.espressif.com/projects/esp-idf/en/latest/esp32/index.html Programming Guide
https://esphome.io/ - smart home easily