Hardware write protection isn't a feature that ESP-IDF or ESP32 currently supports, but many models of flash chip support some kind of write protection feature in the hardware. It's possible (although very unlikely) for electrical noise, voltage supply issues, or other hardware issues to cause the flash chip to go into a bad state.nikunj.patel wrote: ↑Tue Aug 25, 2020 11:12 amHi Angus,How we can enable Hardware write protection? From the menuconfig ? We have used the same binaries in all the 25 modules. Still, this can be the issue?Is it possible the flash chip has enabled hardware write protection somehow? Or that the FLASH_CRYPT_CNT efuse had been burned already before flashing of the plaintext firmware was done?
Given your updated description of the problem, I no longer think this is the case for your hardware - it's only a possibility if you find that you actually can't change the flash contents at all (ie same bytes are found in the flash after each write attempt).
Did you flash Secure Boot in "One-time flash" mode? If so then I'm afraid Secure Boot is behaving as designed and is preventing the device from booting a modified bootloader. It's not possible to disable flash encryption once Secure Boot is enabled in this mode.nikunj.patel wrote: ↑Tue Aug 25, 2020 11:12 amSorry, I have written the wrong statement here. When I burn FLASH_CRYPT_CNT to disable flash encryption it's value was ox3, so flash encryption is disabled and then I have flashed the plain text binary. But then I am getting continuously "secure boot check fail" error. I am attaching Error logs and eFuse summary for the same.
If you wish to avoid bricking further chips this way, then you can pre-burn a Secure Boot eFuse key as described in the "reflashable bootloader" section of the Secure Boot docs. This will let you generate a new secure boot digest to match the new bootloader.
Alternatively, try flashing with Flash Encryption only first and then enable Secure Boot later.
Everything in the eFuse summary looks as expected apart from these unexpected values in eFuse BLK3. Were these manually burned here?nikunj.patel wrote: ↑Tue Aug 25, 2020 11:12 ameFuse Summary:<snip>
BLK3 Variable Block 3
= 01 02 03 00 02 00 03 03 00 00 02 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 R/W
The most common possibilities would be an electrical noise problem, power supply stability, or a signal integrity problem on the board that's causing problems with the communication between the ESP32 and the flash chip, or causing the flash chip to "brown out" and erase/write invalid values to the flash.nikunj.patel wrote: ↑Tue Aug 25, 2020 11:12 amWhat are the possible hardware problems which may damage the board?
If the power supply is particularly poor (ie the module is running sometimes or intermittently outside of its specified voltage range) while burning eFuses, then it is also possible for eFuses to mis-write.