A fatal error occurred: Failed to connect to ESP32: Timed out waiting for packet header



  • Help!

    When I try uploading a sketch using Windows 10, and Arduino 1.8.15 to my Core2 I get the following:

    "Connecting...................................____
    A fatal error occurred: Failed to connect to ESP32: Timed out waiting for packet header"

    If I just select the "Serial Monitor" while the Core2's plugged in - when I reboot the Core 2, the Serial Monitor shows the bootup text, so the device is definitely connected AND communicating through all the USB ports I tried.

    The Core Grey I bought earlier is working fine... it flashes every time without issue.

    I've tried the following:

    1. I've used both USB cables that came with my Core Grey and Core2, and a 3rd party cable. (all three work with my Core Grey)
    2. I've slowed down/turned off the LIFO stacks in Device Manager for COM4 - where the device appears.
    3. I've slowed down the connection via Device Manager. (same windows as #2)
    4. Uninstalled Arduino software, then reinstalled.
    5. Used Device Manager to uninstall the serial drivers (ticked "From disk" too), then reinstalled by reinstalling the Arduino software.
    6. Googled online..... only found this for a bare ESP32 board: https://randomnerdtutorials.com/solved-failed-to-connect-to-esp32-timed-out-waiting-for-packet-header/
    7. Tried the USB 3 laptop socket (blue plastic).
    8. Tried the USB 2 laptop socket.
    9. Powered off the laptop and powered back on.
    10. Removed the Core2 battery, and tried flashing again.
    11. Tried using the esptool.exe 3.0-dev version on the command line in a temporary batch file. (same message)
      Command: "esptool.exe --chip esp32 --port COM8 --baud 921600 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq 80m --flash_size detect 0xe000 C:....esp32\1.0.6/tools/partitions/boot_app0.bin 0x1000 C:....esp32\hardware\esp32\1.0.6/tools/sdk/bin/bootloader_dio_80m.bin 0x10000 C:....\arduino_build_567398/circles.ino.bin 0x8000 C:....\Temp\arduino_build_567398/circles.ino.partitions.bin"
    12. Tried tapping the Reset button while "Connecting..." is being displayed.
    13. Arduino settings: Ensured the board is "M5Stack-Core2"
    14. Arduino settings: Tried 115200 for the upload speed.
    15. Tried a hub plugged into the laptop.
    16. Tried an externally powered USB 3 hub.

    I've ran out of things to try!

    Do I need a new Core2? How do I go about it? I don't want my money back - I love the touchscreen!



  • It turned out to be my Ryzen Swift 3 USB drivers!

    After updating them the problem resolved.