esp-idf: esp_partition_write doesn't work on encrypted partition (IDFGH-4423)

Environment

  • Development Kit: [none]
  • Module or chip used: ESP32-WROVER-E (16Mb SPIFlash, 64Mb SPRAM)
  • IDF version (run git describe --tags to find it): v4.3-dev-dirty
  • Build System: CMake
  • Compiler version (run xtensa-esp32-elf-gcc --version to find it): esp-2020r2-8.2.0
  • Operating System: Linux
  • Using an IDE?: Yes (Eclipse 2020-09(4.17.0))
  • Power Supply: external 3.3V

Problem Description

Hello, I have a problem with the flash encryption feature in my project. I have followed the steps that appear in the example esp-idf/examples/security/flash_encryption but when the program executes the function “esp_partition_write”, the task hangs and does not continue. Furthermore any exception appears, only appears logs coming from task wdt because the task is hanged.

The data length that I am trying to write is multiple of 16 (128 bytes) with a offset 0. The partition is marked with the “encrypted” flag in the partition table.

If I remove the “encrypted” flag, the process runs correctly

Other items if possible

  • sdkconfig file (attach the sdkconfig file from your project folder)
  • Partitions table
  • elf file in the build folder (note this may contain all the code details and symbols of your project.)
  • coredump (This provides stacks of tasks.)

files.zip

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 24 (8 by maintainers)

Commits related to this issue

Most upvoted comments

@jarcos-al

E (50807) task_wdt: Task watchdog got triggered. The following tasks did not reset the watchdog in time:

(As I had mentioned in my previous reply) This error indicates problem with tasks running for prolonged time without yielding (e.g. some task running with tight loop).

Please refer to documentation available at https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/system/wdts.html#task-watchdog-timer. You may try with larger timeout value for this timer (default is 5sec) or disable this configuration option for testing purpose.

I have unchecked “Support for SPI-connected RAM” option, and the code works fine

Do you see similar problem if you keep this configuration enabled in https://github.com/espressif/esp-idf/tree/master/examples/security/flash_encryption example? Can you please modify this example such that it can reproduce problem you are seeing?

After checking all the settings of the sdkconfig, comparing with the example project, I have verified that what produces the error is the option “Flash SPI speed = 80 MHz” in “Serial flasher config” together with the option "Support for external, SPI -RAM connected ". With these two options set in the example https://github.com/espressif/esp-idf/tree/master/examples/security/flash_encryption, the same error is reproduced. I have fixed this error by changing the “Flash SPI speed” to 40MHz.