Skip to main content

Embedded Flash memory

Flash main features

  • Up to 128Kbytes of Flash memory
  • Memory organization:
    • Main Flash memory block:
      Up to 128Kbytes
    • Information block:
      Up to 512bytes
      Information block is read only
    • Data block:
      Up to 512bytes
  • Flash memory interface features:
    • Read interface with prefetch buffer( 1 x 32-bit words )
    • Flash Program / Erase operation
    • Read / Write protection

Flash memory functional description

Flash memory organization

The Flash memory is organized of 32-bit wide memory cells that can be used for storing both code and data constants. The memory organization is based on a main Flash memory block containing 512 sectors of 256byte or 32 blocks of 4Kbyte. The block and sector provides read/write protection.

Flash area
Flash memory address
Size (bytes)
NameDescription
M
a
i
n

F
l
a
s
h


m
e
m
o
r
y
0x0000 0000 ~ 0x0000 00FF
256
Sector 0
Block 0
0x0000 0100 ~ 0x0000 01FF
256
Sector 1
0x0000 0200 ~ 0x0000 02FF
256
Sector 2
. . .
. . .
. . .
0x0000 0E00 ~ 0x0000 0EFF
256
Sector 14
0x0000 0F00 ~ 0x0000 0FFF
256
Sector 15
. . .
. . .
. . .
. . .
0x0000 7000 ~ 0x0000 70FF
256
Sector128
Block 7
0x0000 7100 ~ 0x0000 71FF
256
Sector129
. . .
. . .
. . .
0x0000 7E00 ~ 0x0000 7EFF
256
Sector142
0x0000 7F00 ~ 0x0000 7FFF
256
Sector143
. . .
. . .
. . .
. . .
0x0001 F000 ~ 0x0001 F0FF
256
Sector496
Block 31
0x0001 F100 ~ 0x0001 F1FF
256
Sector497
. . .
. . .
. . .
0x0001 FE00 ~ 0x0001 FEFF
256
Sector510
0x0001 FF00 ~ 0x0001 FFFF
256
Sector511

Information
block
0x0003 FC00 ~ 0x0003 FCFF
256

Lock info
0x0003 FD00 ~ 0x0003 FDFF
Reserved

Data block
0x0003 FE00 ~ 0x0003 FEFF
256
Data0
0x0003 FF00 ~ 0x0003 FFFF
256
Data1

The W7500 embedded Flash memory can be programmed using in-application programming. IAP allows the user to re-program the Flash memory while the application is running. The program and erase operations can be performed over the whole product voltage range.

In W7500x_Library_Examples, there is the IAP Example Project and the below function is supported to use IAP.

void DO_IAP( uint32_t id, uint32_t dst_addr, uint8_t* src_addr, uint32_t size);

This function requests those parameters, id, dst_addr, src_addr and size. 'id' is already defined in 'main.c'. 'dst_addr' is the flash memory address in the upper table. 'src_addr' is the buffer pointer user want to program. 'size' is the flash size user chooses. Please refer flash address and size mentioned in the upper table.

// IAP 'id' paremeter define
#define IAP_ENTRY 0x1FFF1001 // Because Thum code
#define IAP_ERAS 0x010
#define IAP_ERAS_DAT0 (IAP_ERAS + 0) // Erase Data 0 block
#define IAP_ERAS_DAT1 (IAP_ERAS + 1) // Erase Data 1 block
#define IAP_ERAS_SECT (IAP_ERAS + 2) // Erase a Sector in Main Flash Memory
#define IAP_ERAS_BLCK (IAP_ERAS + 3) // Erase a Block in Main Flash Memory
#define IAP_ERAS_CHIP (IAP_ERAS + 4) // Erase all code
#define IAP_ERAS_MASS (IAP_ERAS + 5) // Erase all code & data
#define IAP_PROG 0x022

This is how to Erase and Program flash memory. Especially, with IAP_ERAS_DAT0 and IAP_ERAS_DAT1, there is no need to put other parameters (there are default values).

// Step 1 DATA0 Erase, Read, Write Test
DO_IAP(IAP_ERAS_DAT0,0,0,0);
DO_IAP(IAP_PROG,DAT0_START_ADDR,buffer,SECT_SIZE);

Operating program can be deleted when user use 'IAP_ERAS_CHIP' or 'IAP_ERAS_MASS'.

// Using IAP_ERAS_CHIP or IAP_ERAS_MASS
DO_IAP(IAP_ERAS_CHIP,0,0,0);
DO_IAP(IAP_ERAS_MASS,0,0,0);