Unable to flash ESPHome to Sonoff M5

Hi,
I’m trying to flash ESPHome on Sonoff M5 switch. According to web tutorials, it should be trivial. I’m stuck with ESPHome being unable to connect to the device.

I have this programming device:
https://aliexpress.com/item/1005006127179718.html
I’ve set the connector to 3.3v and installed USB to serial driver CDM212364

Connected rt-tx, tx-rx, gnd, v3.3, and when turining on the device I keep the button pushed to enter programming mode.

From HA/ESPhome when I add new device, click connect, the interface asks for COM port (using chrome to do serial programming), but connection doesn’t succeed.

In ESPHome log there’s only a very long sequence like this, no errors:

2024-06-23 19:08:16,725 INFO 304 GET /devices (0.0.0.0) 1.64ms
2024-06-23 19:08:22,713 INFO 304 GET /devices (0.0.0.0) 1.64ms
2024-06-23 19:08:28,703 INFO 304 GET /devices (0.0.0.0) 1.41ms
2024-06-23 19:08:30,143 INFO 200 GET /devices (0.0.0.0) 1.53ms
2024-06-23 19:08:34,707 INFO 304 GET /devices (0.0.0.0) 1.65ms
2024-06-23 19:08:39,717 INFO 304 GET /devices (0.0.0.0) 1.35ms
2024-06-23 19:08:45,703 INFO 304 GET /devices (0.0.0.0) 1.61ms
2024-06-23 19:08:51,714 INFO 304 GET /devices (0.0.0.0) 1.50ms
2024-06-23 19:08:57,702 INFO 304 GET /devices (0.0.0.0) 1.46ms

Double tested that the device works normally, connected to 230V and eWeLink from smartphone, it works ok.

Any hints what else to try?

Same here. Have you found a solution?

Have You tried to connect GPIO0 to GND located nearby on board ?
I always connect pins, not pushing button.
So far working on 11 M5’s.

Yes, I already tried it. Maybe the problem is the USB2TTL; I have the same one linked by @jdukat (FT232RL Red Type-c).

I tried with esptool.py, and it gave me this error: Invalid head of packet (0xXX): Possible serial noise or corruption. (Troubleshooting - ESP32 - — esptool.py latest documentation)

Using CH340G & CP2102.

CP2102 are recognized by HAOS - can use directly on HA installed on RPi.
On PC prefer CH340G - looks more stable.

I have always flashed my ESP devices to a .bin file (manual install) and flashed using ESPHome Flasher.

I connected the TX to the RX of the USB2TTL, and it seems to be working properly. The problem might be with the M5 board.
How can I test if the TX and RX of the Sonoff M5 are working correctly?

I don’t know about the Sonoff M5, but the Sonoff labeling of +3,R,T,G has been consistent with all of the Sonoff devices I have here. And I have no experience with your particular FTDI, but I have seen one that mis-labeled the T & R. If nothing else seems to work, try connecting T-T and R-R. It can’t hurt anything.

1 Like

I’ve tested it and it’s still not working.
I’m going to buy the CH340G to see if the problem is the USB2TTL, it’s the only thing left.