SONOFF Mini - ESP8285 OTA fails with error 8 [out of space?]


I’m using different ESPs (NodeMCU, …) all over the house. They run a custom piece of code with customization for the purpose. OTA works for all of them meanwhile.

The SONOFF Mini is different - it has 1MB flash only and OTA fails :frowning:

Device info

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

Flashing via cable works

./ --port /dev/ttyS15 write_flash -fm dout -fs 1MB 0x0 firmware.$ip.bin v2.3-dev
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 fails - [error 8] on serial console

while true; do python2 ./ -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’: ‘’, ‘host_port’: 55888, ‘image’: ‘firmware.’, ‘host_ip’: ‘’, ‘auth’: ‘PASS’, ‘esp_port’: 8266, ‘spiffs’: True, ‘debug’: True, ‘progress’: True}
17:48:31 [INFO]: Starting on
17:48:31 [INFO]: Upload size: 329008
17:48:31 [INFO]: Sending invitation to:
17:48:31 [INFO]: Waiting for device…
Uploading: [== ] 3%
17:48:31 [ERROR]: Error Uploading

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

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

I’ve had error 8 earlier on another device and fixed it by using " -fs 4MB" on initial flash via cable.
However, the Mini doesn’t have that 4MB. On the other hand, the firmware seems to be 350kb only - so two versions of that should fit?

I’m guessing that I miss something - help is appreciated. What’s the FW size I’d need to shrink to - and how?

I’ve also flashed my SONOFF Mini with Tasmota - upgrading via WebUI works if i use the minimal image - which is similar in size to my customer FW.


Mmmh. If i select “board=8285” in platformio.ini i get up to 90% - better, but no real difference.

21:49:21 [DEBUG]: Options: {‘esp_ip’: ‘’, ‘host_port’: 39339, ‘image’: ‘firmware.’, ‘host_ip’: ‘’, ‘auth’: ‘Set4OTA’, ‘esp_port’: 8266, ‘spiffs’: True, ‘debug’: True, ‘progress’: True}
21:49:21 [INFO]: Starting on
21:49:21 [INFO]: Upload size: 329008
21:49:21 [INFO]: Sending invitation to:
21:49:21 [INFO]: Waiting for device…
Uploading: [====================================================== ] 90%
21:49:31 [ERROR]: Error Uploading

Do you have simulatenous logs from the devicie during upload?

Mmh. Another erase flash and now it seems to work. Interessting, the main change was in platformio.ini, change the board type to 8285, which didn’t actually change the firmware size, but maybe the definition inside? --help erase_flash --port /dev/ttyS15 write_flash -fm dout -fs 1MB 0x0 firmware.$ip.bin -d -i $ip -p 8266 --auth=PASS -f firmware.$ip.bin -d -r

22:11:50 [DEBUG]: Options: {‘esp_ip’: ‘’, ‘host_port’: 20355, ‘image’: ‘firmware.’, ‘host_ip’: ‘’, ‘auth’: ‘PASS’, ‘esp_port’: 8266, ‘spiffs’: False, ‘debug’: True, ‘progress’: True}
22:11:50 [INFO]: Starting on
22:11:50 [INFO]: Upload size: 329008
22:11:50 [INFO]: Sending invitation to:
22:11:50 [INFO]: Waiting for device…
Uploading: [============================================================] 100% Done…

Ok, works perfect now, including upload of newer code version.