2023-04-19 07:08 PM
Using STM32L452CC and STM32CubeProgrammer API v2.12.0 Windows 64-bits.
Firstly, I'm setting the readout protection to its middle level (RDP = BB in the programmer) and then program the chip successfully. Then, letting the chip power cycle. Now reading the option bytes from CubeProgrammer but getting AA, Any idea?
Another related question:
My understanding is that if the protection level is set to BB (protection level 1) then Cube programmer will still be able to program a new firmware to the chip and have the protection level being downgraded to AA (no protection).
However, this is denied by CubeProgrammer Command-interface.
It just let the new firmware to be programmed, but not downgrading the protection level to be 'no protection. Any idea?
2023-04-20 09:53 AM
RDP level 1 prevents JTAG/SWD/Bootloader access to FLASH. See section 3.5 and table 13 in the L45xx reference manual (RM0394). Once level 1 is set, the only way to re-load FLASH is to downgrade to level 0, which triggers a mass erase operation on the FLASH. There is a little more to it than that involving the PCROP settings as described in the reference manual, but that the basic idea.
I cannot explain why you are setting RDP = 0xBB then reading 0xAA after reboot. Maybe you didn't actually program the option bytes? Or did you set the RDP level, then load your firmware (which required downgrading to level 0)? Or something else entirely.