logo elektroda
logo elektroda
X
logo elektroda

ESPHome does not connect to Sonoff M5 - USB programming problem

jdukat 693 4
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
  • #1 21136046
    jdukat
    Level 2  
    Hi,

    I am trying to upload ESPHome (from Home Assistants) to a Sonoff M5 switch. According to the online tutorials this should be easy. Unfortunately ESPHome cannot connect to the device.

    I am using this programmer:
    https://aliexpress.com/item/1005006127179718.html

    I have installed the USB driver for the serial port CDM212364.

    Note: unfortunately on the first connection I missed the fact that the output power jumper on the programmer was set to 5V. On the second attempt I had already set the jumper to 3.3V.

    I connected RX to TX, TX to RX, GND to GND, 3.3V to 3.3V and while connecting the programmer to the USB port on the computer I hold down the switch button to enter programming mode.

    When I add a new device in HA/ESPhome and click "connect", the interface asks for a COM port (I use Chrome for serial programming) but the connection fails.

    Only a very long string appears in the ESPHome logs, with 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
    .

    I know there is a risk that by connecting the first time with 5V I could have fried the device. Except that after unplugging the programmer the switch works without a problem, it connects to WiFi, the sonoff app sees the switch and is able to control it over WiFi, so it's definitely not completely burnt out.

    Unfortunately this is the only device I currently own where I could try to upload esphome.

    Any ideas what else to check to find the cause of the problem?
  • ADVERTISEMENT
  • #2 21167276
    p.kaczmarek2
    Moderator Smart Home
    Show pictures of connections.

    Maybe this USB to UART converter provides too little current for the ESP? I myself always supply 3.3V from an external LDO or I plug 5V from the USB in front of the AMS1117-3.3V on the device board.

    Are you sure this button is on GPIO0 and are you holding this button when power is applied? GPIO0 must have a potential low during the reboot.
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #3 21170234
    jdukat
    Level 2  
    >>21167276 .
    Hey, thanks for the reply.
    From the online articles I've looked at before, it seemed that an additional power supply shouldn't be needed, but here I found that it might be, though the symptoms the author had were different (constant reboots, and in my case it doesn't connect at all).
    Unfortunately I don't have a 3.3V power supply to check the additional source.

    Could you write how to check if GPIO0 "has a low potential during reboot"?
    I'm not 100% sure about this button, but there's also a GPIO0 pinout on the board - I tried shorting it to ground on startup, but it didn't change anything.

    I don't have a picture now as I have the whole thing disassembled at the moment, but if you hint at how to check this GPIO0, I'll reconnect and send a pic.
  • ADVERTISEMENT
  • #4 21177092
    p.kaczmarek2
    Moderator Smart Home
    You can use the cheapest multimeter in the continuity mode to check where GPIO0 connects.

    By the way, this tutorial seems to be for Sonoff M5 and it seems they recommend connecting IO0 to ground, and not holding the button?
    https://everythingsmarthome.co.uk/flashing-sonoff-switchman-m5-with-esphome/
    Helpful post? Buy me a coffee.
  • #5 21182519
    jdukat
    Level 2  
    >>21177092 .

    I have tried both the button hold and shorting GPIO00 to ground, in both cases the same result - ESPHome does not connect.
ADVERTISEMENT