-->
Page 1 of 1

Sonoff Mini: OTA fails [error 8] = space?

PostPosted: Thu Jan 23, 2020 12:12 pm
by ItsEsp
Hi,

I'm trying to get OTA working with the Mini (ESP8285, 1MB). Flashing tasmota works, updating tasmota via webif works, considering the minimal image because of space.

Now, I do have custom code that i use on other ESPs. It has OTA, which works on a couple of ESP + SONOFF devices. However, on the Mini I fail - i believe because I'm missing something about flash size.

Device info
Code: Select all./esptool.py --port /dev/ttyS15 flash_id
   esptool.py v2.2.1
   Connecting....
   Detecting chip type... ESP8266
   Chip is ESP8285
   Uploading stub...
   Running stub...
   Stub running...
   Manufacturer: 51
   Device: 4014
   Detected flash size: 1MB


Flash via cable - works:
Code: Select all./esptool.py --port /dev/ttyS15 write_flash -fm dout -fs 1MB 0x0 firmware.$ip.bin
   esptool.py v2.3-dev
   Connecting....
   Detecting chip type... ESP8266
   Chip is ESP8285
   Uploading stub...
   Running stub...
   Stub running...
   Configuring flash size...
   Flash params set to 0x0320
   Compressed 329008 bytes to 233983...
   Wrote 329008 bytes (233983 compressed) at 0x00000000 in 21.0 seconds (effective 125.6 kbit/s)...
   Hash of data verified.


OTA flash - fails - error 8 shown via serial out
Code: Select allwhile true; do python2 ./espota.py -d -i $ip -p 8266 --auth=PASS -f firmware.$ip.bin -d -r -s; RC=$?; if [ "$RC" == "0" ]; then break; fi ;  sleep 1;echo; done
   17:48:31 [DEBUG]: Options: {'esp_ip': '192.168.177.34', 'host_port': 55888, 'image': 'firmware.192.168.177.34.bin', 'host_ip': '0.0.0.0', 'auth': 'PASS', 'esp_port': 8266, 'spiffs': True, 'debug': True, 'progress': True}
   17:48:31 [INFO]: Starting on 0.0.0.0:55888
   17:48:31 [INFO]: Upload size: 329008
   17:48:31 [INFO]: Sending invitation to: 192.168.177.34
   Authenticating...OK
   17:48:31 [INFO]: Waiting for device...
   Uploading: [==                                                          ] 3%
   17:48:31 [ERROR]: Error Uploading

   17:48:33 [DEBUG]: Options: {'esp_ip': '192.168.177.34', 'host_port': 58148, 'image': 'firmware.192.168.177.34.bin', 'host_ip': '0.0.0.0', 'auth': 'PASS', 'esp_port': 8266, 'spiffs': True, 'debug': True, 'progress': True}
   17:48:33 [INFO]: Starting on 0.0.0.0:58148
   17:48:33 [INFO]: Upload size: 329008
   17:48:33 [INFO]: Sending invitation to: 192.168.177.34
   Authenticating...OK
   17:48:33 [INFO]: Waiting for device...
   Uploading: [===                                                         ] 4%
   17:48:33 [ERROR]: Error Uploading

   17:48:34 [DEBUG]: Options: {'esp_ip': '192.168.177.34', 'host_port': 47630, 'image': 'firmware.192.168.177.34.bin', 'host_ip': '0.0.0.0', 'auth': 'PASS', 'esp_port': 8266, 'spiffs': True, 'debug': True, 'progress': True}
   17:48:34 [INFO]: Starting on 0.0.0.0:47630
   17:48:34 [INFO]: Upload size: 329008
   17:48:34 [INFO]: Sending invitation to: 192.168.177.34
   Authenticating...OK
   17:48:34 [INFO]: Waiting for device...
   Uploading: [===                                                         ] 4%
   17:48:34 [ERROR]: Error Uploading


I've had the same behavior on an ESP8266 based device and fixed by doing the inital flash with " -fs 4MB".
Not suitable with the ESP8285 - but as you can see above the firmware is ~350kb or 250kb compressed.
Why wouldn't two of those (current + next) fit into memory?
Any guidance how to compress the firmware (to which target size?)

Kind regards,
ItsEsp