cancel
Showing results for 
Search instead for 
Did you mean: 

Disable read protection level 1 on STM32 F4

danielpersson9
Associate
Posted on February 12, 2013 at 11:05

Hi, everybody! I'm currently writing a software that will use a JLink ARM flasher to program a device with a STM32 F4 processor, and at the beginning of the programming sequence I need to add the ability to remove a level 1 read protection (causing a mass erase) to be able to program devices multiple times.

JLink's SDK in this area doesn't provide any ready-to-use API calls as far as I know, and as a first attempt I've been trying to accomplish the read protection reset by writing manually to the Flash option bytes of the STM32. Here's what I have so far, a script that can be parsed by the JLink.exe utility:

ip 148.198.109.22

// Unlock Option bytes

w4 0x40023c08, 0x08192a3b

w4 0x40023c08, 0x4c5d6e7f

// Write AA to reset the read protection

w4 0x40023c14, 0x0fffaaed

// Set the FLASH_OPTSTRT bit (0x02) to apply the change

w4 0x40023c14, 0x0fffaaef

I've tried to do this manually since I'm not checking the BSY bit in the script, but still the lock remains... What am I missing?

Regards,

Daniel

0 REPLIES 0