cancel
Showing results for 
Search instead for 
Did you mean: 

hi guys, I've been trying to write to internal flash for the last two weeks, and unfortunately, I didn't manage to do so. I worked with the function I have from the library and read in the manual.

Gbasi.1
Associate II

tst= 0x121212121212

HAL_FLASH_Program(FLASH_TYPEPROGRAM_DOUBLEWORD,0x8000000,tst);

the address i took from the manual as well.

0693W000001cO3YQAU.png

i cant understand whats going on, please help me.

thanks a lot

This discussion is locked. Please start a new topic to ask your question.
18 REPLIES 18

No, you did not.

What are the results of steps 4,5,6?

Probably going to want to look at reported error codes, and work on better diagnostic/telemetry output.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Gbasi.1
Associate II

The thing is that i can write only to OTP address which i can not change after that

Gbasi.1
Associate II

The thing is that i can write only to OTP address which i can not change after that

0693W000001cOAAQA2.png

Fine, it works properly then.

TDK
Guru

OTP stands for one-time programmable. You can only program them once.

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

yes, the thing is i cant write it after that, i can write once and then read as many as i want. but i cant write in place that has been written before

Gbasi.1
Associate II

my problem is that i can write only, i can not erase the data i wrote. i trying to delete it but i cant..

for (int i = 0; i < 10; i++){

EraseInitStruct.TypeErase=FLASH_TYPEERASE_PAGES;

EraseInitStruct.Banks=(uint32_t)0x01;

EraseInitStruct.Page=60+i;

EraseInitStruct.NbPages=2;

HAL_FLASHEx_Erase(&EraseInitStruct, &pageError);

}

DNick.1
Associate II

Are you using your own board, or one of ST's reference boards?

I had a similar problem trying to consistently write to EEPROM and the problem turned out to be a noisy power rail. I needed to add a filter cap, and also a decoupling cap, to my board in order to get stable enough power for the writes to succeed. There is likely a similar requirement when erasing or writing to flash.

I hope that helps....