<< Previous | Index | Next >>

> ## Chapter 11. Flash Memories

> The flash memories listed in the table below have been qualified for use with the Rabbit 2000 microprocessor. Starting with Dynamic C version 7.20 large sector flash devices (sectors greater than 4096 bytes) are supported. To incorporate a large-sectored flash into an end product, the best strategy is have a small-sectored development board.

> IMPORTANT: The rapidly changing market for flash devices may affect availability. The inclusion of a flash device in the following table does not speak to its availability.

> Vendor | Device Name | Device Size (bytes) | Sector Size (bytes) | Number of Sectors | Write Mode | Best Access Time (ns) | Operating Voltage (V) | Package Typesa | Dynamic C Version
> Atmel | AT29C1024 | 64K | 128 | 512 | sector | 70 | 4.5-5.5 | 5, 6 | 7.02b
> Atmel | AT29LV1024 | 64K | 128 | 512 | sector | 150 | 3.0-3.6 | 5, 6 | 7.02b
> Atmel | AT29C010 | 128K | 128 | 1024 | sector | 70 | 4.5-5.5 | 1, 2, 4 | All
> Atmel | AT29LV010 | 128K | 128 | 1024 | sector | 150 | 3.0-3.6 | 2, 4 | All
> Atmel | AT29BV010 | 128K | 128 | 1024 | sector | 200 | 2.7-3.6 | 2, 4 | 7.02b
> Atmel | AT29C020 | 256K | 256 | 1024 | sector | 70 | 4.5-5.5 | 1, 2, 4 | 6.50
> Atmel | AT29LV020 | 256K | 256 | 1024 | sector | 200 | 3.0-3.6 | 2, 4 | 6.50
> Atmel | AT29BV020 | 256K | 256 | 1024 | sector | 250 | 2.7-3.6 | 2, 4 | 7.02b
> Atmel | AT29C040 | 512K | 256 | 2048 | sector | 120 | 4.5-5.5 | 1, 4 | 6.57b
> Atmel | AT29LV040 | 512K | 256 | 2048 | sector | 200 | 3.0-3.6 | 4 | 6.57b
> Atmel | AT29BV040 | 512K | 256 | 2048 | sector | 200 | 2.7-3.6 | 4 | 6.57b
> Mosel/Vitelic | V29C51001 | 128K | 512 | 256 | byte | 45 | 4.5-5.5 | 1, 2, 4 | 6.50
> Mosel/Vitelic | V29LC51001 | 128K | 512 | 256 | byte | 90 | 4.5-5.5 | 1, 2 | 7.02b
> Mosel/Vitelic | V29C51002 | 256K | 512 | 512 | byte | 55 | 4.5-5.5 | 1, 2, 4 | 6.50
> Mosel/Vitelic | V29LC51002 | 256K | 512 | 512 | byte | 90 | 4.5-5.5 | 1, 2 | 7.02b
> Mosel/Vitelic | V29C51004 | 512K | 1024 | 512 | byte | 70 | 4.5-5.5 | 2, 4 | 6.57b
> Mosel/Vitelic | V29C31004 | 512K | 1024 | 512 | byte | 90 | 3.0-3.6 | 2, 4 | 7.02b
> SST | SST29EE512 | 64K | 128 | 512 | sector | 70 | 4.5-5.5 | 1, 2, 3, 4 | 6.50c
> SST | SST29LE512 | 64K | 128 | 512 | sector | 150 | 3.0-3.6 | 1, 2, 3, 4 | 6.50c
> SST | SST29VE512 | 64K | 128 | 512 | sector | 150 | 2.7-3.6 | 1, 2, 3, 4 | 7.20
> SST | SST29EE010 | 128K | 128 | 1024 | sector | 90 | 4.5-5.5 | 1, 2, 3, 4 | All
> SST | SST29LE010 | 128K | 128 | 1024 | sector | 150 | 3.0-3.6 | 1, 2, 3, 4 | All
> SST | SST29VE010 | 128K | 128 | 1024 | sector | 150 | 2.7-3.6 | 1, 2, 3, 4 | 7.20b
> SST | SST29EE020 | 256K | 128 | 2048 | sector | 120 | 4.5-5.5 | 1, 2, 3, 4 | 7.02b
> SST | SST29LE020 | 256K | 128 | 2048 | sector | 200 | 3.0-3.6 | 1, 2, 3, 4 | 7.02b
> SST | SST29VE020 | 256K | 128 | 2048 | sector | 200 | 2.7-3.6 | 1, 2, 3, 4 | 7.20b
> SST | SST29SF512 | 64K | 128 | 512 | byte | 55 | 4.5-5.5 | 1, 2, 3 | 7.20b
> SST | SST29VF512 | 64K | 128 | 512 | byte | 55 | 2.7-3.6 | 1, 2, 3 | 7.20b
> SST | SST29SF010 | 128K | 128 | 1024 | byte | 55 | 4.5-5.5 | 1, 2, 3 | 7.20b
> SST | SST29VF010 | 128K | 128 | 1024 | byte | 55 | 2.7-3.6 | 1, 2, 3 | 7.20b
> SST | SST29SF020 | 256K | 128 | 2048 | byte | 55 | 4.5-5.5 | 1, 2, 3 | 7.20b
> SST | SST29VF020 | 256K | 128 | 2048 | byte | 55 | 2.7-3.6 | 1, 2, 3 | 7.20b
> SST | SST29SF040 | 512K | 128 | 4096 | byte | 55 | 4.5-5.5 | 1, 2, 3 | 7.20b
> SST | SST29VF040 | 512K | 128 | 4096 | byte | 55 | 2.7-3.6 | 1, 2, 3 | 7.20b
> SST | SST39SF512 | 64K | 4096 | 16 | byte | 45 | 4.5-5.5 | 1, 2, 3 | 7.20b
> SST | SST39LF512 | 64K | 4096 | 16 | byte | 45 | 3.0-3.6 | 1, 2, 3 | 7.20b
> SST | SST39VF512 | 64K | 4096 | 16 | byte | 70 | 2.7-3.6 | 1, 2, 3 | 7.20b
> SST | SST39SF010 | 128K | 4096 | 32 | byte | 45 | 4.5-5.5 | 1, 2, 3 | 7.02b
> SST | SST39LF010 | 128K | 4096 | 32 | byte | 45 | 3.0-3.6 | 1, 2, 3 | 7.20b
> SST | SST39VF010 | 128K | 4096 | 32 | byte | 70 | 2.7-3.6 | 1, 2, 3 | 7.20b
> SST | SST39SF020 | 256K | 4096 | 64 | byte | 45 | 4.5-5.5 | 1, 2, 3 | 6.50
> SST | SST39LF020 | 256K | 4096 | 64 | byte | 45 | 3.0-3.6 | 1, 2, 3 | 7.20b
> SST | SST39VF020 | 256K | 4096 | 64 | byte | 70 | 2.7-3.6 | 1, 2, 3 | 7.20b
> SST | SST39SF040 | 512K | 4096 | 128 | byte | 45 | 4.5-5.5 | 1, 2, 3 | 7.02b
> SST | SST39LF040 | 512K | 4096 | 128 | byte | 45 | 3.0-3.6 | 1, 2, 3 | 7.20b
> SST | SST39VF040 | 512K | 4096 | 128 | byte | 70 | 2.7-3.6 | 1, 2, 3 | 7.20b
> Winbond | W29CEE011 | 128K | 128 | 1024 | sector | 90 | 4.5-5.5 | 1, 2, 4 | 7.02b
> Winbond | W29C020CT | 256K | 128 | 2048 | sector | 70 | 4.5-5.5 | 1, 2, 4 | Allc
> Winbond | W29C040 | 512K | 256 | 2048 | sector | 90 | 4.5-5.5 | 2, 4 | 7.02b
> Table 11-1. 32-Pin Flash Memories Supported by the Rabbit 2000, Small Sector

> Vendor | Device Name | Device Size (bytes) | Sector Size (bytes) | Number of Sectors | Write Mode | Best Access Time (ns) | Operating Voltage (V) | Package Typesa | Dynamic C Version
> AMD | AM29LV001 | 128K | varies | 10 | byte | 45 | 4.5-5.5 | 2, 4 | 7.20b
> AMD | AM20LV001T | 128K | varies | 5 | byte | 45 | 4.5-5.5 | 2, 4 | 7.20
> Atmel | AT49F002 | 256K | varies | 5 | byte | 55 | 4.5-5.5 | 1, 2, 3, 4 | 7.20b
> Atmel | AT49F002T | 256K | varies | 5 | byte | 55 | 4.5-5.5 | 1, 2, 3, 4 | 7.20b
> Fujitsu | MBM29F002T | 256K | varies | 7 | byte | 55 | 4.5-5.5 | 2, 4 | 7.20b
> Fujitsu | MBM29F002B | 256K | varies | 7 | byte | 55 | 4.5-5.5 | 2, 4 | 7.20b
> Hyundai | HY29F002T | 256K | varies | 7 | byte | 45 | 4.5-5.5 | 1, 2, 4 | 7.20
> Hyundai | HY29F002B | 256K | varies | 7 | byte | 45 | 4.5-5.5 | 1, 2, 4 | 7.20b
> Table 11-2. 32-Pin Flash Memories Supported by the Rabbit 2000, Large Sector

> 1. Package Types:
>    1. 32-pin PDIP 2. 32-pin PLCC
>    3. 32-pin TSOP (8 mm × 14 mm) 4. 32-pin TSOP (8 mm × 20 mm)
>    5. 44-pin PLCC 6. 48-pin TSOP (8 mm × 14 mm)

> 2. These flash devices are supported as of the Dynamic C version listed, but have not all been tested with those versions. 512KB flash in particular may not work with versions prior to 7.04, but a software patch is available from Rabbit tech support for 512KB flash support under versions 6.57 and 7.03.

> 3. Dynamic C Versions 6.04-6.1x:
>    The `FLASH_SIZE` parameter in the `JRABBIOS.C` file needs to be changed to reflect the correct number of 4K pages for the selected device. By default, the `FLASH_SIZE` parameter contains a 0x20 that corresponds to a 128K x 8 device with thirty-two 4K pages of flash. Dynamic C versions 6.5x and greater determine the flash size automatically and no code change is required.

> ### 11.1 Supporting Other Flash Devices

> If a user wishes to use a flash memory not listed in the above tables, but still uses the same standard JEDEC write sequences as one of the supported flash devices, the existing Dynamic C flash libraries may be able to support it simply by modifying a few values in the BIOS. Specifically, three modifications need to be made:

> 1. The flash device needs to be added to the list of known flash types. This table can be found by searching for the label `FlashData` in the file `LIB\BIOSLIB\FLASHWR.LIB`. The format is described in the file and consists of the flash ID code, the sector size in bytes, the total number of sectors, and whether the flash is written one byte at a time or one entire sector at a time.

> 2. Near the top of the main BIOS file (`BIOS\RABBITBIOS.C` for most users), in the line

>     #define FLASH_SIZE _FLASH_SIZE_

> change `_FLASH_SIZE_` to a fixed value for your flash (the total size of the flash in 4096-byte pages).

> 1. If a version of Dynamic C prior to 7.02 is being used, the macro `_SECTOR_SIZE_` near the top of `LIB\BIOSLIB\FLASHWR.LIB` needs to be hard-coded in a manner similar to step 2 above. In the line :

>     #define MAX_FLASH_SECTORSIZE _SECTOR_SIZE_

> `_SECTOR_SIZE_` should be replaced with the sector size of your flash in bytes.

> Note that prior to Dynamic C 7.20, the BIOS only supported flash devices with equally-sized sectors of either 128, 256, 512, 1024, or 4096 bytes (i.e., small sector flash) If you are using an older version of Dynamic C (prior to version 7.20) and your flash device does not fall into that category, it may be possible to support it by rewriting the BIOS flash functions; see Section 11.2Writing Your Own Flash Driver for more information.

> Starting with Dynamic C 7.20, large sector flash devices are supported by the BIOS. Typically large sector flash devices have a variety of sector sizes on a single chip.

> ### 11.2 Writing Your Own Flash Driver

> If a user wishes to install a flash memory that cannot be supported by following the steps in the above section (for example, if it uses a completely different unlock/write sequence), two functions need to be rewritten for the new flash. This section explains the requirements of these two functions: `_InitFlashDriver` and `_WriteFlash`. They will need to replaced in the library that implements the flash driver, `FLASHWR.LIB`.

> Below is the C `struct` used by the flash driver to hold the required information about the flash memory installed. The`_InitFlashDriver` function is called early in the BIOS to fill this `struct` before any accesses to the flash.

>     struct {
>        char flashXPC;       // XPC required to access flash via XMEM
>        int sectorSize;      // byte size of one flash memory sector
>        int numSectors;      // number of sectors on flash
>        char writeMode;      // write method used by the flash
>        void *eraseChipPtr;  // pointer to erase chip function in RAM
>                          //     (eraseChipPtr is currently unused)
>        void *writePtr;      // ptr to write flash sector function (RAM)
>     } _FlashInfo;

> The field `flashXPC` contains the XPC required to access the first flash physical memory location via XMEM address E000h. The pointer `writePtr` should point to a function in RAM to avoid accessing the flash memory while working with it. You will probably be required to copy the function from flash to a RAM buffer in the flash initialization sequence.

> The field `writeMode` specifies the method that a particular flash device uses to write data. Currently, only two common modes are defined: "sector-writing" mode, as used by the SST SST29 and Atmel AT29 series (writeMode=1); and "byte-writing" mode, as used by the Mosel/Vitelic V29 series (writeMode=2). All other values of `writeMode` are currently undefined, although they may be defined by Rabbit Semiconductor as new flash devices are used.

> ### _InitFlashDriver

> This function is called from the BIOS. A bitmap of quadrants mapped to flash (0x01, 0x02, 0x04, 0x08 correspond to the 1st-4th quadrants, 0x0C = the topmost two quadrants) is passed to it in HL.

> This function needs to perform the following actions:

> 1. Load `_FlashInfo.flashXPC` with the proper XPC value to access flash memory address 00000h via XMEM address E 000h. The quadrant number for the start of flash memory is passed to the function in HL and can be used to determine the XPC value, if desired. For example, if your flash is located in the third memory quadrant, the physical address of the first flash memory location is 80000h. 80000h - E000h = 72000h, so the value placed into `_FlashInfo.XPC` should be 72h.

> 2. Load `_FlashInfo.sectorSize` with the flash sector size in bytes.

> 3. Load `_FlashInfo.numSectors` with the number of sectors on the flash.

> 4. `_FlashInfo.writePtr` should be loaded with the memory location in RAM of the function that will perform that action. The function will need to be copied from flash to RAM at this time as well.

> 5. This function should return zero if successful, or -1 if an error occurs.

> ### _WriteFlash

> This function writes exactly one sector of data from a buffer in RAM to the flash memory, aligned along a flash sector boundary. _WriteFlash is called from the BIOS (the user will normally call higher-level flash writing functions) as well as several libraries, and should be written to conform to the following requirements:

> - For versions of Dynamic C prior to 7.02, it should assume that the source data is located at the logical RAM address passed in BC. In all later versions of Dynamic C, a fixed 4096-byte block of XMEM is used for the flash buffer, which can be accessed via macros located at the top of `FLASHWR.LIB`. These macros include `FLASH_BUF_PHYS`, the unsigned long physical address of the buffer; `FLASH_BUF_XPC` and `FLASH_BUF_ADDR`, the logical address of the buffer via the XMEM window; and `FLASH_BUF_0015` and `FLASH_BUF_1619`, the physical address of the buffer broken down to be used with the LDP opcodes.

> - It should assume that the flash address to be written to is passed as an XMEM address in A:DE. The destination must be aligned with a flash memory sector boundary.

> - It should check to see whether the sector being written contains the ID or user blocks. If so, it should exit with an error code (see below). Otherwise, it should perform the actual write operation required by the particular flash used.

> - Interrupts should be turned off (set the interrupt level to 3) whenever writes are occurring to the flash. Interrupts should not be turned back on until the write is complete -- an interrupt may attempt to access a function in flash while the write is occurring and fail.

> - It should not return until the write operation is finished on the chip.

> - It should return a zero in HL if the operation was successful, a -3 if a timeout occurred during the wait, or a -4 if an attempt was made to write over the ID block.

Rabbit 2000 Designer's Handbook | << Previous | Index | Next>> | rabbit.com