cancel
Showing results for 
Search instead for 
Did you mean: 

Flash memory programming

_JITH_
Associate

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 

1 ACCEPTED SOLUTION

Accepted Solutions
Ayoub Cheggari
Associate III

Hello,

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

View solution in original post

4 REPLIES 4
Ayoub Cheggari
Associate III

Hello,

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

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
Up vote any posts that you find helpful, it shows what's working..

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...

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
Up vote any posts that you find helpful, it shows what's working..