STM32H523 Flash write protection in CLOSED state?
Hi
I have a design using STM32H523 and I've managed to ensure that my firmware switches PRODUCT_STATE to 'Closed', and sets a valid debug password, the first time it runs. This works well.
In the Flash I have a bootloader, application, and configuration data. I'd like to be able to manipulate the write protect bits, such that normally everything is protected unless there's a reason to change it. So, for example, if a setting needs to be changed, the user can issue an 'unlock' command which unprotects the configuration area, and it can be locked again next time the unit boots up. Or, when the bootloader is entered, it can unprotect the application code area, but protect the configuration.
I already do this on other platforms and it works well.
However: on the H523 I can manipulate the write protect bits just fine, provided PRODUCT_STATE = 'Open'. If I allow the code to switch to 'Closed', then any subsequent attempts to change the FLASH_WRPSG bits appear to have no effect, and obviously I can't use a debugger to help figure out why.
TrustZone is disabled.
Is it just not possible to change the write protect bits on a 'Closed' device, even from user code? It would seem a shame to have to leave the entire Flash unprotected, but that would be the only solution if changing those bits isn't possible.
