Skip to content

Instantly share code, notes, and snippets.

@hgomez
Last active June 18, 2021 12:34
Show Gist options
  • Save hgomez/1e5d9feeb6ea23d637beea5ee783eb7d to your computer and use it in GitHub Desktop.
Save hgomez/1e5d9feeb6ea23d637beea5ee783eb7d to your computer and use it in GitHub Desktop.
Flash ESP32

Download firmware

curl -L http://download.espressif.com/esp_at/firmware/ESP32/ESP32_WROOM/ESP32-WROOM-32_AT_Bin_V2.1.0.0.zip -O

Install esptool

pip install esptool

Flash firmware

unzip ESP32-WROOM-32_AT_Bin_V2.1.0.0.zip
cd ESP32-WROOM-32_AT_Bin_V2.1.0.0/ESP32-WROOM-32_AT_Bin_V2.1/

esptool.py --chip auto --port /dev/ttyUSB0 --baud 115200 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq 40m --flash_size 4MB 0x8000 partition_table/partition-table.bin 0x10000 ota_data_initial.bin 0xf000 phy_init_data.bin 0x1000 bootloader/bootloader.bin 0x100000 esp-at.bin 0x20000 at_customize.bin 0x24000 customized_partitions/server_cert.bin 0x39000 customized_partitions/mqtt_key.bin 0x26000 customized_partitions/server_key.bin 0x28000 customized_partitions/server_ca.bin 0x2e000 customized_partitions/client_ca.bin 0x30000 customized_partitions/factory_param.bin 0x21000 customized_partitions/ble_data.bin 0x3B000 customized_partitions/mqtt_ca.bin 0x37000 customized_partitions/mqtt_cert.bin 0x2a000 customized_partitions/client_cert.bin 0x2c000 customized_partitions/client_key.bin

Verify Firmware

screen /dev/ttyUSB0 115200

Press Reset button, screen should show

ets Jul 29 2019 12:21:46
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:2
load:0x3fff0018,len:4
load:0x3fff001c,len:6932
load:0x40078000,len:13712
load:0x40080400,len:4260
entry 0x400806e4
I (71) boot: Chip Revision: 3
I (72) boot_comm: chip revision: 3, min. bootloader chip revision: 0
I (40) boot: ESP-IDF v4.0.1-193-ge7ac221 2nd stage bootloader
I (40) boot: compile time 02:47:00
I (40) boot: Enabling RNG early entropy source...
I (46) boot: SPI Speed      : 40MHz
I (50) boot: SPI Mode       : DIO
I (54) boot: SPI Flash Size : 4MB
I (58) boot: Partition Table:
I (61) boot: ## Label            Usage          Type ST Offset   Length
I (69) boot:  0 phy_init         RF data          01 01 0000f000 00001000
I (76) boot:  1 otadata          OTA data         01 00 00010000 00002000
I (84) boot:  2 nvs              WiFi data        01 02 00012000 0000e000
I (91) boot:  3 at_customize     unknown          40 00 00020000 000e0000
I (99) boot:  4 ota_0            OTA app          00 10 00100000 00180000
I (106) boot:  5 ota_1            OTA app          00 11 00280000 00180000
I (114) boot: End of partition table
I (118) boot_comm: chip revision: 3, min. application chip revision: 0
I (125) esp_image: segment 0: paddr=0x00100020 vaddr=0x3f400020 size=0x29230 (168496) map
I (194) esp_image: segment 1: paddr=0x00129258 vaddr=0x3ffbdb60 size=0x03974 ( 14708) load
I (201) esp_image: segment 2: paddr=0x0012cbd4 vaddr=0x40080000 size=0x00400 (  1024) load
I (202) esp_image: segment 3: paddr=0x0012cfdc vaddr=0x40080400 size=0x03034 ( 12340) load
I (215) esp_image: segment 4: paddr=0x00130018 vaddr=0x400d0018 size=0x1068cc (1075404) map
I (604) esp_image: segment 5: paddr=0x002368ec vaddr=0x40083434 size=0x195c8 (103880) load
I (647) esp_image: segment 6: paddr=0x0024febc vaddr=0x400c0000 size=0x00064 (   100) load
I (665) boot: Loaded app from partition at offset 0x100000
I (665) boot: Disabling RNG early entropy source...
BLUFI BLE is not connected yet
2.1.0
max tx power=78,ret=0

Verify AT commands

Connect 2nd RS232/USB adapter, connect GND first, then TX on RX on board, RX on TX on board

Connected to 2nd TTY port, at 115200 using miniterm as I didn't succeed sending CR/LF with Enter keys whatever stty option provided

Install miniterm (here on Fedora 34, miniterm is provided by Python pyserial package)

sudo dnf install python3-pyserial

Fire miniterm, on 2nd TTY port (ttyUSB1)

miniterm.py /dev/ttyUSB1 115200
--- Miniterm on /dev/ttyUSB1  115200,8,N,1 ---
--- Quit: Ctrl+] | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H ---

Send AT+GMT and CR/LF

AT+GMR
AT version:2.1.0.0(883f7f2 - Jul 24 2020 11:50:07)
SDK version:v4.0.1-193-ge7ac221
compile time(0ad6331):Jul 28 2020 02:47:21
Bin version:2.1.0(WROOM-32)
OK

Informations about firmware contents

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment