Flashing an S20

Code tips and tricks for beginners
Post Reply
Stuart
Posts: 20
Joined: Fri Feb 19, 2021 7:46 pm
Has thanked: 1 time
Been thanked: 4 times

Flashing an S20

Post by Stuart »

I always seem to trip over the simplest of things.

I have just flashed the latest software 1.43.2 onto an S20 switch (via the Win Toolkit). The flash reported success. But it does not appear on the lan at its previous address and its mac does not appear on the router. So, normally I would look at the serial terminal which would tell me the actual ip address. Maybe it defaulted to 4.1.

How do I get the S20 to talk to the serial terminal so I can see the ip address? Normally for an ESP-01 I would press reset on my little flash assembly. There is no reset on the S20. How else can I find the ip address that it thinks it has?

It is these simple things that seem to take all the time.

Stuart
User avatar
Electroguard
Posts: 179
Joined: Mon Feb 08, 2021 6:22 pm
Has thanked: 40 times
Been thanked: 102 times

Re: Flashing an S20

Post by Electroguard »

You access the serial monitor in the same way you flashed it, by cross-connecting the Sonoffs TX and RX to a uart.
So whatever method you used to boot the Sonoff into flashing mode while you held in its button, that's how you reboot the Sonoff with the serial connected, but without needing to hold the button cos you don't need it in flashing mode, you only want to connect to the serial monitor.

Alternatively you could bridge the Sonoffs TX and RX and boot it up to its default .4.1 address to check its config with wifi.

This is why I do the TX/RX mod to give the S20's easy TRRS jack socket access to TX and RX, both for flashing, and to use as gpio's.
cicciocb
Site Admin
Posts: 309
Joined: Mon Feb 03, 2020 1:15 pm
Location: Toulouse
Has thanked: 85 times
Been thanked: 197 times
Contact:

Re: Flashing an S20

Post by cicciocb »

Probably the module must be flashed in DOUT mode.
Stuart
Posts: 20
Joined: Fri Feb 19, 2021 7:46 pm
Has thanked: 1 time
Been thanked: 4 times

Re: Flashing an S20

Post by Stuart »

So just to record the outcome: Sonoff relays and S20s need to be flashed with the advanced mode 'DOUT' setting. If you don't, the flash will not report an error, but they just won't work, and you won't know why. Also, remember that holding in the button as you power them on will put them into flash mode.
User avatar
Electroguard
Posts: 179
Joined: Mon Feb 08, 2021 6:22 pm
Has thanked: 40 times
Been thanked: 102 times

Re: Flashing an S20

Post by Electroguard »

No, what you say is not correct.
Firstly, there have been at least 2 or 3 different versions of Sonoff S20's using different pcbs and different chip sets... so what works for one Sonoff may not work for another. On top of that, S20's have been superceded by S26's which again have different versions and different chipsets.

The easy way around it is to re-use existing parameters - all Sonoffs come pre-loaded with firmware, so the way I choose to re-flash a Sonoff is to read the existing device details using the blue button first, then use green or yellow button to flash the device with its original settings as previously read by the blue button ... cos if those setting were previously correct for the device they should still be correct for it.

Hold the Sonoff button just during power-up to put it into flashing mode, else leave it alone.
You can find Serial Flasher How-To videos here... [External Link Removed for Guests]
including a specific S20 tutorial video here... [External Link Removed for Guests]
And here's a link to an S20 TX/RX Hack... [External Link Removed for Guests]
.
cicciocb
Site Admin
Posts: 309
Joined: Mon Feb 03, 2020 1:15 pm
Location: Toulouse
Has thanked: 85 times
Been thanked: 197 times
Contact:

Re: Flashing an S20

Post by cicciocb »

Just to complete, what is described by Electroguard is the right approach : "Read the existing parameters before flashing".

A little explanation on the flash modes.
The different flash modes are related on how the flash memory chip (linked to the ESP8266 or the ESP32) works.
The flash modes are essentially 4 :

DOUT - Two SPI pins are used to read flash data out. Slightly slower than DIO, because the address is written via the single MOSI data pin. This is the slowest- mode

DIO - Two SPI pins are used to write the flash address part of the command, and to read flash data out. Therefore these phases need half the clock cycles compared to standard SPI.

QOUT - Four SPI pins are used to read the flash data out. Slightly slower than QIO, because the address is written via the single MOSI data pin.

QIO - Four SPI pins are used to write the flash address part of the command, and to read flash data out. Therefore these phases need a quarter the clock cycles compared to standard SPI. This is the fastest mode

Not all memory chips support all of these modes that are function of the chip manufacturer.

BUT :
- All the chips work in DOUT

This means that the DOUT mode is the safest mode compared to the QIO that is the fastest one.

All these chips are loaded in the same way by the flashing utility and the Flash mode is only activated when the module boots on the chip.
This means that the toolkit cannot really know what is the memory mode of the chip.

So, as a general rule, always use the DOUT mode(the toolkit default mode) except if you are looking for an extra speed performance (around 15%) for the ESP8266.

As per my experience, all the ESP32 modules works in QIO mode, even if the toolkit reports a DIO mode when reading the existing configuration.
Post Reply