Hi,
I program the chips using a USB->Serial cable with the internal bootloader. I might have attached the serial cable when the device was not powered or detached the cable after powering down the device (I’m not sure).
Reading application note AN4835, it states in chapter 6:
Applying voltages to I/O pins when the processor is not powered. If the pin VDIO or VIO specifications are violated, the processor can attempt a partial power up and/or puts the flash into an undefined state. This can lead to corruption of flash contents, corruption of flash control logic, or corruption of device configuration and trim values which in turn can lead to the processor reporting as secured (locked device) or failure of the processor to respond to and complete flash commands.
After desoldering the secure chip and soldering on a new one it programmed ok when powering the board before attaching the serial cable. It still could have been the initial chip but it could also have been the wrong sequence of powering the board and attaching the serial cable.
Pablo, could this also be your problem?
Please let me know so I don't have to investigate further.