2006-11-02 03:09 AM
2006-04-26 02:47 AM
Hi all,
I want to write to flash databank 0 three(3) different integers values. I want to write these values at different times to the same bank in the flash but at different adresses. There is a programming example in the ST library's. /* Initialize the FLASH */ FLASH_Init () ; /* Disable the FLASH protection on Bank 1 sector 0 */ FLASH_WritePrConfig (FLASH_B1F0,DISABLE) ; /* Disable the FLASH protection on Bank 1 sector 0 */ FLASH_SectorErase (FLASH_B1F0) ; /* Write 0x12345678 to Bank 1 sector 0 */ FLASH_WordWrite (0x000C0000,0x12345678) ; /* Warning!! : The write protection can be enabled only on a permanent way */ /* Enable the FLASH protection on Bank 1 sector 0 */ /* FLASH_WritePrConfig (FLASH_B1F0,ENABLE) ; */ My questions are: 1. Do I always have to clear a flash bank prior to each writing to it? 2. If I wrote one value to the flash at for example adress 0x000C0000 is it still possible to write a second and a third value? Or do I have to write all the data to the flash at ones? 3.What meens the following in the example: ?? /* Warning!! : The write protection can be enabled only on a permanent way */ /* Enable the FLASH protection on Bank 1 sector 0 */ /* FLASH_WritePrConfig (FLASH_B1F0,ENABLE) ; */ Is it ever possible to write to the flash after the above has happend? Hope somebody can help a little bit, Jimmey2006-04-27 03:47 AM
Thanks RISC,
It works perfectly. I only have a problem writing float value's to the flash. float fPort=0; //init fPort = 22.64; // fill float with value FLASH_WordWrite (0x000C0044,fPort); // write float to flash 0x400C0044 adress When I read the float back from the flash the problem is that only 22(0x00000016) is written to the flash. The .64 missing. I also saw this with my memory view via the JTAG port. What's my mistake? Perhaps the float doesn't fit in the 32 bits space?? Regards, Jimmey2006-11-02 03:09 AM
Hello !
I already have to use the programm example in the ST library which looks in the first thread of Jimmey. But this one dosn´t work by me.... I use the Keil µVision3 and a STR710FZ µControler. Could somebody help me, from this problem ? I think some adjustment parameters a wrong! u32 Read_Data; /* Initialize the FLASH */ FLASH_Init () ; /* Disable temporarily the FLASH protection on Bank 1 sector 0 */ FLASH_WritePrConfig (FLASH_B1F0,DISABLE) ; /* Erase Bank 1 sector 0 */ FLASH_SectorErase (FLASH_B1F0) ; /* Write 0x12345678 to Bank 1 sector 0 */ FLASH_WordWrite (0x000C0000,0x12345678) ; /* Read back the written data at address 0x400C0000*/ Read_Data = FLASH_WordRead(0x000C0000); The Read_Data out gives me a wrong value back Thank you...