Home
JAQForum Ver 20.06
Log In or Join  
Active Topics
Local Time 15:38 25 Apr 2024 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : Flashing AT command firmware v2 to ESP8266

Author Message
flasherror
Senior Member

Joined: 07/01/2019
Location: United States
Posts: 159
Posted: 02:32pm 21 Jan 2022
Copy link to clipboard 
Print this post

I found a spare Wemos D1 mini clone and wanted to flash it with v2 AT firmware to experiment with MQTT.

Like Peter (see https://www.thebackshed.com/forum/ViewTopic.php?FID=16&TID=14482) I was annoyed at the graphical espressif flash tool and I thought there must be an easier way to:
1. flash ESP8266 without having to manually select a bunch of files and then enter start address for each file
2. use v2 firmware with common ESP8266 modules that use GPIO1 as TX and GPIO3 as RX

The procedure given below shows how to do the above (I spent a few hours figuring this out and want to save anyone else from wasting time instead of doing fun stuff)
It might work with ESP8266 modules with 1MB flash (not tested, perhaps someone can try?). Instead of using the graphical flash tool we're using esptool command line programmer which can read a config file and program the various data automatically without human data entry.

Instructions for flashing AT firmware to ESP8266 on Windows (v1.0)
Required:
ESP8266 module (ESP01 with programming circuit/adapter, Wemos D1 mini etc). I used Wemos D1 mini since nothing else required but a USB cable.
Python installed
Internet connection (to run pip to install esptool)
Serial/UART Driver installed for windows (specific to your module or serial adapter e.g. CH340, FTDI, etc). Com port should appear in Device Manager "Ports (COM & LPT)" after you have plugged in ESP module.

1. Download AT firmware for ESP8266 v2.2 from https://github.com/espressif/esp-at/releases/tag/v2.2.1.0_esp8266

2. Extract files off to a temp folder i.e. C:\ESP8266-1MB-tx1rx3-AT_V2.2

3. Download file from https://github.com/jandrassy/WiFiEspAT/blob/master/extras/AT2_esp8266_factory_param_tx1rx3.bin

4. Copy file to where you extracted the files in step 2 in "customized_partitions" sub folder (there should be factory_param.bin in this folder). You do not need to rename/overwrite the existing file.

5. Edit the download.config file using a text editor. The original file is shown below:
--flash_mode dio --flash_freq 80m --flash_size 1MB 0x8000 partition_table/partition-table.bin 0x9000 ota_data_initial.bin 0x0 bootloader/bootloader.bin 0x20000 esp-at.bin 0x18000 at_customize.bin 0x1A000 customized_partitions/client_cert.bin 0x1B000 customized_partitions/client_key.bin 0x1C000 customized_partitions/client_ca.bin 0x1D000 customized_partitions/mqtt_cert.bin 0x1E000 customized_partitions/mqtt_key.bin 0x1F000 customized_partitions/mqtt_ca.bin 0x19000 customized_partitions/factory_param.bin

Note the original file ends with customized_partitions/factory_param.bin

We need to change it to customized_partitions/AT2_esp8266_factory_param_tx1rx3.bin
This reconfigures AT 2 firmware for Espressif esp8266 build from the default GPIO 15 as TX and 13 as RX (which are incompatible with most ESP8266 modules since the USB serial chip is not connected to those pins). Instead we want to have the AT firmware communicating on 8266 GPIO 1 as TX and 3 as RX. This has to be done because Espressif changed the default pins between v1.x and v2.x firmware.
Only change factory_param.bin to AT2_esp8266_factory_param_tx1rx3.bin
Do not change any other part of the file

6. Make sure you have python installed (I had Python 3.9.7 64-bit installed). If you need to install it make sure it adds to command line path.

7. Open a command prompt (Start menu, type "cmd")

8. Type "pip install esptool". If file not found change folder to
C:\Users\<YourUsername>\AppData\Local\Programs\Python\Python39\Scripts>
and try again
Pip should download and install esptool.py files

9. To test whether works run esptool.py
You should see esptool command line options displayed.

10. Attempt to flash firmware. At the command line change to the folder (the one with download.config file in step 2) and then enter
esptool.py write_flash @download.config

Esptool will attempt to communicate on all serial ports to find the ESP8266. You may want to disconnect any other ESP modules from USB before running this so only the desired target device is programmed.

11. When flashing completed (Last thing you should see is "Hard resetting via RTS pin") use RealTerm or other terminal program to connect to ESP8266 using baud rate 115200

12. For modules with a reset button (like Wemos D1), to confirm receiving OK from module, press RESET button. You should see garbage followed by "ready"

13. To confirm ESP8266 receives commands and transmits replies, type AT+GMR followed by CRLF (I used Realterm with Send EOL options CR & LF checked)
AT+GMR
                                                                       
AT version:2.2.0.0(s-b097cdf - ESP8266 - Jun 17 2021 12:58:29)              
SDK version:v3.4-22-g967752e2                                                
compile time(6800286):Jul 11 2021 11:09:32                                    
Bin version:2.2.0(ESP8266_1MB)                                                                            
                                             
OK

Note: If you do not send commands terminated by CRLF ESP8266 will not reply!

Documentation (AT commands) at https://docs.espressif.com/projects/esp-at/en/release-v2.2.0.0_esp8266/

I'd appreciate if someone else tries these instructions to verify they are correct.
Edited 2022-01-22 01:38 by flasherror
 
panky

Guru

Joined: 02/10/2012
Location: Australia
Posts: 1094
Posted: 02:50am 22 Jan 2022
Copy link to clipboard 
Print this post

Worked for me to a WEMOS D1mini pro with a little pfaffing about!

In your step 4, I found the contents of download.config pulled down in step 1 were different to that shown in step 4 so I just copied all the contents of your code block in step 4 into a new download.config (after saving the original - just in case   ).

Ammended the file as per step 5 OK.

Steps 6,7,8 and 9 OK - I have esptool downloaded already on my Mint 20.2 system

Steps 10,11,12 all good - worked exactly the same under Linux..

Step 13 - OK after I figured out how to get CRLF from Rob Rozee's GFXterm64

- as you say, you MUST send CRLF - in GFXterm64 that is Alt/Enter

I can now carry out a variety of AT commands OK, connect to my router OK etc.

It would be realy nice if someone could explain the memory map structure of the ESP8266 (or where to find it) and in particular, how this relates to all the different modules ie. ESP-01, WEMOS D1, NODE MCU etc. etc. Also, I could not find any details on the differences between an ESP8266 and an ESP8266EX (the WEMOS D1mini pro has an ESP8266EX with 16MB Flash.

Thanks for the detailed explanation.

Doug.
... almost all of the Maximites, the MicromMites, the MM Extremes, the ArmMites, the PicoMite and loving it!
 
Print this page


To reply to this topic, you need to log in.

© JAQ Software 2024