Programming Atmel's Family of Flash Memories

  • Upload
    plcmana

  • View
    218

  • Download
    0

Embed Size (px)

Citation preview

  • 8/3/2019 Programming Atmel's Family of Flash Memories

    1/4

    Programming Atmels FamilyOf Flash Memories

    IntroductionAtmel offers a diverse family of FlashMemory devices ranging in density from256 K to 4M-bits. These devices readand program with a single voltage sup-ply. The nominal supply voltage is 5V forthe AT29Cxxx, 3.3V for the low voltageAT29LVxxx, and 3V for the Battery-Volt-age AT29BVxxx Flash family. Theentire Flash family is designed to allowusers to have one common program-ming algorithm for all three Flash voltagefamilies. Therefore, upgrading from onedensity to another and from a highervoltage to a lower voltage device is sim-plified.

    This application note describes thedesign benefits of Atmels Flash archi-tecture as well as how the device ID fea-ture is used to adjust for varying densi-ties and supply voltages. In addition,Atmels Software Data Protection (SDP)feature, which prevents inadvertentwrites, is described. An example is givento illustrate the ease with which the pro-gramming software can be written toaccommodate four different 4M-bit Flashdevices, the AT29C040, AT29LV040,AT29C040A, and AT29LV040A.

    Hardware and software have beendeveloped to demonstrate the relevantdesign issues. The demo uses anAT89C51 Flash-based microcontroller(which has the same pinout and instruc-ti t 80C51) th h t

    The AT89C51, a member of Atmels

    growing family of Flash microcontrollerdevices, features 4K bytes of in-systemreprogrammable Flash memory (seeAtmel application note AT89C51 In-Cir-cuit Programming for additional informa-tion). Current and future versions ofAtmels microcontroller family incorpo-rate from as little as 1K bytes of Flashmemory to as much as 128K bytes, pro-

    viding many density options for differentapplications. Other versions will alsoinclude special architectures such as acombinat ion of Flash and paral lelEEPROM memory on board.

    Programming FlashDevices

    Unlike Atmels Flash Memories, previousgenerations of Flash memories hadlarge kilobyte sectors and required thatan entire sector be erased prior to pro-gramming. Generally, the sector erasecycle time was hundreds or thousands ofmilliseconds and could be as long as 30seconds for the entire memory array. Inaddition, a separate high voltage supplywas required for a write and erase oper-ation. Atmels Flash family has simplifiedusage by having only one supply volt-age, reducing the sector size, having theprogramming similar to an SRAM writeoperation, and decreasing significantlythe total programming time.

    Flash

    Application

    Note

  • 8/3/2019 Programming Atmel's Family of Flash Memories

    2/4

  • 8/3/2019 Programming Atmel's Family of Flash Memories

    3/4

    Microcontroller

    6. Read Address 00001HData read is the Device ID Code

    7. Load Data AAH into Address 05555H

    8. Load Data 55H into Address 02AAAH

    9. Load Data F0H into Address 05555H

    10. Pause tWC (device write cycle time)

    11. The device is returned to standard operating mode

    The following table uses the 4M-bit Flash as an example toillustrate the pertinent device information than can bedetermined once the Device ID Code is known.

    Hardware DescriptionThe demo hardware consists of a 12 MHz AT89C51 Flash-based microcontroller with 4K bytes of on-board Flashmemory. The internal AT89C51 Flash memory is used forboot code, and the external 8K x 8 SRAM and the

    AT29C040 are mapped as data memory. The AT29C040 isalso mapped as program memory to facilitate off-chip pro-gram execution. The AT89C51 can only access a maxi-mum of 64K bytes of data memory space, while theAT29C040 has 512K bytes of storage capacity. To solvethis size mismatch, the AT29C040 is bank switched into theAT89C51 data memory map in 8K byte blocks. The bankswitching is performed with six general purpose I/O portbits on the AT89C51. The system address map is shownbelow.

    System Address Map

    Software DescriptionThe software (available from Atmels BBS 408-436-4309)

    demonstrates how the Device ID Code can be used toallow a single program to work with different Atmel Flashmemories. The program uses Atmels 4M-bit Flash(AT29C040, AT29LV040, AT29C040A, and AT29LV040A)as an example, but the software can be easily adapted toaccommodate other device densities.

    In order to program the Flash memory, the software mustfirst determine which Flash device is being used. This isaccomplished by first putting the device into the Software

    Product Identification mode by executing a three-byte com-mand sequence (described in the Product and Manufac-turer ID section of this application note). The program sub-sequently reads the Device ID Code and executes anotherthree-byte command sequence to return the Flash to thestandard operating mode. Using the Device ID Code, theprogram then determines the appropriate sector size andwrite cycle time (tWC) for the particular 4M-bit Flash beingused.

    To demonstrate a sector write, the program proceeds toload the SRAM with dummy data. After the data has beenloaded, the program transfers the data from the SRAM to apredefined sector (within one of the mapped 8K byteblocks) of the 4M-bit Flash. After pausing the required writecycle time (tWC), the sector that was just written is trans-ferred back to the SRAM buffer.

    SummaryAtmels Flash Memories are designed to allow all densitiesand device configurations to be programmed using thesame programming algorithm. The user has to simplydetermine the Device ID Code and set the appropriate sec-tor size and write cycle time. This operation need only beperformed once provided the sector size and write cycleinformation is saved. If only one density or configuration willever be used, then reading of the Device ID Code can beeliminated, and the sector size and write cycle informationcan be predefined in the software.

    As demonstrated, programming Atmels Flash is a simpleprocess, similar to loading an SRAM. Architectural and cir-cuit features within the devices minimize software and sys-tem overhead while simplifying programming procedures.Atmels Flash Memories require only about one-tenth of the

    Device ID VCC Sector Size tWC

    AT29C040 5B 5.0V 10% 512 bytes 10 ms

    AT29C040A A4 5.0V 10% 256 bytes 10 ms

    AT29LV040 3B 3.3V 0.3V 512 bytes 20 ms

    AT29LV040A C4 3.3V 0.3V 256 bytes 20 ms

    AT29BV040 3B 3.0V 10% 512 bytes 20 ms

    AT29BV040A C4 3.0V 10% 256 bytes 20 ms

    AT89C51 Microcontroller 0000-1FFF Internal program

    memory

    8K x 8 Static RAM 2000-3FFF Data memory

    AT29C040 Fl h 4000 5FFF P d

  • 8/3/2019 Programming Atmel's Family of Flash Memories

    4/4

    Microcontroller

    5-34

    A 0A 1A 2A 3A 4A 5A 6A 7A 8A 9A 10A 11A 12

    A 0A 1A 2A 3A 4A 5A 6A 7

    A 8A 9A 10A 11A 12

    CE 1OEWE

    1314151718192021

    8K x 8 SRAM

    74HCT08 AT29C040

    CE 2

    19161512

    9652

    181714138743

    202227

    111

    3938373635343332

    2122232425262728

    1716293011

    10

    31

    19

    18

    9

    12131415

    12345678

    EA/VP

    XTAL1

    XTAL2

    RESET

    INT 0INT 1T 0T 1

    P 1.0P 1.1P 1.2P 1.3P 1.4P 1.5P 1.6P 1.7

    P 0.0P 0.1P 0.2P 0.3P 0.4P 0.5P 0.6P 0.7

    P 2.0P 2.1P 2.2P 2.3P 2.4P 2.5P 2.6P 2.7

    PSENALE /

    TXD

    RXD

    RDWR

    P

    Q 7Q 6Q 5Q 4Q 3Q 2Q 1Q 0

    Y 0Y 1Y 2Y 3Y 4Y 5Y 6Y 7

    151413121110

    97

    GO C

    D 7D 6D 5D 4D 3D 2D 1D 0

    222431

    109876543

    25242123

    2

    12111098765

    272623254

    282932

    301

    1112131516171819

    D 0D 1D 2D 3D 4D 5D 6D 7

    D 0D 1D 2D 3D 4D 5D 6D 7

    D 0D 1D 2D 3D 4D 5D 6D 7

    D 0D 1D 2D 3D 4D 5D 6D 7

    A 0A 1A 2A 3A 4A 5A 6A 7A 8A 9A 10A 11A 12A 13A 14A 15A 16A 17A 18

    A 0A 1A 2A 3A 4A 5A 6A 7

    A 8A 9A 10A 11A 12A 13A 14A 15A 16A 17A 18

    CEOEWE

    VCC

    VCC

    VCC

    10K

    1 CLK

    12 MHz

    AT89C51

    74HCT373

    A10

    A9

    A8

    A6

    A5

    A12

    A11

    A4

    A3

    A2

    A0

    A7

    A1

    A1

    8

    A1

    7

    A1

    6

    A1

    5

    A1

    4

    A1

    3

    O0

    O1

    O2

    O3

    O4

    O5

    O6

    O7

    ABC

    123

    645

    G 1G 2 AG 2 B

    74HCT138

    1

    2

    26VCC

    Figure 1. Atmel AT29C040DA Demo Circuit

    Note: If the Flash is to be used as external program memory, thenpin 31 ( / V ) of the AT89C51 should be connected to ground.EA PP