2020-10-21 09:04 PM
I am using STM32L442KC part number...And i want to store the 16 byte of data on non erasable memory of controller during runtime...Can i get any reference how to store the data in microcontroller memory???
2020-11-07 09:09 PM
Basically My requirement is to received the data on USB CDC & store it in non erasable memory...And after receiving master system command I want to share that same data to master system...
2020-11-08 07:10 AM
There are multiple issues here:
You need to erase the flash page before writing, as stated earlier. That's just how FLASH works. Its not random-access memory.
The address 0x8000001 is in the first page of flash and is very likely being used by your program. Overwriting it will likely prevent your code from working. Typically people use the last page in flash to write user data.
You are writing a double-word value to a non double-word aligned address. I didn't check, but my guess is this is not allowed. If you only need to write a byte, write a byte.
> can I read that data using particular API..?
STM32CubeProgrammer can show you the current state of the flash memory.
Here is an example for the F4 family that you can use as a guide. The code for an L4 chip should be very similar.
2020-11-10 03:22 AM
Thank you very much for your valuable guidance..
I have tried with the last pages addresses...
i.e 0x08010000
HAL_FLASH_Program(FLASH_TYPEPROGRAM_DOUBLEWORD, 0x08010000, 65);
And i can able to successfully write on that address. And also able to read that location..
its works fine.
Only the issue is unable to erase or overwrite that location.
I tried with the API void FLASH_PageErase(uint32_t Page, uint32_t Banks)
i.e page is 63 & bank is 1.
FLASH_PageErase(63, 1);
2020-11-10 06:08 AM
> 0x08010000
> FLASH_PageErase(63, 1);
Why do you think 0x08010000 is in page 63?
2kB per page. 0x10000/2048 = 32, so that's the start of page 32.
2020-11-16 08:05 PM
Hi....
Yes, its page 32...
I was my mistake, i have wrtten it as page 63..
I have corrected it page 32. still unable to erase the location.