2013-03-19 02:40 AM
Hi,
I want to display 2 parameters(ID and BD) value on seven segment display. The values will be dynamically changed, so every time I want to write these 2 byte of values on FLASH memory and every power ON or System Reset, I want to Read that values from Flash Memory. Before writing any values if i read the Flash memory, I'm getting some garbage values. After erasing and writing 2 bytes of values to Flash memory, I am not able to read that again. Can anybody help me.... Thanks Selva. #flash-programming #flash-erasing-programming2013-03-19 03:54 AM
Do you have external flash? Which processor/board are you running?
I think we need some more information if you want a bit more help...2013-03-19 06:48 AM
a) Why would you write to the base of flash where your code and vector table are supposed to reside?
b) Why wouldn't you just read the memory directly, it acts like ALL other memory in read mode? You don't need to unlock it or jump through hoops.2013-03-19 07:16 AM
Thank U for ur response... will it create any problem, writing to the base of the flash ?
2013-03-19 07:20 AM
Thank U for ur response.... No I'm not using any external flash. may i know the configuration steps for flash read,erase and write..?
2013-03-19 09:03 AM
will it create any problem, writing to the base of the flash ?
If you have code there, and expect the processor to start properly, then yes. Imagine I came to your house, removed the front door, and nailed a bunch of planks and boards over the hole, would it still be usable to access your house? See why this might be a problem for the processor?2013-03-19 11:56 PM
Thank U for reply..
OK... from which address can i do writing, reading and erasing operation, so that which will properly..2013-03-20 12:32 AM
Now i have taken the flash memory location as '' 0x0801D000 ''. when i write 2 byte of values to this location, it is going to '' Hard Fault_Handler ''. what should i do, to overcome this problem ? Help me
Thanks....2013-03-20 02:41 AM
OK since you dont want to give any information about board and stuff i'll paste you code i have for writting settings to stm32f2 flash
FLASH_Unlock();
FLASH_ClearFlag(FLASH_FLAG_EOP | FLASH_FLAG_OPERR | FLASH_FLAG_WRPERR | FLASH_FLAG_PGAERR | FLASH_FLAG_PGPERR | FLASH_FLAG_PGSERR);
FLASH_EraseSector(FLASH_Sector_3, VoltageRange_3);
/* settings at 3*16kB */
int
i;
for
(i=0; i<(
sizeof
(settings)+3)/4; i++)
//I have everything written in settings struct declared elsewhere but you'll get the idea
FLASH_ProgramWord((u32)chip_info.settings+i*4, ((u32*)&settings)[i]);
FLASH_Lock();
2013-03-20 04:51 AM
Now i have taken the flash memory location as '' 0x0801D000 ''
Isn't the 64KB flash region 0x08010000 .. 0x0801FFFF ?