A fatal error occurred: Failed to connect to ESP32: Invalid head of packet (0x1B) - Arduino

  • I'm very sorry if this topic already posted before. But i can't seems to find any link for this error message related to m5Stack anywhere using Google Search.
    I'm new to M5stack but had using Arduino before.
    I have tried the Flow and it's working, I even had burn the Flow image into my m5Stick and m5Fire.

    Today i decide to test the Arduino IDE for both m5Stack.
    I have followed the steps https://docs.m5stack.com/#/en/quick_start/m5core/m5stack_core_get_started_Arduino_Windows
    But everytime i try to upload the code to the m5stack from Arduino, an error message is shown. I have tried using both m5stack (stick and fire) , and also on different usb com port

    ****Arduino: 1.8.8 (Windows 7), Board: "M5Stack-Core-ESP32, QIO, 80MHz, Default, 921600, None"

    Sketch uses 213644 bytes (16%) of program storage space. Maximum is 1310720 bytes.
    Global variables use 13840 bytes (4%) of dynamic memory, leaving 313840 bytes for local variables. Maximum is 327680 bytes.
    esptool.py v2.6-beta1
    Serial port COM3
    Connecting......................................____An error occurred while uploading the sketch

    A fatal error occurred: Failed to connect to ESP32: Invalid head of packet (0x1B)

    This report would have more information with
    "Show verbose output during compilation"
    option enabled in File -> Preferences.****

    ![alt text](0_1548660517621_Capture.PNG image url)

  • Arduino failed to connect to the M5Stack.
    Have you installed the serial driver?
    If yes, do you have a com or serial port shown up in Arduino?
    Have you tried another usb data lead?

  • I have already installed the Serial Driver from m5stack

    This is the screen capture of my Device Manager and my Arduino

    on the bottom right of arduino, it says none, is this normal?

  • It seems you have done everything correctly. The only thing I can suggest is that you try an older version of the arduino IDE. I'm using 1.8.5 I have heard reports that there were no issues in 1.8.7 either.

  • I have uninstall the Arduino and install the previous one (1.8.5)
    The problem still persist.
    By the way, when the Arduino is on the part "Connecting ..___...", the m5stack reset itself, is this normal or not?


  • I just thought, you were using the ui flow firmware previously right. I think there is an issue if you have flashed one of the micropython firmwares and try to use arduino afterwards without completely wiping the memory. Please try to use the erase tool in the M5 burner tool and then try and flash an arduino sketch again