I was trying to test an example project hello_world and building is fine. But when trying to flash it on my esp32-c3 by using command idf.py -p COMX flash, an Invalid head of packet (0x47) problem was raised. I tied many times and some solutions but it still not solved.
Flashing environment:windows cmd & eclipse & clion
idf verison: 4.2.1
chip type: Esp32-C3-DevKitM-1
some attempts:
changing the baud rate, not working.
using anther kind of chip esp-32_devkitC(esp-wroom-32D), flashing project is ok.
using different environments, not working .
The full error information is listed below:
[1/4] Performing build step for 'bootloader'
ninja: no work to do.
[1/2] cmd.exe /C "cd /D D:\workandlearn\MISSU\MISSU_socket\esp-env\components\esptool_py && D:\workandlearn\MISSU\MISSU_socket\esp-IDF\.espressif\tools\cmake\3.16.4\bin\cmake.exe -D IDF_PATH="D:/workandlearn/MISSU/MISSU_socket/esp-env" -D ESPTOOLPY="python D:/workandlearn/MISSU/MISSU_socket/esp-env/components/esptool_py/esptool/esptool.py --chip esp32" -D ESPTOOL_ARGS="--before=default_reset --after=hard_reset write_flash @flash_args" -D WORKING_DIRECTORY="C:/Users/51680/eclipse-workspace/flash_test1/build" -P D:/workandlearn/MISSU/MISSU_socket/esp-env/components/esptool_py/run_esptool.cmake"
esptool.py --chip esp32 -p COM5 -b 460800 --before=default_reset --after=hard_reset write_flash --flash_mode dio --flash_freq 40m --flash_size 2MB 0x8000 partition_table/partition-table.bin 0x1000 bootloader/bootloader.bin 0x10000 hello-world.bin
esptool.py v3.0
Serial port COM5
Connecting....
WARNING: This chip doesn't appear to be a ESP32 (chip magic value 0x1b31506f). Probably it is unsupported by this version of esptool.
Chip is ESP32-D0WDQ6 (revision 0)
Features: WiFi, BT, Dual Core, Coding Scheme None
WARNING: Detected crystal freq 0.00MHz is quite different to normalized freq 26MHz. Unsupported crystal in use?
Crystal is 26MHz
MAC: 00:00:00:00:00:00
Uploading stub...
Running stub...
A fatal error occurred: Invalid head of packet (0x47)
CMake Error at run_cmd.cmake:14 (message):
esptool.py failed
Call Stack (most recent call first):
run_esptool.cmake:21 (include)
FAILED: CMakeFiles/flash
cmd.exe /C "cd /D D:\workandlearn\MISSU\MISSU_socket\esp-env\components\esptool_py && D:\workandlearn\MISSU\MISSU_socket\esp-IDF\.espressif\tools\cmake\3.16.4\bin\cmake.exe -D IDF_PATH="D:/workandlearn/MISSU/MISSU_socket/esp-env" -D ESPTOOLPY="python D:/workandlearn/MISSU/MISSU_socket/esp-env/components/esptool_py/esptool/esptool.py --chip esp32" -D ESPTOOL_ARGS="--before=default_reset --after=hard_reset write_flash @flash_args" -D WORKING_DIRECTORY="C:/Users/51680/eclipse-workspace/flash_test1/build" -P D:/workandlearn/MISSU/MISSU_socket/esp-env/components/esptool_py/run_esptool.cmake"
ninja: build stopped: subcommand failed.
Executing action: flash
Running ninja in directory c:\users\51680\eclipse-workspace\flash_test1\build
Executing "ninja flash"...
ninja failed with exit code 1
Problem encountered when flashing esp32-c3
Re: Problem encountered when flashing esp32-c3
Now your code is build for esp32. You have to set target first:
Here is the clue:
Code: Select all
idf.py set-target esp32c3
idf.py build // idf.py flash
PS im not sure, but you may need esp-idf v4.3+ to work with C3esptool.py --chip esp32
- ESP_krzychb
- Posts: 400
- Joined: Sat Oct 01, 2016 9:05 am
- Contact:
Re: Problem encountered when flashing esp32-c3
Hi gzy302577,
Welcome to the forum !
From the logs it looks like you are running esp-idf version 4.2.1 and the example project has been compiled for ESP32, not ESP32-C3.
v4.2.1 does not support ESP32-C3. As noted by chegewara, you need to use recently released v4.3-beta3 or newer.
Please follow https://docs.espressif.com/projects/esp ... index.html, install esp-idf version 4.3-beta3, compile and flash the example again.
Welcome to the forum !
From the logs it looks like you are running esp-idf version 4.2.1 and the example project has been compiled for ESP32, not ESP32-C3.
v4.2.1 does not support ESP32-C3. As noted by chegewara, you need to use recently released v4.3-beta3 or newer.
Please follow https://docs.espressif.com/projects/esp ... index.html, install esp-idf version 4.3-beta3, compile and flash the example again.
Who is online
Users browsing this forum: Bing [Bot] and 190 guests