I would like to continue what I started here about internal bootloader. Now I would like to add read protection to my uC.
- Connect uC via UART2 to PC
- Trigger jumping to internal bootloader by pressing some key
- Send erase page by page commands (got ACKs)
- Send new flash content to micro (got ACKs)
- Send turn on read protection comnand (got ACK and uC resets, needs power on reset - it's ok)
So far so good, till this moment everything works as intended. After reset when read protection is turned on (I can check it via ST-Link utility). Now I want to send another SW to uC:
- Triggers internal bootloader
- Send Extended Erase Memory command (0x44 0xBB) and get...0x1F. This is actually ok and works as shown on Figure 17 in AN3155 Rev5, page 26. I have RDP active and get NACK.
- I want to turn it off, I send Readout Unprotect command (0x92 0x6D) and get double ACK (it's fine). Micro makes Mass Erase due to disabling RDP and makes reset.
From that point, flash is empty, BOOT0 pin is connected to GND (boot from user flash memory) and it's impossible to come back to bootloader to continue programming flash with new SW.
Is there any way to boot from system memory after such reset? It looks like only way to use internal bootloader is to have access to BOOT0 pin which in my case is not possible because whole device will be flooded in resin. Am I missing something from Boot configuration?