« Close

Datasheets and User Guides

App Notes

Software & Driver

 

20.0 Internal Flash

Internal Flash Overview

The T7 has 4 MB of internal flash.

The first 2 MB is called the User Area and is available for storing user-data or web-pages.  The remaining 2 MB is called the Reserved Area is used to store important device information such as calibration constants.

Note that the HTTP Server feature stores web pages at the beginning of the User Area, so if using the server feature we recommend storing other user data towards the end of the User Area.

Internal flash memory is divided into regions. Each region has a starting address, a length and a key. The key for the region to be accessed must be written to the INTERNAL_FLASH_KEY register. The key prevents accidental access to different regions. The key will be cleared when the modbus packet that wrote it has been fully processed.

Internal flash is addressed by byte, but accessed by 32-bit values. That means that the first value is at address zero and the second is at address 4.  These are flash addresses, not to be confused with Modbus addresses.  These flash addresses are written to the read or write pointer registers to specify where in flash reads will read from or writes will write to.

 

Flash Addresses:

  • User Area (and Web Pages): Flash Address: 0, Length: 2 M, Key: 0x6615E336 (1712710454 in decimal)
  • Reserved Area: Flash Address: 0x200000, Length: 2M
  • Calibration Constants (in Reserved Area): Flash Address: 0x3C7000, Length: 4 k, Key: 0x43A24C42 (1134709826 in decimal)

 

Reading:

To read from flash, write the key for the desired region to INTERNAL_FLASH_KEY, write the desired address to INTERNAL_FLASH_READ_POINTER, and then read an even number of registers from INTERNAL_FLASH_READ.

 

Writing:

To write to flash, the area to be written to must first be erased. Once erased, write the key for the desired region to INTERNAL_FLASH_KEY, write the desired address to INTERNAL_FLASH_WRITE_POINTER, and then write an even number of registers to INTERNAL_FLASH_WRITE.

 

Erasing:

Flash is erased 4 kB at a time.  Erasing sets all bits to 1.  To erase a 4 kB region write the key for the desired region to INTERNAL_FLASH_KEY and the desired address to INTERNAL_FLASH_ERASE. The address will be rounded down to the nearest 4 kB boundary. Boundaries are easy to identify when the address is displayed in hexadecimal because the lower three digits will be zero. 4 kB is hexadecimal is 0x1000.

 

Endurance:

Flash memory can only be erased so many times before bit errors will start to occur. It is therefor important to erase or write flash infrequently. Typical life of flash memory is at least 10,000 cycles.

 

 Register Listing

Flash Memory
Name Start Address Type Access
INTERNAL_FLASH_KEY 61800 UINT32 R/W
INTERNAL_FLASH_READ_POINTER 61810 UINT32 R/W
INTERNAL_FLASH_READ 61812 UINT32 R
INTERNAL_FLASH_WRITE_POINTER 61830 UINT32 R/W
INTERNAL_FLASH_WRITE 61832 UINT32 W
INTERNAL_FLASH_ERASE 61820 UINT32 W
INTERNAL_FLASH_KEY
- Address: 61800
Sets the region of internal flash to which access is allowed.
  • Data type: UINT32  (type index = 1)
  • Readable and writable
INTERNAL_FLASH_READ_POINTER
- Address: 61810
The address in internal flash that reads will start from.
  • Data type: UINT32  (type index = 1)
  • Readable and writable
INTERNAL_FLASH_READ
- Address: 61812
Data read from internal flash.
  • Data type: UINT32  (type index = 1)
  • Read-only
INTERNAL_FLASH_WRITE_POINTER
- Address: 61830
Address in internal flash where writes will begin.
  • Data type: UINT32  (type index = 1)
  • Readable and writable
INTERNAL_FLASH_WRITE
- Address: 61832
Data written here will be written to internal flash. This register is a buffer.
  • Data type: UINT32  (type index = 1)
  • Write-only
  • This register is a Buffer Register
INTERNAL_FLASH_ERASE
- Address: 61820
Erases a 4k section of internal flash starting at the specified address. This register is a buffer.
  • Data type: UINT32  (type index = 1)
  • Write-only
  • This register is a Buffer Register