A place users can post their projects. If you have a small project and would like your own dedicated place to post and have others chat about it then this is your spot.

User avatar
By bestonia
#61520 I just purchased two new sonoff s20's and tried to flash one with some custom firmware to it but it is having serious problems connecting to the unit's wifi.

I've tried espeasy and Sonoff-MQTT-OTA-Arduino, even the simple example sketches from ESP8266Wifi fail to connect to the router. I have also tried setting it to SoftAP mode and tried to connect to it, but am unable to get an IP address (both from android phone or pc). I'm using the settings in the screenshot.

Does anyone have any idea of what I can try to further debug the issue. For all I can see the unit is broken. (although I never tested it with the stock firmware before flashing it)

Capture3.JPG


Alternatively, I have tried to restore the stock firmware by taking a backup from the working unit and transfer it across but that doesn't work either. (although I'm not 100% sure this is the correct procedure..)
I can create a backup ok with:
> python esptool.py --port com5 --baud 230400 read_flash 0 1048567 sonoff-original.bin
And I can flash it back with the following, but it doesn't seem to work
>python esptool.py --port com5 write_flash --flash_mode dio --verify 0 sonoff-original.bin

Any help would be appreciated
You do not have the required permissions to view the files attached to this post.
User avatar
By kimon_m
#61529 I've found that with Sonoffs that I first have to erase the flash prior to flashing custom firmware. Otherwise, I have gotten strange behavior.

On a Linux box, I use: esptool.py -p /dev/ttyUSB1 erase_flash
Where /dev/ttyUSB1 is whatever port that you plug the Sonos into, of course. esptool can be downloaded from:
https://github.com/espressif/esptool/bl ... esptool.py

I have programmed one S20 successfully after first erasing it.

-Kimon
User avatar
By bestonia
#61557 Hi thanks,
I did try that but unfortunately it always seems to give the errors like below. perhaps this could be part of the problem?

Code: Select all>python esptool.py --port COM5 erase_flash
esptool.py v1.3-dev
Connecting...
Running Cesanta flasher stub...
Erasing flash (this may take a while)...
A fatal error occurred: Erase chip failure, status: ff

>python esptool.py --port COM5 erase_flash
esptool.py v1.3-dev
Connecting...
Erasing flash (this may take a while)...
A fatal error occurred: Timed out waiting for packet header
User avatar
By bestonia
#61975 So after reading around it seemed like a dodgy FTDI usb to serial chip could be the problem, so I picked up a better one but still no luck.
Eventually i tried flashing the second unit I had and it worked perfectly.

So the problem remains with the first unit. I can flash arduino projects to control the button and led just fine. The wifi scanner project just doesn't find any wifi networks about, indicating that the wifi is somehow just broken on this unit.