Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A fatal error occurred: Failed to connect to ESP32: Invalid head of packet (0x08) (IDFGH-8077) #9580

Closed
pooja079 opened this issue Aug 18, 2022 · 8 comments
Assignees
Labels
Resolution: Won't Do This will not be worked on Status: Done Issue is done internally

Comments

@pooja079
Copy link

Hi
Please help someone I'm new to this, not able to flash the project:

C:\Users\WIN10\esp\hello_world>idf.py -p COM7 flash
Executing action: flash
Running ninja in directory c:\users\win10\esp\hello_world\build
Executing "ninja flash"...
[1/5] cmd.exe /C "cd /D C:\Users\WIN10\esp\hello_world\bui....bin C:/Users/WIN10/esp/hello_world/build/hello_world.bin"
hello_world.bin binary size 0x29730 bytes. Smallest app partition is 0x100000 bytes. 0xd68d0 bytes (84%) free.
[2/5] Performing build step for 'bootloader'
[1/1] cmd.exe /C "cd /D C:\Users\WIN10\esp\hello_world\build\bootloader\esp-idf\esptool_py && C:\Espressif\python_env\idf4.4_py3.8_env\Scripts\python.exe C:/Espressif/frameworks/esp-idf-v4.4/components/partition_table/check_sizes.py --offset 0x8000 bootloader 0x1000 C:/Users/WIN10/esp/hello_world/build/bootloader/bootloader.bin"
Bootloader binary size 0x62b0 bytes. 0xd50 bytes (12%) free.
[2/3] cmd.exe /C "cd /D C:\Espressif\frameworks\esp-idf-v4.../esp-idf-v4.4/components/esptool_py/run_serial_tool.cmake"
esptool.py esp32 -p COM7 -b 460800 --before=default_reset --after=hard_reset write_flash --flash_mode dio --flash_freq 40m --flash_size 2MB 0x1000 bootloader/bootloader.bin 0x10000 hello_world.bin 0x8000 partition_table/partition-table.bin
esptool.py v3.2-dev
Serial port COM7
Connecting......................................

A fatal error occurred: Failed to connect to ESP32: Invalid head of packet (0x08): Possible serial noise or corruption.
For troubleshooting steps visit: https://github.com/espressif/esptool#troubleshooting
CMake Error at run_serial_tool.cmake:56 (message):
C:/Espressif/python_env/idf4.4_py3.8_env/Scripts/python.exe
C:/Espressif/frameworks/esp-idf-v4.4/components/esptool_py/esptool/esptool.py
--chip esp32 failed

FAILED: CMakeFiles/flash
cmd.exe /C "cd /D C:\Espressif\frameworks\esp-idf-v4.4\components\esptool_py && C:\Espressif\tools\cmake\3.20.3\bin\cmake.exe -D IDF_PATH="C:/Espressif/frameworks/esp-idf-v4.4" -D SERIAL_TOOL="C:/Espressif/python_env/idf4.4_py3.8_env/Scripts/python.exe C:/Espressif/frameworks/esp-idf-v4.4/components/esptool_py/esptool/esptool.py --chip esp32" -D SERIAL_TOOL_ARGS="--before=default_reset --after=hard_reset write_flash @flash_args" -D WORKING_DIRECTORY="C:/Users/WIN10/esp/hello_world/build" -P C:/Espressif/frameworks/esp-idf-v4.4/components/esptool_py/run_serial_tool.cmake"
ninja: build stopped: subcommand failed.
ninja failed with exit code 1

C:\Users\WIN10\esp\hello_world>

@espressif-bot espressif-bot added the Status: Opened Issue is new label Aug 18, 2022
@github-actions github-actions bot changed the title A fatal error occurred: Failed to connect to ESP32: Invalid head of packet (0x08) A fatal error occurred: Failed to connect to ESP32: Invalid head of packet (0x08) (IDFGH-8077) Aug 18, 2022
@radimkarnis
Copy link
Collaborator

radimkarnis commented Aug 18, 2022

Hello @pooja079,

the most probable cause of this is that your devkit is not automatically switching into the download mode. This can be verified by using a newer version of esptool - wrong boot mode detection has been implemented in v3.2. You can download the latest esptool from the repository or from PyPI, or you can update ESP-IDF.

If your board has boot and reset buttons, you can try entering the download mode manually. (Press the reset button while holding the boot button before flashing, or just hold the boot button while attempting to flash)

Please let me know if this helps. If not, we can try some more troubleshooting.

@pooja079
Copy link
Author

Thank You @radimkarnis ,

Let me try and get back to you

@pooja079
Copy link
Author

Hi,
I'm using
ESP-IDF V4.4
ESP32 LyraT V4.3

@radimkarnis
Copy link
Collaborator

@pooja079, sorry for not explaining.

ESP-IDF uses a utility called esptool.py under the hood to flash the compiled app binaries to the chip. You can see esptool runs and its output in your log, it is this part:

esptool.py v3.2-dev
Serial port COM7
Connecting......................................

A fatal error occurred: Failed to connect to ESP32: Invalid head of packet (0x08): Possible serial noise or corruption.

Esptool connects to the chip and if successful, sends the binary over. In order for it to connect, the ESP chip has to be switched into a download mode. This switch usually happens automatically, but if that for whatever reason fails, you can also switch it manually.

Press the reset button while holding the boot button before flashing, or just hold the boot button while attempting to flash

My advice to you here is to try switching into download mode manually.

If this doesn't help, you can try updating ESP-IDF to a newer version, which will also update esptool.py to a newer version. Updated esptool would either solve the problem or give us more information about the problem.

@radimkarnis
Copy link
Collaborator

radimkarnis commented Aug 18, 2022

I can see you are using ESP32 LyraT V4.3. This board requires some jumpers to be installed for automatic upload to work. Please see the details here. Also check the board layout picture to see where the jumpers and reset/boot buttons are.

@radimkarnis
Copy link
Collaborator

@pooja079 did you manage to flash your device?

@JegadeeshXaglabs
Copy link

Don't boot the ESP32 too many times.

@pooja079
Copy link
Author

@pooja079 did you manage to flash your device?

Yes, by using jumpers
Thanks

@espressif-bot espressif-bot added Status: Reviewing Issue is being reviewed and removed Status: Opened Issue is new labels Sep 22, 2022
@espressif-bot espressif-bot added Resolution: Won't Do This will not be worked on Status: Done Issue is done internally and removed Status: Reviewing Issue is being reviewed labels Sep 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution: Won't Do This will not be worked on Status: Done Issue is done internally
Projects
None yet
Development

No branches or pull requests

5 participants