espressif / esp-idf

Espressif IoT Development Framework. Official development framework for Espressif SoCs.
Apache License 2.0
13.34k stars 7.21k forks source link

Flash Encrypted FW : Issue - "A fatal error occurred: Failed to connect to ESP32-S3: Invalid head of packet (0x80)" (IDFGH-13523) #14414

Open venkateshgr-ayla opened 3 weeks ago

venkateshgr-ayla commented 3 weeks ago

Answers checklist.

General issue report

INFO: output: Writing at 0x0015dc00... (26 %) INFO: output: Writing at 0x0015e000... (26 %) INFO: output: Writing at 0x0015e400... (26 %) INFO: output: INFO: output: A fatal error occurred: Invalid head of packet (0x80): Possible serial noise or corruption. INFO: -------- failure logs end -------- WARNING: failures: 1, good: 0

We this issue during everytime flashing and each time the percentage is different like 8%, 70%.. etc.. And the "Writing at 0x000xxxxxx" is different everytime.

using ESP32S3-devkit of 8MB flash

dobairoland commented 3 weeks ago

This is probably a hardware issue (e.g. unstable power supply, bad USB cable) as the error message suggests because the issue happens at different moments during flashing. Enabling the --trace option while invoking esptool.py directly can give a little more information (especially what is the content of the receive buffer when that invalid head was identified). Also observing the state of the ESP can be useful. It is possible that it is reseted during the flashing process.

venkateshgr-ayla commented 3 weeks ago

@JiaLWang @dobairoland am using the standard ESP32S3 devkit here. Should we still need to worry about the power or hardware issue? We don't see any issue to flash when we are flashing normally and no encryptions like the development and release packages.

dobairoland commented 3 weeks ago

the standard ESP32S3 devkit here

If you mean by standard the ones produced by Espressif then I'm not aware of any HW issue with those. Although you could share the revision number and the exact board you are using.

We don't see any issue to flash when we are flashing normally

The security team will also take a look at this issue. I'm not aware of any such problem.

venkateshgr-ayla commented 3 weeks ago

Can anybody share any sample script or command to create development mode and release mode encrypted package and flash successfully ?

AdityaHPatwardhan commented 1 week ago

Hi @venkateshgr-ayla, What do you mean by development/release mode encrypted package ? Do you mean the encrypted flash binaries? You can generate an encrypted binary with help of following command https://docs.espressif.com/projects/esp-idf/en/v5.3.1/esp32s3/security/flash-encryption.html#manually-encrypting-files

There is a detailed workflow to enable flash encryption with help of host based scripts. Please take a look to understand each step of flash encryption in more detail https://docs.espressif.com/projects/esp-idf/en/v5.3.1/esp32s3/security/host-based-security-workflows.html

I hope this helps Thanks, Aditya