Downloading Guide

[中文]

This Guide demonstrates how to download AT firmware and flash it into an ESP32-S2-MINI device by taking ESP32-S2-MINI as an example. The Guide is also applicable to other ESP32-S2 modules.

Before you start, please make sure you have already connected your hardware. For more details, see Hardware Connection.

For different series of modules, the commands supported by AT firmware are different. Please refer to ESP-AT Firmware Differences for more details.

Download AT Firmware

To download AT firmware to your computer, please do as follows:

  • Navigate to AT Binary Lists

  • Find the firmware for your device

  • Click the link to download it

Here, we download ESP32-S2-MINI-AT-V3.4.0.0 for ESP32-S2-MINI. The list below describes the structure of this firmware and what each bin file contains. Other AT firmware has similar structure and bin files.

.
├── at_customize.bin                 // secondary partition table
├── bootloader                       // bootloader
│   └── bootloader.bin
├── customized_partitions            // AT customized binaries
      ├── mfg_nvs.csv                  // raw data of manufacturing nvs partition
│   └── mfg_nvs.bin                  // manufacturing nvs partition binary
├── download.config                  // configuration of downloading
├── esp-at.bin                       // AT application binary
├── esp-at.elf
├── esp-at.map
├── factory                          // A combined bin for factory downloading
│   └── factory_XXX.bin
├── flasher_args.json                // flasher arguments
├── ota_data_initial.bin             // ota data parameters
├── partition_table                  // primary partition table
│   └── partition-table.bin
└── sdkconfig                        // compilation configuration for AT firmware

The file download.config contains the configuration to flash the firmware into multiple addresses:

--flash_mode dio --flash_freq 80m --flash_size 4MB
0x1000 bootloader/bootloader.bin
0x8000 partition_table/partition-table.bin
0x10000 ota_data_initial.bin
0x20000 at_customize.bin
0x21000 customized_partitions/mfg_nvs.bin
0x100000 esp-at.bin

  • --flash_mode dio means the firmware is compiled with flash DIO mode.

  • --flash_freq 80m means the firmware’s flash frequency is 80 MHz.

  • --flash_size 4MB means the firmware is using flash size 4 MB.

  • 0x10000 ota_data_initial.bin means downloading ota_data_initial.bin into the address 0x10000.

Flash AT Firmware into Your Device

Follow the instructions below for your operating system.

Windows

Before starting to flash, you need to download Flash Download Tools for Windows. For more details about the tools, please see the doc folder in the zip folder.

  • Open the ESP32-S2 Flash Download Tool.

  • Select chipType. (Here, we select ESP32-S2.)

  • Select a workMode according to your need. (Here, we select Developer Mode.)

  • Select a loadMode according to your need. (Here, we select uart.)

Firmware Download Configurations

Firmware Download Configurations

  • Flash AT firmware into your device. You can select either of the two ways below.

    • To download one combined factory bin (namely, factory_XXX.bin in the build/factory directory) to address 0, select “DoNotChgBin” to use the default configuration of the factory bin.

      Download to One Address

      Download to One Address (click to enlarge)

    • To download multiple bins separately to different addresses, set up the configurations according to the file download.config and do NOT select “DoNotChgBin”.

      Download to Multiple Addresses

      Download to Multiple Addresses (click to enlarge)

In case of flashing issues, please verify what the COM port number of download interface of the ESP32-S2 board is and select it from “COM:” dropdown list. If you do not know the port number, you can refer to Check port on Windows for details.

When you finish flashing, please Check Whether AT Works.

Linux or macOS

Before you start to flash, you need to install esptool.py.

You can select either of the two ways below to flash AT firmware into your device.

  • To download the bins separately into multiple addresses, enter the following command and replace PORTNAME and download.config:

    esptool.py --chip auto --port PORTNAME --baud 115200 --before default_reset --after hard_reset write_flash -z download.config
    

    Replace PORTNAME with your port name. If you do not know it, you can refer to Check port on Linux and macOS for details.

    Replace download.config with the content inside the file.

    Below is the example command for ESP32-S2-MINI.

    esptool.py --chip auto --port /dev/tty.usbserial-0001 --baud 115200 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq 40m --flash_size 4MB 0x0 bootloader/bootloader.bin 0x60000 esp-at.bin 0x8000 partition_table/partition-table.bin 0xd000 ota_data_initial.bin 0x1e000 at_customize.bin 0x1f000 customized_partitions/mfg_nvs.bin
    
  • To download the bins together to one address, enter the following command and replace PORTNAME and FILEDIRECTORY:

    esptool.py --chip auto --port PORTNAME --baud 115200 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq 40m --flash_size 4MB 0x0 FILEDIRECTORY
    

    Replace PORTNAME with your port name. If you do not know it, you can refer to Check port on Linux and macOS for details.

    Replace FILEDIRECTORY with the file directory you would flash to the address 0x0. It is normally factory/XXX.bin.

    Below is the example command for ESP32-S2-MINI.

    esptool.py --chip auto --port /dev/tty.usbserial-0001 --baud 115200 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq 80m --flash_size 4MB 0x0 factory/factory_MINI-1.bin
    

When you finish flashing, please Check Whether AT Works.

Check Whether AT Works

To check whether AT works, do as follows:

  • Open a serial port tool, such as SecureCRT;

  • Select the Port attached to “AT command/response” line (see Hardware Connection for details);

  • Set Baudrate to 115200;

  • Set Data Bits to 8;

  • Set Parity to None;

  • Set Stop Bits to 1;

  • Set Flow Type to None;

  • Enter the command “AT+GMR” with a new line (CR LF).

If the response is OK as shown below, AT works.

AT+GMR
AT version:3.4.0.0-dev(ca45add - ESP32S2 - May  9 2024 08:00:07)
SDK version:v5.0.6-dirty
compile time(877c7e69):May 10 2024 06:47:54
Bin version:v3.4.0.0-dev(MINI)

OK

Otherwise, you need to check your ESP32-S2 startup log in one of the following ways:

Method 1:

  • Open a serial port tool, such as SecureCRT;

  • Select the port attached to the “Download/Log output” line. For more information on this line, see Hardware Connection.

  • Set Baudrate to 115200;

  • Set Data Bits to 8;

  • Set Parity to None;

  • Set Stop Bits to 1;

  • Set Flow Type to None;

  • Press the RST key of the board directly. If it is like the log below, it means that ESP-AT firmware have been initalized correctly.

Method 2:

  • Open two serial port tools, such as SecureCRT;

  • In one serial port tool, select the port attached to the “AT command/response” line. In the other tool, select the port attached to the “Download/Log output” line. For more information on these lines, see Hardware Connection.

  • Set Baudrate to 115200;

  • Set Data Bits to 8;

  • Set Parity to None;

  • Set Stop Bits to 1;

  • Set Flow Type to None;

  • Enter the command AT+RST with a new line (CR LF) to the “AT command/response” line. If the serial log from the “Download/Output log” line is like the log below, it means that ESP-AT firmware have been initialized correctly.

ESP32-S2 startup log:

ESP-ROM:esp32s2-rc4-20191025
Build:Oct 25 2019
rst:0x1 (POWERON),boot:0x8 (SPI_FAST_FLASH_BOOT)
SPIWP:0xee
mode:DIO, clock div:1
load:0x3ffe6108,len:0x17d4
load:0x4004c000,len:0xa9c
load:0x40050000,len:0x3204
entry 0x4004c1b8
I (21) boot: ESP-IDF v5.0.6-dirty 2nd stage bootloader
I (21) boot: compile time 06:47:54
I (21) boot: chip revision: v0.0
I (24) boot.esp32s2: SPI Speed      : 80MHz
I (29) boot.esp32s2: SPI Mode       : DIO
I (34) boot.esp32s2: SPI Flash Size : 4MB
I (39) boot: Enabling RNG early entropy source...
I (44) boot: Partition Table:
I (48) boot: ## Label            Usage          Type ST Offset   Length
I (55) boot:  0 phy_init         RF data          01 01 0000f000 00001000
I (62) boot:  1 otadata          OTA data         01 00 00010000 00002000
I (70) boot:  2 nvs              WiFi data        01 02 00012000 0000e000
I (77) boot:  3 at_customize     unknown          40 00 00020000 000e0000
I (85) boot:  4 ota_0            OTA app          00 10 00100000 00180000
I (92) boot:  5 ota_1            OTA app          00 11 00280000 00180000
I (100) boot: End of partition table
I (104) esp_image: segment 0: paddr=00100020 vaddr=3f000020 size=28958h (166232) map
I (146) esp_image: segment 1: paddr=00128980 vaddr=3ff9e02c size=00004h (     4) load
I (146) esp_image: segment 2: paddr=0012898c vaddr=3ffc2f70 size=036f4h ( 14068) load
I (155) esp_image: segment 3: paddr=0012c088 vaddr=40022000 size=03f90h ( 16272) load
I (164) esp_image: segment 4: paddr=00130020 vaddr=40080020 size=d2214h (860692) map
I (340) esp_image: segment 5: paddr=0020223c vaddr=40025f90 size=0cfdch ( 53212) load
I (354) esp_image: segment 6: paddr=0020f220 vaddr=40070000 size=0002ch (    44) load
I (363) boot: Loaded app from partition at offset 0x100000
I (363) boot: Disabling RNG early entropy source...
at param mode: 1
AT cmd port:uart1 tx:17 rx:21 cts:20 rts:19 baudrate:115200
module_name: MINI
max tx power=78, ret=0
v3.4.0.0-dev
negotiated phy mode: 3