Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OTA failed dev007->dev008 on Sonoff S20 plug (1MB) #303

Closed
hphde opened this issue May 17, 2017 · 34 comments

Comments

@hphde
Copy link

commented May 17, 2017

Steps to reproduce

How can we trigger this problem?
Try to OTA a 1MB device

Does the problem persist after powering off and on? (just resetting isn't enough sometimes)
yes

Expected behavior

Tell us what should happen?
Uploading a new version with same major should work

Actual behavior

Tell us what happens instead?
I had the v2.0.0-dev7 build on a Sonoff S20 and uploaded the dev8 (both from the git) and the upload worked but then I got a simple "flash failed" on the web page. Even worse nothing was working any more. Trying a hard reset (RX<->TX) didn't work either. I had to serial flash and hard reset.

System configuration

Hardware:
Sonoff S20 (unmodified)

Software or git version:
v2.0.0-dev8

@krikk

This comment has been minimized.

Copy link
Contributor

commented May 17, 2017

is most likely the problem that the current build is too large for 1m devices like the sonoff s20, if you compile yourself and remove a few plugins to bring size down it should work

@psy0rz

This comment has been minimized.

Copy link
Member

commented May 18, 2017

yes it probably is. i think there is some kind of check that hides the OTA option if the flash size is too small, but maybe we have to change it a bit.

indeed compiling it yourself with only the plugins you need should help as well.

@ghost

This comment has been minimized.

Copy link

commented May 21, 2017

If larger sketches are needed, using OTA on a 1MB module, you could use a "two stage upload trick".
I've used this many times with success in the past. I made the smallest thinkable sketch (approx 271kb size) that only loads the config from SPIFFS, connects to wifi and starts the webserver with the httpupdater loaded.

So you first upload the small "uploader" firmware and then upload the new ESP Easy firmware.

Max OTA upload size comparison:
When using ESP Easy to upload on modules with 1MB flash : 468k
Using this uploader firmware prior to uploading a new ESP Easy: 600k

@CherAlban

This comment has been minimized.

Copy link

commented Jun 2, 2017

That sounds at least like a feasible workaround. Could you make the "uploader" firmware available?

@psy0rz

This comment has been minimized.

Copy link
Member

commented Jun 5, 2017

isn't the uploader just ESPEasy without any plugins?

@psy0rz psy0rz added this to the 2.0.0 milestone Jun 5, 2017

@psy0rz

This comment has been minimized.

Copy link
Member

commented Jun 5, 2017

perhaps we should make this more clear on the OTA page for 1Mb devices.

@CherAlban

This comment has been minimized.

Copy link

commented Jun 6, 2017

What about making the binary available, as everybody with 1MB devices will need it?

@krikk

This comment has been minimized.

Copy link
Contributor

commented Jun 6, 2017

@CherAlban : look in the wiki

@CherAlban

This comment has been minimized.

Copy link

commented Jun 6, 2017

Excellent! Thanks!

@psy0rz

This comment has been minimized.

Copy link
Member

commented Jun 10, 2017

nice thanks:)

@psy0rz psy0rz closed this Jun 10, 2017

@CherAlban

This comment has been minimized.

Copy link

commented Jan 3, 2018

I am using the ESPEasyUploaderMega to update my Sonoff S20 1MB devices. It works well on older devices, but it fails to update newer devices that need DOUT flashing. Am I doing something wrong?

@CherAlban

This comment has been minimized.

Copy link

commented Jan 5, 2018

I tested again, it successfully installs the ESPEasyUploaderMega, but when upgrading to dev13, the web-interface never comes back. Does the ESPEasyUploaderMega image need to have DOUT flashing enabled when compiling?
I also have a problem with a Sonoff basic, which does not even accept the ESPEasyUploaderMega image.

Is somebody still reading this closed issue, or should I open a new one?

@TD-er

This comment has been minimized.

Copy link
Member

commented Jan 5, 2018

From what version did you do the upgrade to dev13?
The configuration structure is incompatible between <2.0 and 2.0 and newer.

@CherAlban

This comment has been minimized.

Copy link

commented Jan 5, 2018

I upgraded from dev12 to dev13, and also tried dev13 to 20180104

@CherAlban

This comment has been minimized.

Copy link

commented Jan 5, 2018

I read your comment in 474 about maybe enabling DOUT in the firmware. Is this true?

@psy0rz

This comment has been minimized.

Copy link
Member

commented Jan 5, 2018

we're reading all the new messages, even on closed issues :)

@CherAlban

This comment has been minimized.

Copy link

commented Jan 11, 2018

I don't know who prepared the current ESPEasyUploaderMega firmware, I assume this has been done by mvdbro?
Could somebody please comment on whether DOUT hast to be enabled inside the small uploader firmware? And if so, maybe create a version with DOUT enabled?

And btw, thanks for reading even closed issues :)

@Superpiffer

This comment has been minimized.

Copy link

commented Feb 15, 2018

I have the same problem, trying to update via OTA a Wemos D1 Mini Lite (ESP8252 based with 1MB). I successfully installed ESPEasyUploaderMega, it says " Flash Size: | 1024 kB Sketch Max Size: | 604 kB" but after the update from ESP_Easy_mega-20180212_normal_ESP8285_1024.bin to ESP_Easy_mega-20180214_normal_ESP8285_1024.bin (~580Kb) the device doesn't boot anymore.

@TD-er

This comment has been minimized.

Copy link
Member

commented Feb 15, 2018

Could it be that the config (SPIFF) was partly overwritten and thus the settings got corrupted?

@Superpiffer

This comment has been minimized.

Copy link

commented Feb 15, 2018

I don't know how to verify that. Serial output says:

INIT : Booting version: mega-20180212
INIT : Warm boot #1
FS   : Mounting...
FS   : Mount successful, used 75802 bytes of 113201
CRC  : program checksum       ...OK
CRC  : Settings CRC           ...OK
CRC  : SecuritySettings CRC   ...OK 
INIT : Free RAM:23032
INIT : I2C
INIT : SPI not enabled
WIFI : AP Mode disabled
WIFI : AP Mode ssid will be esp_bedroom_0 with address 192.168.4.1
WIFI : Connecting TIM-18569231 attempt #1
WIFI : Connected! IP: 192.168.1.89 (esp_bedroom_0)
WD   : Uptime 0 ConnectFailures 0 FreeMem 20760
Update: ESPEasyUploaderMega_1024.bin
                                    sleep disable
                                                 ..............................8
                                                                               .

 ets Jan  8 2013,rst cause:2, boot mode:(3,2)

load 0x4010f000, len 1384, room 16 
tail 8
chksum 0x2d                                          
csum 0x2d                                            
v09826c6d                                            
@cp:0                                                
     ld
       Update: ESP_Easy_mega-20180214_normal_ESP8285_1024.bin
                                                             sleep disable
                                                                          .....4
                                                                               .

 ets Jan  8 2013,rst cause:2, boot mode:(3,2)

load 0x4010f000, len 1384, room 16 
tail 8
chksum 0xef
csum 0xef
csum err
ets_main.c

After that is stucked and I have to erase and flash again with esptool.

@TD-er

This comment has been minimized.

Copy link
Member

commented Feb 15, 2018

I thought the checksum calculation was only informational and not blocking.
There is a checksum error, but since you upgraded from a version without checksum calculation, it is correct there is a checksum error.
So that won't tell us much.

But still, the image size of both firmware versions (intermediate and new version) + the size of SPIFF of both may not exceed the 1M size. And I think it did.
SPIFF on the 1M versions is 256k?

@Superpiffer

This comment has been minimized.

Copy link

commented Feb 15, 2018

There's the problem, the ESP8252 has 1M with no SPIFF so maybe ESPEasy OTA is impossibile with this board. Is that right?

@TD-er

This comment has been minimized.

Copy link
Member

commented Feb 15, 2018

I always thought SPIFF was just a setting of the image, not the device.
But there may be some limit of 512k addressable at once with the ESP8285? (not sure in what context I read it, but that idea pops up in my head right now)

@CherAlban

This comment has been minimized.

Copy link

commented Feb 15, 2018

My S20s are ESP8266 based, so it cannot be an "ESP8285 only" problem.

Superpiffer referenced this issue Feb 22, 2018
[issue #869] Added 'LWT' to last will topic and improved CPU load (#883)
* [issue #869] Added 'LWT' to last will topic and improved CPU load

See #869 for discussion on Last Will Topic.
Also changed the way it tried to reconnect to make it return a lot faster when connection is not (yet) possible and call the PubSubClient::loop() at a much slower pace to reduce CPU usage. (See #847)
This higher CPU load was probably introduced when fixing #683.

* [MQTT] Fix error reporting success status with longer payloads

Applied PR https://github.com/knolleary/pubsubclient/pull/360/files

* made MQTT_CALLBACK_SIGNATURE for esp32 functional

Applied PR knolleary/pubsubclient#336
@TD-er

This comment has been minimized.

Copy link
Member

commented Feb 23, 2018

The "competitor" (Tasmota) uses a lightweight in-between firmware to do OTA updates on the 1MB versions.
This inbetween version is about 300k in size.
Tasmota doesn't use SPIFF, so he doesn't have to worry about those settings getting lost during OTA update. (the storage area used by Tasmota is smaller)

I guess OTA on 1M flash is doomed to fail as long as we don't use a two-step flash procedure.

@Superpiffer

This comment has been minimized.

Copy link

commented Feb 23, 2018

The problem is that even with a two step procedure, with ESPEasyUploaderMega_1024.bin (as the wiki says), my board gets corrupted. I don't have another esp with 1M so I can't test if it works with others devices (i.e. non ESP8285).
Anyway, i just tested the "competition" and OTA works as expected, even without flashing an intermediate firmware! I like the flexibility of ESPEasy but I don't know if right now it's reliable enough for my pourpose...

@TD-er

This comment has been minimized.

Copy link
Member

commented Feb 23, 2018

So this is a proper usecase where it is needed to make smaller versions. Perhaps even custom built, by editing some kind of 'requirements' file?
Then you should be able to strip out things you don't need. For example no need to include OLED library and fonts for a device without OLED.

What 'devices' do you need on a Sonoff? Probably not much more than a switch i guess?

@Superpiffer

This comment has been minimized.

Copy link

commented Feb 23, 2018

Yes, in my case I have a Sonoff-like setup (I only need 2 relays and MQTT) so a "stripped" version is probably a better idea. Sooner or later I want to try and compile myself with only needed libraries and try OTA again.

@soif

This comment has been minimized.

Copy link
Contributor

commented Feb 25, 2018

@hphde @CherAlban @Superpiffer

Try my brand new EspBuddy at https://github.com/soif/EspBuddy

Once properly configured, it does the 2 steps OTA update in one simple command:
espbuddy.php upload my_device -v

You can also simply fetch (from the firmwares/ directory) a pre-compiled small OTA firmware that you can upload thru the ESPEasy web interface, and do the second step also via the web.

I've made dozen of OTA tests on various devices (nodemcu, wemos) and it works great. I've made less tests on 1M devices (sonoff TH16, ESP-01) but it should also work. BTW while testing the sonoff TH16 (1M), i had to have -DOUT on serial , and be sure to use the LATEST development branch version (with the PUYA fixes included), else the device would hang on boot

Please report success related to ESPEasy here, while report issues with EspBuddy related stuff in her own repo

@hphde

This comment has been minimized.

Copy link
Author

commented Feb 25, 2018

Thanks @soif but I soldered 4MB on all my 1MB devices

@stikla

This comment has been minimized.

Copy link

commented Mar 10, 2018

@soif ESPEasyUploader.OTA.1m128.esp8266.bin (from the /firmwares directory) works with Sonoff basic originally flashed with ESPEasy v2.0.0-dev12 and ESPEasy v2.0.0-dev13.

Using ESPEasyUploaderMega ends with
csum err
ets_main.c

ESPEasyUploader.OTA.1m128.esp8266.bin can be used as replacement for ESPEasyUploaderMega as it does not work with DOUT devices.

@soif

This comment has been minimized.

Copy link
Contributor

commented Mar 10, 2018

@soif ESPEasyUploader.OTA.1m128.esp8266.bin (from the /firmwares directory) works with >Sonoff basic originally flashed with ESPEasy v2.0.0-dev12 and ESPEasy v2.0.0-dev13.

GOOD news! Thanks for reporting it. 👍

Would you (or anyone having tested this firmware) pleae add your own tested hardware at:
https://github.com/soif/EspBuddy/wiki/Tested-Hardware

@stikla

This comment has been minimized.

Copy link

commented Mar 10, 2018

I must correct myself...

Note: see also UPDATE

_The (only) successful configurations was:

  1. over serial: erase chip
  2. over serial: flash ESPEasy v2.0.0-dev13
  3. over OTA: ESPEasyUploader.OTA.1m128.esp8266.bin
  4. over OTA: ESPEasy v2.0.0-dev13

But today nothing works... at least not every time._

UPDATE: ok, I think I found the reason...
After initial "over serial flash", as expected, we need to choose WLAN network .
After that we need to save config one more time! It can be the same config, without any other change.

As I can see, step 3) is then always successful.

And now the best part :)... and universal solution

For initial flash over serial I use FLASH_DOWNLOAD_TOOLS_V3.6.2.2
This tool has option "DoNotChgBin", normally not selected... and it shall stay not selected.

This tool changes bin file, dependent on chosen options QIO... DOUT etc.
So, if DOUT is selected it will write changed bin file to it's temp "_temp_by_dltool\downloadPanel1" directory, there where the original bin file is, with the same name, and new extension .bin_rep
That new bin file is then DOUT mode compatible :)

This way probably any bin file can be converted to DOUT compatible bin file.

I hope it helps ;)

@stikla

This comment has been minimized.

Copy link

commented Mar 12, 2018

For those interested here you can download DOUT version of known ESP Easy Uploader for 1M devices - ESPEasyUploaderMega_1024.bin

The bin file size is same as original - 270 KB (276.848 bytes)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
8 participants
You can’t perform that action at this time.