Showing results for 
Search instead for 
Did you mean: 

Programming error writing to OTP on STM32F412xx

Associate II

I am trying to write to the OTP on a STM32F412xx using version v4.5.0.0 of ST-LINK but am getting "Error occured during memory writing!" (note bad spelling is not mine but ST's :-))

The memory area for the OTP is 0x1FFF7800 and I can read it ok. I've tried 8/16/32 bit accesses but nothing works. It has never been programmed before and reads as all F's as you'd expect and the lock values are all F's as well.


Longstanding issue. Some workarounds here:

Might work if you can find v3.8 of STM32 ST-Link Utility:

Might work with STM32CubeProgrammer.

If you feel a post has answered your question, please click "Accept as Solution".
Associate II


Yeah I did see that link but it's 4 years old so had assumed it was fixed by now.

I did create a mini .bin file with a single 32-bit word and program it that way. It's a bit time-consuming as you have to have a second .bin file with just 0x00000000 to program the 'lock OTP' word when you're done.

If I get a chance I might revert to the old v3.8 ST-Link as you suggested thanks. Doesn't sound like it should be much of a fix if they can just merge what has worked in the past, but anyway good that there is a workaround.