Category:ESP8266 Program

From ElectroDragon
Jump to navigation Jump to search

Enter Into Flash Mode

  • Most development board has auto enter into flash mode circuits, more commerial products do not really need this.
  • Pull GPIO 0 of ESP8266 before power up or reboot to enter into flash mode. -> So simply hold down GPIO 0 and press once reset will enter into flash mode manully.
  • Connect 3.3V/GND/TXD=>RXD/RXD->TXD to target, recommand USB-TTL downloader here


Details For Firmware


Type Address Description
boot_v1.X.bin 0x00000 from the official SDK
esp_init_data_default.bin 0x3FC000 from the official SDK
blank.bin 0x3FE000 from the official SDK
user1.bin 0x01000 user application 1

Boot Process

  • Reset vector is 0x40000080.
  • Boots into Espressif code in IROM0.
  • Loads SPI ROM data.
  • Starts executing ESP SDK-code shadowed SPI ROM (unconfirmed).

SPI Flash ROM Layout

Address Size Name Description
00000h 248k app.v6.flash.bin User application
3E000h 8k master_device_key.bin OTA device key
40000h 240K app.v6.irom0text.bin SDK libraries
7C000h 8k esp_init_data_default.bin Default configuration
7E000h 8k blank.bin Filled with FFh. May be WiFi configuration.

Dump and mass deply

  • After finish coding, upload your code lua into target board, better be complied
  • dump out the flash content out and save as firmware.bin file for batch deploy
  • use this firmware.bin for new products
  1. So first setup the working environment
  2. read out the flash content by command
./ --baud 115200 --port /dev/ttyUSB0 read_flash 0 4194304 output.bin
  1. 4194304 mbits = 4MB, read flash time take at least more than 5 minutes
  2. 2097152 mb = 2MB, 1048576 mbits = 1MB, 524288 = 512 KB, 262144 = 256 KB
  3. use flash download tool flash normally
  • Also can try dump mem out, like RAM, etc, dumping the ROM (64 KiB) from the chip:
./ dump_mem 0x40000000 65536 iram0.bin

Details For Boards

Flash Mode for ESP Relay Board Series

Product Manully Enter Into Flash Mode Note
ESP Relay Board SPST The board has not reset pin lead out please hold down BTN2, and then power up No need to connect AC mains power, supply 5V only
ESP Relay Board DPST Hold down BTN, and press RST once -
ESP Relay Board VDC Hold down BTN, and press RST once No need to connect AC mains power, supply 5V only
ESP Relay Board IL Hold down BTN, and press RST once -
ESP LEDs Hold down IO0, and press RST once -

Other Modules

Models Setup Flash Read
ESP-01M ESP8285 / 1MB / 1500 000 speed / DOUT (fixed) / Crystal 26Mhz / SPI 40Mhz flash vendor:51h : N/A flash devID: 4014h QUAD;8Mbit crystal: 26 Mhz
ESP-12S / ESP-12F ESP8266 / 4MB / 1500 000 speed / DIO / Crystal 26Mhz / SPI 40Mhz -

Programming Details for ESP Relay Board

  • Our default firmware bin file can be found on this page, including arduino or nodemcu firmware.
  • Serial port output debug information by our default firmwarem baudrate 115200.
  • Get esp download tool from ESP_Download_Tool, flash .bin firmware file to board 0x00000, more instruction please see the page.


  • Open arduino IDE, and set baud rate to 74880 on serial, can find esp8266 debug info.
ets Jan  8 2013,rst cause:1, boot mode:(3,6)
load 0x4010f000, len 1384, room 16 
tail 8
chksum 0xef
csum 0xef
csum err
  • reset causes:
   1: normal boot
   2: reset pin
   3: software reset
   4: watchdog reset
  • boot device:
   1: ram
   3: flash

Flash Example

Flash Error Log

  • flash size is not correctly selected, in this case should be 16Mbit-C1 instead of 32Mbit
mismatch map 5,spi_size_map 4
system_partition_table_regist fail

Incorrect flash mode

ets Jan  8 2013,rst cause:1, boot mode:(3,7)
load 0x4010f000, len 1384, room 16 
tail 8
chksum 0xef
csum 0xef
csum err
  • write_flash 0x0 Yxxxx.bin
  • change to below, add dout SPI flash mode write_flash --flash_mode dout 0x0 Yxxxx.bin



Pages in category "ESP8266 Program"

The following 3 pages are in this category, out of 3 total.