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.
- 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.
If you tried Sigmdel's guide and it didn't work, it might have been because your device runs at different clock, so it might be working but at different baudrate, in order to change it, first check your devices clock by typing 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 doesn't work the flashing in the guides, read this section, otherwise skip it to Flashing.
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
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.
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
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
Perfect!! WORK! Just only read, README file and https://docs.espressif.com/projects/esp-at/en/release-v2.2.0.0_esp8266/AT_Command_Set/MQTT_AT_Commands.html