Wifi Relay Esp8266 spoilt

Am I reading this correctly in that even if I have backed up my original firmware using esptool, I will not be able to restore it again after loading any other firmware (even on the same board)?

@glyn.hudson if this is the case, it would be good to make this clear in the wiki. I had backed up my current firmware intending to do a bit of messing around customising it, but don’t want to risk losing the already highly functional original firmware it came with. Especially since the open source version is many commits behind my oem version.

Thanks to all for a great product :slight_smile:

It would work, if you backup all of the flash, but please note that if something goes wrong, it is a voided warranty

Thanks @Martin_Harizanov ; a way to get myself out of trouble it all I really expect.

flash_id returns Manufacturer: e0 Device: 4016, being a 4MB flash chip, so I used “esptool.py --port COM3 --baud 115200 read_flash 0x00000 0x400000 original.bin” to back it up. So that’s the lot, right?

@glyn.hudson ; the wiki says to use the argument “–flash_size 16m-c1” when updating from the command line, which doesn’t seem right in this context at least. I’d be inclined to just allow esptool to autodetect the flash size when updating (GitHub - espressif/esptool: Espressif SoC serial bootloader utility).

Perhaps that was @pychu 's original issue…

That seems right. Please post here if you were able to re-flash the original firmware after experimenting with custom one using this method.

Also regarding the WIKI argument, this is something else, it tells esptool to set up the partitions in 16M(1024+1024) mode. This is intentional; 16Mbit is 2MB. Please do not change this argument, this is the correct value

Hi @Martin_Harizanov; just closing the loop on this. Apologies for the delay, I had to make sure I had alternative firmware ready and time to sort it out before messing with the OEM firmware, just in case.

I was able to backup the original firmware (using Win10x64 PowerShell as Admin) with:
python esptool.py --port COM3 --baud 115200 read_flash 0x00000 0x400000 oem_v2609.bin

I then successfully uploaded and used custom firmware (using PlatformIO).

Attempting to reflash the OEM firmware using the command from the wiki page failed with the following response:

PS C:\Users\Denis\Documents\Git\esptool> python esptool.py --port COM3 --baud 460800 write_flash --flash_freq 80m --flas
h_mode qio --flash_size 16m-c1 0x1000 oem_v2609.bin
WARNING: Flash size arguments in megabits like '16m-c1' are deprecated.
Please use the equivalent size '2MB-c1'.
Megabit arguments may be removed in a future release.
esptool.py v2.0-beta1
Connecting....
Detecting chip type... ESP8266
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 460800
Changed.
Attaching SPI flash...
Configuring flash size...

A fatal error occurred: File oem_v2609.bin (length 4194304) at offset 4096 will not fit in 2097152 bytes of flash. Use --flash-size argument, or change flashing address.

However I was able to successfully reflash the backed up firmware using:

python esptool.py --port COM3 --baud 460800 write_flash --flash_freq 80m --flash_mode dio 0x00000 oem_v2609.bin

Which returned an error after flashing, but was all back to working fine after cycling the power:

PS C:\Users\Denis\Documents\Git\esptool> python esptool.py --port COM3 --baud 460800 write_flash --flash_freq 80m --flas
h_mode dio  0x00000 oem_v2609.bin
esptool.py v2.0-beta1
Connecting....
Detecting chip type... ESP8266
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 460800
Changed.
Attaching SPI flash...
Configuring flash size...
Auto-detected Flash size: 4MB
Flash params set to 0x024f
Compressed 4194304 bytes to 307265...
Wrote 4194304 bytes (307265 compressed) at 0x00000000 in 7.2 seconds (effective 4674.6 kbit/s)...

A fatal error occurred: Timed out waiting for packet header

I did have to connect to the AP and reconfigure wifi, but after that all settings were as they were at the time of backup.

So backup and restore works, more like reimaging an entire hard disk than backing up individual partitions.

Whilst your firmware would be a fantastic start to further tinkering, setting up an ESP8266 build environment for C in Windows was killing me, so I’m playing with others written in C++/Arduino using PlatformIO instead.

Best regards,
Denis.

2 Likes

Thanks for taking the time to describe the process, I haven’t done that myself before, so was curious too.
This is helpful to all that wish to experiment with own alternative firmware.
Regards,
Martin

1 Like