I am using an STM32F415 as part of a USB dongle that generates and stores cryptographic keys. For the development version of the dongle I want to be able to switch back and forth between RDP levels 0 and 1, which I can do. The problem is that when I go from level 1 back to level 0 the chip does a full flash erase, which nukes the firmware, and so the device appears to hang. I would like to make the device's behavior a little more user-friendly by providing some feedback that the mass erase has completed. Theoretically this should be possible by running the code that initiates the flash erase out of RAM. My question is: will this actually work? Has anyone ever done this before? Is there some model code out there that I can use or am I charting new territory here?