esp32-s2: Invalid head of packet (0xC4)

mgarel
Posts: 3
Joined: Mon Aug 17, 2020 3:24 am

esp32-s2: Invalid head of packet (0xC4)

Postby mgarel » Mon Aug 17, 2020 3:28 am

When using the dev saola dev board, and flashing via usb either with idf.py or eclipse, I have no issues. However, trying to flash over UART with either the dev board, my own design, or only the esp32-s2 with wires soldered to it I get this error:

A fatal error occurred: Invalid head of packet (0xC4)
CMake Error at run_cmd.cmake:14 (message):
esptool.py failed
Call Stack (most recent call first):
run_esptool.cmake:21 (include)

Any ideas?

Thanks,
Michael

ESP_Sprite
Posts: 9051
Joined: Thu Nov 26, 2015 4:08 am

Re: esp32-s2: Invalid head of packet (0xC4)

Postby ESP_Sprite » Mon Aug 17, 2020 7:48 am

Hard to say... if you run 'idf.py build', it should spit out an esptool.py command line. Can you run that line manually (making sure to insert things like the port to use) but add '--trace' somewhere? That should show the entire dialog between chip and tool.

mgarel
Posts: 3
Joined: Mon Aug 17, 2020 3:24 am

Re: esp32-s2: Invalid head of packet (0xC4)

Postby mgarel » Mon Aug 17, 2020 6:36 pm

Here's the output running --trace.

Michaels-MBP:esptool_py michael$ cd /Users/michael/esp/esp-idf/components/esptool_py && /Users/michael/.espressif/tools/cmake/3.16.4/CMake.app/Contents/bin/cmake -D IDF_PATH="/Users/michael/esp/esp-idf" -D ESPTOOLPY="/Users/michael/.espressif/python_env/idf4.2_py2.7_env/bin/python /Users/michael/esp/esp-idf/components/esptool_py/esptool/esptool.py --chip esp32s2" -D ESPTOOL_ARGS="--before=default_reset --after=hard_reset write_flash @flash_args" -D WORKING_DIRECTORY="/Users/michael/esp/hello_world/build" -P /Users/michael/esp/esp-idf/components/esptool_py/run_esptool.cmake --trace
Running with trace output on.
/Users/michael/esp/esp-idf/components/esptool_py/run_esptool.cmake(9): cmake_minimum_required(VERSION 3.5 )
/Users/michael/esp/esp-idf/components/esptool_py/run_esptool.cmake(11): set(TOOL esptool.py )
/Users/michael/esp/esp-idf/components/esptool_py/run_esptool.cmake(13): if(NOT ESPTOOLPY OR NOT ESPTOOL_ARGS )
/Users/michael/esp/esp-idf/components/esptool_py/run_esptool.cmake(19): include(${CMAKE_CURRENT_LIST_DIR}/get_port_args.cmake )
/Users/michael/esp/esp-idf/components/esptool_py/get_port_args.cmake(4): set(ESPPORT $ENV{ESPPORT} )
/Users/michael/esp/esp-idf/components/esptool_py/get_port_args.cmake(5): if(NOT ESPPORT )
/Users/michael/esp/esp-idf/components/esptool_py/get_port_args.cmake(6): message(Note: ${TOOL} will search for a serial port. To specify a port, set the ESPPORT environment variable. )
Note: esptool.py will search for a serial port. To specify a port, set the ESPPORT environment variable.
/Users/michael/esp/esp-idf/components/esptool_py/get_port_args.cmake(11): set(ESPBAUD $ENV{ESPBAUD} )
/Users/michael/esp/esp-idf/components/esptool_py/get_port_args.cmake(12): if(NOT ESPBAUD )
/Users/michael/esp/esp-idf/components/esptool_py/get_port_args.cmake(13): message(Note: ${TOOL} will attempt to set baud rate automatically. To specify a baud rate, set the ESPBAUD environment variable. )
Note: esptool.py will attempt to set baud rate automatically. To specify a baud rate, set the ESPBAUD environment variable.
/Users/michael/esp/esp-idf/components/esptool_py/run_esptool.cmake(20): set(CMD ${ESPTOOLPY} ${port_arg} ${baud_arg} ${ESPTOOL_ARGS} )
/Users/michael/esp/esp-idf/components/esptool_py/run_esptool.cmake(21): include(${CMAKE_CURRENT_LIST_DIR}/run_cmd.cmake )
/Users/michael/esp/esp-idf/components/esptool_py/run_cmd.cmake(1): if(NOT IDF_PATH )
/Users/michael/esp/esp-idf/components/esptool_py/run_cmd.cmake(4): include(${IDF_PATH}/tools/cmake/utilities.cmake )
/Users/michael/esp/esp-idf/tools/cmake/utilities.cmake(10): function(set_default variable default_value )
/Users/michael/esp/esp-idf/tools/cmake/utilities.cmake(29): function(spaces2list variable_name )
/Users/michael/esp/esp-idf/tools/cmake/utilities.cmake(39): function(lines2list variable_name )
/Users/michael/esp/esp-idf/tools/cmake/utilities.cmake(55): function(move_if_different source destination )
/Users/michael/esp/esp-idf/tools/cmake/utilities.cmake(79): function(target_add_binary_data target embed_file embed_type )
/Users/michael/esp/esp-idf/tools/cmake/utilities.cmake(111): macro(include_if_exists path )
/Users/michael/esp/esp-idf/tools/cmake/utilities.cmake(119): function(file_append_line file line )
/Users/michael/esp/esp-idf/tools/cmake/utilities.cmake(140): function(target_linker_script target deptype scriptfiles )
/Users/michael/esp/esp-idf/tools/cmake/utilities.cmake(180): function(make_json_list list variable )
/Users/michael/esp/esp-idf/tools/cmake/utilities.cmake(189): function(add_prefix var prefix )
/Users/michael/esp/esp-idf/tools/cmake/utilities.cmake(205): function(fail_at_build_time target_name message_line0 )
/Users/michael/esp/esp-idf/tools/cmake/utilities.cmake(231): function(fail_target target_name message_line0 )
/Users/michael/esp/esp-idf/tools/cmake/utilities.cmake(248): function(check_exclusive_args args prefix )
/Users/michael/esp/esp-idf/tools/cmake/utilities.cmake(268): function(add_cxx_compile_options )
/Users/michael/esp/esp-idf/tools/cmake/utilities.cmake(279): function(add_c_compile_options )
/Users/michael/esp/esp-idf/tools/cmake/utilities.cmake(290): function(add_prebuilt_library target_name lib_path )
/Users/michael/esp/esp-idf/tools/cmake/utilities.cmake(316): function(file_generate output )
/Users/michael/esp/esp-idf/tools/cmake/utilities.cmake(334): function(add_subdirectory_if_exists source_dir )
/Users/michael/esp/esp-idf/components/esptool_py/run_cmd.cmake(5): spaces2list(CMD )
/Users/michael/esp/esp-idf/tools/cmake/utilities.cmake(30): string(REPLACE ; tmp ${${variable_name}} )
/Users/michael/esp/esp-idf/tools/cmake/utilities.cmake(31): set(${variable_name} ${tmp} PARENT_SCOPE )
/Users/michael/esp/esp-idf/components/esptool_py/run_cmd.cmake(7): execute_process(COMMAND ${CMD} WORKING_DIRECTORY ${WORKING_DIRECTORY} RESULT_VARIABLE result )
esptool.py --chip esp32s2 --before=default_reset --after=hard_reset write_flash --flash_mode dio --flash_freq 80m --flash_size 2MB 0x8000 partition_table/partition-table.bin 0x1000 bootloader/bootloader.bin 0x10000 hello-world.bin
esptool.py v3.0-dev
Found 4 serial ports
Serial port /dev/cu.usbserial-14340
Connecting........_____.....__
/dev/cu.usbserial-14340 failed to connect: Invalid head of packet (0xC4)
Serial port /dev/cu.SOC
Connecting........_____....._____....._____....._____....._____....._____....._____
/dev/cu.SOC failed to connect: Failed to connect to ESP32-S2: Timed out waiting for packet header
Serial port /dev/cu.MALS
Connecting........_____....._____....._____....._____....._____....._____....._____
/dev/cu.MALS failed to connect: Failed to connect to ESP32-S2: Timed out waiting for packet header
Serial port /dev/cu.Bluetooth-Incoming-Port
Connecting........_____....._____....._____....._____....._____....._____....._____
/dev/cu.Bluetooth-Incoming-Port failed to connect: Failed to connect to ESP32-S2: Timed out waiting for packet header

A fatal error occurred: Could not connect to an Espressif device on any of the 4 available serial ports.
/Users/michael/esp/esp-idf/components/esptool_py/run_cmd.cmake(12): if(${result} )
/Users/michael/esp/esp-idf/components/esptool_py/run_cmd.cmake(14): message(FATAL_ERROR ${TOOL} failed )
CMake Error at run_cmd.cmake:14 (message):
esptool.py failed
Call Stack (most recent call first):
run_esptool.cmake:21 (include)

mikronauts
Posts: 23
Joined: Wed Dec 09, 2015 8:11 pm

Re: esp32-s2: Invalid head of packet (0xC4)

Postby mikronauts » Mon Aug 17, 2020 8:38 pm

Try reducing the baud rate ... I have to drop to 460kbps on some third party modules when I get that message. You can also try dropping the flash to 40Mhz.

mgarel
Posts: 3
Joined: Mon Aug 17, 2020 3:24 am

Re: esp32-s2: Invalid head of packet (0xC4)

Postby mgarel » Mon Aug 17, 2020 8:57 pm

Try reducing the baud rate ... I have to drop to 460kbps on some third party modules when I get that message. You can also try dropping the flash to 40Mhz.

I reduced the baud rate and the flash frequency, but unfortunately still get the same error.

Who is online

Users browsing this forum: cdollar and 237 guests