ESP-01 does not permanently save new baud rate setting

I am using an ESP-01 (upgraded to the current latest AT firmware; ESP8266 NonOS AT Bin V1.7.1) and Arduino IDE and i want to permanently change the baud rate from its default of 115200 to 9600. In Serial Monitor, i typed the following AT commands with the corresponding responses:

At the default baud rate of 115200:

AT

OK
AT+GMR
AT version:1.7.1.0(Jul 15 2019 16:58:04)
SDK version:3.0.1(78a3e33)
compile time:Jul 15 2019 18:12:41
Bin version(Wroom 02):1.7.1
OK
AT+UART_DEF=9600,8,1,0,0

OK

And if i type AT then there is no response, and i change to baud rate of 9600:

AT

OK
AT+GMR
AT version:1.7.1.0(Jul 15 2019 16:58:04)
SDK version:3.0.1(78a3e33)
compile time:Jul 15 2019 18:12:41
Bin version(Wroom 02):1.7.1
OK
AT+RST

OK

Then, there is no response at that baud rate anymore. It reverts back to 115200. The same thing happens when i disconnect the ESP from its power source and reconnect. The baud rate is reset to its default baud rate. How do i permanently save this baud rate change to 9600?
Here is the official AT instruction set for ESP8266: https://www.espressif.com/sites/default/files/documentation/4a-esp8266_at_instruction_set_en.pdf
But i could not find any other commands to make this change permanent. I already tried:AT+UART_DEF=9600,8,1,0,0

what does "AT_UART_DEF?" return.

it is because you flashed a 2 MB firmware to a 512kB flash?

Juraj:
what does "AT_UART_DEF?" return.

it is because you flashed a 2 MB firmware to a 512kB flash?

This is what i get:

AT+UART_DEF=9600,8,1,0,0

OK

I think that for my ESP-01 model, it has 512+512 = 1 MB flash? During flashing, this is the detected info:

flash vendor:
E0h : N/A
flash devID:
4014h
QUAD;8Mbit
crystal:
26 Mhz

I tried again with flash size of 4Mbit, but it goes in a looping sequence for baud 74880. I did some trial and error and went back to the earliest AT firmware available: 1.5.1 and i used these settings which finally worked for my ESP-01 model.
![zf⸮[:fJ⸮JO⸮⸮s⸮S⸮⸮ ؒ⸮⸮⸮⸮e⸮
ready
AT

OK
AT+GMR
AT version:1.5.0.0(Oct 24 2017 12:03:18)
SDK version:2.1.0(ace2d95)
compile time:Oct 24 2017 15:48:02
Bin version(Wroom 02):1.5.1
OK


It seems like everything went fine!

I then upgraded to the latest compatible ESP8266 AT Bin V1.6.2 and everything seems OK. 

AT+GMR
AT version:1.6.2.0(Apr 13 2018 11:10:59)
SDK version:2.2.1(6ab97e9)
compile time:Jun  7 2018 19:34:26
Bin version(Wroom 02):1.6.2
OK


I could not upgrade to ESP8266 AT Bin V1.7.0 and above, since it is missing the 512+512 at files. This is the description for ESP8266 AT Bin V1.7.0 and ESP8266 AT Bin V1.7.1:

> Limited by the size of the AT bin file, only `1024+1024 flash map` is supported by default.

![Flash151works.png|786x677](upload://sdNTxYi4LM0tsVFGdMco31507Ic.png)
I used ESP8266 AT Bin V1.5.1: https://www.espressif.com/sites/default/files/ap/esp8266_at_bin_v1.5.1.zip and these are my settings from the flash downloader tool:

0x00000     boot_v1.7.bin
0x01000     at/512+512/user1.1024.new.2.bin
0xFC000     esp_init_data_default.bin
0xFE0000     blank.bin


First, i entered AT+UART_DEF=9600,8,1,0,0 at baud rate of 115200 and got OK response. Then, at baud rate of 9600:

AT+GMR
AT version:1.5.0.0(Oct 24 2017 12:03:18)
SDK version:2.1.0(ace2d95)
compile time:Oct 24 2017 15:48:02
Bin version(Wroom 02):1.5.1
OK
AT+RST

OK
c_⸮RS⸮fJ⸮:f⸮[:fJ⸮JO⸮⸮s⸮S⸮⸮X⸮⸮⸮⸮⸮⸮
ready
AT+GMR
AT version:1.5.0.0(Oct 24 2017 12:03:18)
SDK version:2.1.0(ace2d95)
compile time:Oct 24 2017 15:48:02
Bin version(Wroom 02):1.5.1
OK


Software reset seems to store the baud setting and so does a hardware reset. I think that i've finally found a winning combination!

Edit: I went through the official AT instruction set document: https://www.espressif.com/sites/default/files/documentation/4a-esp8266_at_instruction_set_en.pdf
and i found this section which is relevant to my particular ESP-01 model:
![8Mbitflash.png|754x389](upload://iDt26eLXOWT9xJWW7TkMF6Ezyy1.png)
I selected the firmware files in the same order as shown above and hopefully flashed it properly.
![finalflash.png|779x676](upload://jCg2cv5Q8t18nnMaQ13q3cpUxgf.png)

AT

OK
AT+RST

OK
c_⸮RS⸮fJ![zf⸮[:fJ⸮JO⸮⸮s⸮S⸮⸮ ؒ⸮⸮⸮⸮e⸮
ready
AT

OK
AT+GMR
AT version:1.5.0.0(Oct 24 2017 12:03:18)
SDK version:2.1.0(ace2d95)
compile time:Oct 24 2017 15:48:02
Bin version(Wroom 02):1.5.1
OK


It seems like everything went fine!

I then upgraded to the latest compatible ESP8266 AT Bin V1.6.2 and everything seems OK. 

AT+GMR
AT version:1.6.2.0(Apr 13 2018 11:10:59)
SDK version:2.2.1(6ab97e9)
compile time:Jun  7 2018 19:34:26
Bin version(Wroom 02):1.6.2
OK


I could not upgrade to ESP8266 AT Bin V1.7.0 and above, since it is missing the 512+512 at files. This is the description for ESP8266 AT Bin V1.7.0 and ESP8266 AT Bin V1.7.1:

> Limited by the size of the AT bin file, only `1024+1024 flash map` is supported by default.

![Flash151works.png|786x677](upload://sdNTxYi4LM0tsVFGdMco31507Ic.png)

![8Mbitflash.png|754x389](upload://iDt26eLXOWT9xJWW7TkMF6Ezyy1.png)

![finalflash.png|779x676](upload://jCg2cv5Q8t18nnMaQ13q3cpUxgf.png)

is it always the same esp-01? in the "detected info" field you had 4 Mb on some sreenshots

Juraj:
is it always the same esp-01? in the "detected info" field you had 4 Mb on some sreenshots

If you're also referring to my previous thread: Using Arduino UNO to flash firmware on ESP-01 - Project Guidance - Arduino Forum then it's always been detected as 8Mbit. Maybe it's the output that i pasted from the Serial Monitor that caused some confusion?

sorry, I really thought I saw 4 Mbit on some screenshot.

the 1.7.1 can be flashed to 1 MB module by forcing 16Mbit-C1 setting. the second MB is used only for OTA update of the firmware

or you can use the AT Lobo builds of the 1.7 AT firmware. GitHub - loboris/ESP8266_AT_LoBo: New ESP8266 AT-Firmware with many added features

Juraj:
sorry, I really thought I saw 4 Mbit on some screenshot.

the 1.7.1 can be flashed to 1 MB module by forcing 16Mbit-C1 setting. the second MB is used only for OTA update of the firmware

or you can use the AT Lobo builds of the 1.7 AT firmware. GitHub - loboris/ESP8266_AT_LoBo: New ESP8266 AT-Firmware with many added features

I did the same procedure with 1.7.1 in my first post above. It seems to work fine with some common AT commands except that saving the new baud rate in the flash memory did not work, since the new baud rate is lost every time the module is reset. I think maybe it's a limitation or incompatibility of the 1.7.0 and 1.7.1 firmware due to officially supporting only 1024+1024 flash map and missing the necessary 512+512 flash map needed for my ESP-01 module??

I actually went through the entire flashing procedure again to check. I used the following hex codes from the official Espressif AT instruction set:

These are the settings that i used:


(you can open the image in a new tab or download it from the post attachment for a full-size view)

I got a FINISH message on the big green button from the ESP8266 Download Tool. The ESP-01 module seems to work fine with AT+GMR giving the correct firmware information but when trying to set a new baud rate, it just refused to save it in the flash after a reset. So, the baud rate always went back to 115200.

I had no problems with baud rate with AT 1.7 on 1 MB flash

I took all 4 of my ESP-01 modules with the 1 Mb, and flashed AT 1.7.1
I can also confirm that the baud rate is NOT being saved.
I flashed using 16Mbit-C1.

Unless you have the ESP-01, I suggest you re-try with such a module and not any others.

.

ieee488:
I took all 4 of my ESP-01 modules with the 1 Mb, and flashed AT 1.7.1
I can also confirm that the baud rate is NOT being saved.
I flashed using 16Mbit-C1.

Unless you have the ESP-01, I suggest you re-try with such a module and not any others.

.

Thanks for the confirmation, ieee488.

I'm not sure if i'm missing out on some important setting though. Maybe juraj can have a closer look at my screenshots? It would be really nice to have the latest firmware 1.7.x fully working on the ESP-01. Right now, it seems like the 1.6.x firmware is the limit.

This is an actual zoomed picture of my ESP-01 if it helps to compare the chip model, etc:

I have the same module as you.

After I go get something to eat, I am going to reflash with AT firmware that I knew worked.

I reFlashed with AT 1.6
And the baud rate is saved even after power cycle.

I am going back to AT 1.6

boot_v1.7.bin     0x00000
512+512\user1.1024.new.2.bin     0x01000
esp_init_data_default_v08.bin     0xfc000
blank.bin     0x7e000
blank.bin     0xfe000

The minute I put back AT firmware 1.6, the ESP-01 module appeared in the tablet's wifi list.

.

I remember a couple years back there were multiple reports of ESP-01 modules that had bad flash chips. I've always found it annoying how with the ESP8266 you have this variable of the flash chip, which is up to the module manufacturer, rather than Espressif. With an ATmega328P, you know exactly what you're getting. You'd think the situation would be better with the ESP-01, since you don't have the metal shield hiding the flash chip, but I've never been able to find datasheets for the flash chips on my ESP-01s.

I don't remember this specific problem being reported for the bad flash chips though. I suppose it's possible that the 1.6 AT firmware writes the baud rate setting to a different area of flash than the 1.7 firmware and the area of flashed used by the 1.7 firmware is not working?

sorry, I swap a 4 MB esp-12F and a 1 MB esp-01 for tests. it is possible I missed 9600 baud test after reset. I retest. I damaged my esp-01 few days ago (my first damaged board). I just got a new one.

I use esptool.py, not the FDT (it doesn't work on Linux). You could try

esptool.py write_flash --flash_size 2MB-c1 0x0 boot_v1.7.bin 0x01000 at/1024+1024/user1.2048.new.5.bin 0x1fb000 blank.bin 0x1fc000 esp_init_data_default_v08.bin 0xfe000 blank.bin 0x1fe000 blank.bin

there is still the AT Lobo build of 1.7 for 1 MB module

so yes. the 2MB bin of AT firmware 1.7.1 flashed to 1 MB module doesn't save the values it should remember in "User Parameter Area" (appendix A in AT reference).
The values remembered by SDK in "System Parameter Area" are remembered (AT+CWMODE, AT+CWJAP, AT+CWSAP and AT+CWAUTOCONN)

Juraj:
so yes. the 2MB bin of AT firmware 1.7.1 flashed to 1 MB module doesn't save the values it should remember in "User Parameter Area" (appendix A in AT reference).
The values remembered by SDK in "System Parameter Area" are remembered (AT+CWMODE, AT+CWJAP, AT+CWSAP and AT+CWAUTOCONN)

Can you explain the difference between User Parameter Area and System Parameter Area?
What are the addresses?

AT+UART_DEF is saved in the User Parameter Area but the ESP-01 has no room for it?

.

ieee488:
Can you explain the difference between User Parameter Area and System Parameter Area?
What are the addresses?

AT+UART_DEF is saved in the User Parameter Area but the ESP-01 has no room for it?

System area is handled by SDK. It is same with any application like AT firmware or your sketch. I guess the SDK is not confused about the not valid flash size set at flashing. The system area is always the last page of the flash memory.

The user area is simply an area in flash which AT firmware developers decided to use to store the parameters of the AT firmware. And again I guess that the AT firmware has the address of the "user area" set at build time. The location of the 'user area' is mentioned in AT reference as one of the blank.bin addresses. It is 0xFE000 for 16Mbit C1 which is the 1 MB so off the 1 MB flash.

If the 'system area' would not work I would notice right away, because I always use the stored SSID and password. But I didn't do more test on 1 MB flash with my WiFiEspAT library on the official build of AT 1.7. I tested it on 1 MB flash with the AT Lobo build.

Thank you for the explanation.

I will stay with AT 1.6