| Electronic Components Datasheet Search |
|
AN2244 Datasheet(PDF) 11 Page - STMicroelectronics |
|
|
|||||||||||||||||||||||||||||
AN2244 Datasheet(HTML) 11 Page - STMicroelectronics |
|
11 / 17 page ![]() AN2244 3 Application example: EEPROM emulation using ST10F27x Flash library 11/17 If the data to be written is different from 0xFFFFFFFF, we look for the last data equal to 0xFFFFFFFh (the following location should not contain 0x00000000) and the data is written at this location. The following diagram summarizes the write operation and treats the cases where written data is equal to or different from 0xFFFFFFFF. This routine will return 0 on success, VARIABLE_FULL if there isn’t enough memory for a variable update, or a Flash error code indicating an operation failure (erase or program). Figure 6. WriteVerifyVariableFull routine flowchart EepromSectorTransfer( ) routine This routine transfers the most recent data (Last variable updates) plus the new one from a full sector to an empty one. At the beginning, it determines the active sector which is the sector that we want to transfer from. The new sector header field is defined and written (new sector status is RECEIVE_DATA given that it is in the process of receiving data). When, the data transfer is complete, the new sector header is marked VALID_SECTOR and the old one TRANSFER_COMPLETE. At the end, the old sector is erased. The transfer process is shown in the following figure: Find Valid sector Data= 0xFFFFFFFF? status = FlashVerifyWord (address,0xFFFFFFFF) Calculate the base address of the status1 = FlashVerifyWord (address+4,0xFFFFFFFF) status2 = FlashVerifyWord (address+4,0x00000000) address=address+8 address=address+4 FlashProgramWord(address+4,0) return 0 Write_request status=0? && status1=0? Yes No No status=0? && status2=0? Yes Yes No variable in the valid sector address FlashProgramWord(address, Data) return 0 |
|
|
Link URL |
| Does ALLDATASHEET help your business so far? [ DONATE ] |
About Alldatasheet | Advertisement | Contact us | Privacy Policy | Link to Datasheet | Link Exchange | Manufacturer List All Rights Reserved©Alldatasheet.com |
| Russian : Alldatasheetru.com | Korean : Alldatasheet.co.kr | Spanish : Alldatasheet.es | French : Alldatasheet.fr | Italian : Alldatasheetit.com Portuguese : Alldatasheetpt.com | Polish : Alldatasheet.pl | Vietnamese : Alldatasheet.vn Indian : Alldatasheet.in | Mexican : Alldatasheet.com.mx | British : Alldatasheet.co.uk | New Zealand : Alldatasheet.co.nz |
|
Family Site : ic2ic.com |
icmetro.com |