Hi all,
I'm currently working on stm32f4xx controller, i need to protect the flash memory, so i used RDP as stated below, its worked and flash memory was not readable, but after that i was not able to re-program the flash using ULINK Pro or Ulink Me, can you please suggest best way to overcome this.
//HAL_FLASH_Unlock(); HAL_FLASH_OB_Unlock(); FLASH_RDP.RDPLevel = OB_RDP_LEVEL_1; FLASH_RDP.OptionType = OPTIONBYTE_RDP; HAL_FLASHEx_OBProgram(&FLASH_RDP); HAL_FLASH_OB_Launch(); HAL_FLASH_OB_Lock(); HAL_FLASH_Lock();
Thanks.
Thanks, it not worked out.
As per app note: "When the read protection level 1 is activated, no access (read, erase, and program) to Flash memory or backup SRAM can be performed via debug features such as Serial Wire or JTAG, even while booting from SRAM or system memory bootloader"
We were flashing via JTAG port using Ulink pro debugger, hence its not able to access flash memory.
So, as Clive1 said, use an ST-Link with the ST-Link Utility to clear the RDP.
You can probably also do that with a Segger JLink ...
Heh... "It is critically important that you are sharper than the people who might hack your device"
I gave you working example. I'm using it so I'm sure it works. This text from manual has noting to OptionBytes (really, see NEXT page *1).
(*1) STM32F4xx Reference Manual: page 94 (3.7.3, "Table 17. Access versus read protection level") Access to Read/Write/ERase to "Main Flash Memory and Backup SRAM" in Level 1 is disabled. Next row: "Option Bytes" - in Level 1 you CAN Read/Write/Erase. If you cannot erase that OptionBytes, maybe you set Level 2.