AnsweredAssumed Answered

emulate EEPROM with STM32F407 flash memory

Question asked by marchmellows.001 on Oct 1, 2014
Latest reply on Oct 2, 2014 by marchmellows.001
Hi I use the routine listed below to read in flash area (sector 11) three words that contain values of sampling and if the first value found is different, register the new three values. 
The problem is that the values that are written to the flash, do not correspond to the values contained in the variables. In practice in flash are not recorded the correct values 
That 's the Routine:

void ReadDataFromFlash(void)
     FLASH_Status  FlashStatus;                         //  flag
     uwAddress = AddrFlashDataDDS;                    // Punto al settore Flash 
     uwData32 = *(__IO uint32_t*)uwAddress;          // leggo primi 4 bytes 
     FlashStatus = FLASH_COMPLETE;

     FLASH_ClearFlag(FLASH_FLAG_EOP | FLASH_FLAG_OPERR |                                    FLASH_FLAG_WRPERR | 
                    FLASH_FLAG_PGAERR | FLASH_FLAG_PGPERR |                                       FLASH_FLAG_PGSERR); 
     uwAddress = AddrFlashDataDDS;     // Punto al settore Flash                              FlashStatus=FLASH_ProgramWord(uwAddress, wDATA_32);   // scrivo numeri di test.
     if (FlashStatus != FLASH_COMPLETE)               {}
     uwAddress+=4;                    // secondo word
     if (FlashStatus != FLASH_COMPLETE)          {}
     uwAddress+=4;                    // terzo word
     if (FlashStatus != FLASH_COMPLETE)     {}