2013-02-12 02:05 AM
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 bytesw4 0x40023c08, 0x08192a3bw4 0x40023c08, 0x4c5d6e7f// Write AA to reset the read protectionw4 0x40023c14, 0x0fffaaed// Set the FLASH_OPTSTRT bit (0x02) to apply the changew4 0x40023c14, 0x0fffaaefI'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