Skip to main content
Associate
March 27, 2024
Solved

Flash memory programming

Hello everyone, iam using nucleo-U575ZI-Q board and trying to do Flash programming. I want to write the data in to the flash and read the data from the flash. I've written the code but something is going wrong with it. Could someone please help me in finishing my task. I will attach my code below. 

Thank you 

This topic has been closed for replies.
Ayoub Cheggari
Ayoub CheggariBest answer
Senior
March 28, 2024

Hello,

Can you give more details about your issue? Is it not erasing, writing or reading?

4 replies

Ayoub Cheggari
Ayoub CheggariBest answer
Senior
March 28, 2024

Hello,

Can you give more details about your issue? Is it not erasing, writing or reading?

_JITH_Author
Associate
March 28, 2024

Something is going wrong with "Writing" .Data which I want to store in to the flash is not being stored at that address location....help me out plz.

Thank you for your valuable response...

Tesla DeLorean
Guru
March 28, 2024

Unfortunately "something wrong" isn't a particular helpful observation

Check for errors in function returns.

Clear the erase structure.

I'm not convinced the math here is correct. I'd assume the page size is in bytes, not word

int numberofwords= (sizeof(DATA_32)/4)+((sizeof(DATA_32) %4)!=0);
EraseInitStruct.NbPages = (numberofwords/FLASH_PAGE_SIZE)+1;

 

EraseInitStruct.NbPages = (numberofbytes + FLASH_PAGE_SIZE - 1)/FLASH_PAGE_SIZE; // Would round bytes to actual pages properly

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
Tesla DeLorean
Guru
March 28, 2024

Your rx_data buffer looks entirely inadequate for the amount of data to be read back as 32-bit words and termination word.

Have a HardFault_Handler() that can report actionable data.

Add diagnostic output so you understand what's happening, what's failing and what errors you get.

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..