khcnz / Espressif2Arduino

Allows for OTA updates from an Espressif ESP8266 V2 OTA image to an Arduino image by replacing the bootloader and dynamically patching the binary memory offsets
25 stars 13 forks source link

Issues when flashing ROM3 #5

Open StSimmons opened 7 years ago

StSimmons commented 7 years ago

As raised in https://github.com/mirko/SonOTA/issues/11

I think i know what may be wrong - i was testing a slightly different configuration and noticed that sometimes the buffer downloading the new images doesn't fill up - and when it doesn't fill up in multiples of 4 bytes bad things happen (the flash doesn't write correctly). I have a fix in the works but for now you will have to flash it with serial cable sorry.
khcnz commented 7 years ago

Should be fixed..

StSimmons commented 7 years ago

Some interesting findings after I tried to flash a new device:

Is it possible that the new version somehow loses the wifi credentials?

khcnz commented 7 years ago

Are you sure it didn't actually flash Tasmota? The wifi credentials don't carry over to tasmota. If you push the button does it turn the relay on and off?

StSimmons commented 7 years ago

Pressing the button does nothing. No relay firing, nor any other press combo triggering other tasmota functionality.

khcnz commented 7 years ago

If it's still flashing then probably still running e2a. I didn't make any changes that specifically effect the wifi credentials - however whereas previously a failed flash would have corrupted the bootloader (and prevented booting) now the bootloader is written last only once the entire rest of new rom is flashed in place. Which E2A image did it download last (before trying the tasmota one)?

khcnz commented 7 years ago

I read wifi creds from 0x79000 -> 0x79066.

However when flashing to rom slot 1 first it erases/wipes 0x01000->0x80000 - so yes if it fails wifi creds will be gone.. I'll think about how to solve this (store to rtc? store at end of flash?)- i'd also like the wifi creds to migrate over to tasmota.

StSimmons commented 7 years ago

It didn’t download any - I installed the E2A user2 (0x08100) image first using SonOTA. E2A then successfully booted and grabbed the Tasmota image.

Note: these are all manual builds for the Sonoff Touch. E2A was built off of HEAD for Sonoff Touch, and I build Tasmota 5.x.x with the No SPIFFS option (as they suggest for v5 images)

One thing to note - it did try to grab the 8266 image - which I assume means that it was trying to flash a Touch in QIO. I did think it should use DOUT, no?

khcnz commented 7 years ago

DIO normally (but I think DOUT also works?). If its flashing (but its not running tasmota) then I would think it must still be E2A. I'd wager its as per above, I wiped the rom including the wifi creds. It should try 3 times to install - if all three times fail it will reboot (and therefore no wifi creds anymore..)