Sonoff gateway: sketch uploads fine but doesn't run
Pretty weird behaviour here. I have two sonoff bought a couple of years ago acting as mqtt gateways with this sketch https://www.mysensors.org/build/sonoff running perfectly fine.
I've recently bought another couple and despite uploading the same sketch it just does not work (the two of them). Sketch and wiring is the same of those working, arduino IDE's settings the same, the output when flashing is the same without errors, the PCB layout is identical (the new model has just 3 screws for the case instead of one but doesn't matter).
After flashing just nothing happens (no serial output, no relay switching when pressing the button, no connection to the mqtt broker). I'd say it is a broken unit but doesn't make sense having two out of two broken and still able to be flashed (I'd have received a timeout error if the chip was completely broken). Tried flashing already multiple times without luck.
Anybody seen a similar behaviour? Any special protection added to the ESP8266 chip in recent models I need to take rid of?
kimot last edited by kimot
run command ( it is for Linux - use com with its number in Windows )
esptool.py --port /dev/ttyUSB0 flash_id
Sonnof must response with its chip ID
Something like this:
Connecting... Manufacturer: e0 Device: 4016
If it does, chip and connection is ok....
@kimot thanks you've definitely given to me the right direction to look into.
Looks like my chip info is different and is the following:
esptool.py v2.6 Serial port COM7 Connecting.... Detecting chip type... ESP8266 Chip is ESP8266EX Features: WiFi MAC: ec:fa:bc:86:da:e2 Uploading stub... Running stub... Stub running... Manufacturer: 5e Device: 4014 Detected flash size: 1MB Hard resetting via RTS pin...
I see that manufacturer 5e is given problems to many people so I've followed the advice I found here https://forum.micropython.org/viewtopic.php?t=3777 to actually solve the issue, specifically flashing with the
-fm doutflag (e.g.
esptool.py --port COM5 write_flash -fs 1MB -fm dout 0x0 file.bin) and now it works!
@user2684 There's a lot of info regarding flashing ESP devices on this site: https://github.com/arendst/Tasmota/wiki/Flashing and https://github.com/arendst/Tasmota/wiki/supported-devices
You could also consider running Tasmota on your Sonoff devices, as it contains much more functionality compared to MySensors MQTT gateway.