Skip to content

Instantly share code, notes, and snippets.

@ckevar
Created May 30, 2024 05:24
Show Gist options
  • Save ckevar/4275573daf5d2d4803346ab56bf4e0fe to your computer and use it in GitHub Desktop.
Save ckevar/4275573daf5d2d4803346ab56bf4e0fe to your computer and use it in GitHub Desktop.
HowTo Upgrade Firmware AT2.2.1. on the ESP8266
write_flash --flash_mode dout --flash_freq 26m --flash_size 4MB 0x8000 partition_table/partition-table.bin 0x9000 ota_data_initial.bin 0x0 bootloader/bootloader.bin 0x10000 esp-at.bin 0xF0000 at_customize.bin 0xFC000 customized_partitions/client_ca.bin 0x106000 customized_partitions/mqtt_key.bin 0x104000 customized_partitions/mqtt_cert.bin 0x108000 customized_partitions/mqtt_ca.bin 0xF1000 customized_partitions/factory_param.bin 0xF8000 customized_partitions/client_cert.bin 0xFA000 customized_partitions/client_key.bin

HowTo ESP8266-IDF-AT-V2.2.1

How to flash the ESP82666-AT-V2.2.1.0 firmware in the ESP8266 device

This method has been tested in an ESP8266EX device. It might be usefull for others ESP8266 devices as well. This is based on the guide by sigmdel and this discussion on esp32.com by DataDigger.

Requirements

  • ESP8266-IDF-AT_v2.2.1.0 from espressif.com
  • esptool.py First clone the esptool;
  $ git clone https://github.com/themadinventor/esptool.git

Nowadays you surelly are running python3 so, install the following dependencies, if necessary, as well:

  $ sudo apt install python3-serial
  $ sudo apt install python3-intelhex
  • (Optional) CuteCom for monitoring the port, i guess the Arduino IDE also works here.
  • Hardware wise you need a USB to USART interface. the ESP8266EX I'm using is quite similar to the one shown by sigmdel's guide, with the following pin out:
COL_0 COL_1
3v3 RX
RST IO0
EN IO2
TX GND

The important thing here is to ground IO0 and RST should be connected to 3.3v.

Procedure

If you tried Sigmdel's guide and it didn't work it might have been because your device has a different clock, so it might be working but at different baudrate so in order to change know your devices baudrate check, run this on terminal:

  $ sudo python3 /path/to/esptool.py --port /dev/ttyUSB0 chip_id
  # you should get something like this:
  sptool.py v4.7.0
  Serial port /dev/ttyUSB0
  Connecting....
  Detecting chip type... Unsupported detection protocol, switching and trying again...
  Connecting...
  Detecting chip type... ESP8266
  Chip is ESP8266EX
  Features: WiFi
  Crystal is 26MHz  # -> THIS OVER HERE IT'S IMPORTANT
  MAC: c8:c9:a3:6a:ae:03
  Uploading stub...
  Running stub...
  Stub running...
  Manufacturer: 5e
  Device: 3214
  Detected flash size: 1MB
  Hard resetting via RTS pin...

If you want to skip some troubleshooting or hypothesis why it doesnt work the flashing in the guides, read this section, otherwise skip it to Flashing.

Troubleshooting

flash speed

The Sigmdel's device is flashing at 40MHz, I'm not fully sure that's the reason why, but it looks like the problem, because at the end if the baudrate in the serial is set to 74880 you kind of get some values at booting but it's throwing errors at loading

  26
  -- x 115200 = 74880 
  40

Even in the download.config given by espressif you will find the the speed is set to 80m

flash mode

The ESP8266ex might support qio or whatever other fancy name there's available but since it's connected to USB-to-USART module, there are only two wires so stick it to dout. Both Sigmdel's and espressif's use different methods, qio and dio respectively.

Pin swapping

As Sigmdel's guide says there has been an pin swapping (Read. ESP8266 AT V2.0 20190715 Release Note) for the USART interface, but luckily he provides the version with the non-swapping pins, espat_esp01.bin

Flashing

The file included in this rep has all the necessary configuration for the esptool.py, so:

  $ sudo python3 /path/to/esptool.py -p /dev/ttyUSB0 @download2.config

Once done, continue with the pin correction bin file:

  $ sudo python3 /path/to/esptool.py -p /dev/ttyUSB0 write_flash -e -fm dout -ff 26m -fs 1MB 0 espat_esp01.bin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment