SF1000 User's Manual

SF1000

Serial Flash Expansion Card

User's Manual

019-0102 • 020118-D

## SF1000 User's Manual

Part Number 019-0102 • 020118-D • Printed in U.S.A.

© 2001 Z-World, Inc. • All rights reserved.

Z-World reserves the right to make changes and
improvements to its products without providing notice.

Notice to Users

Z-WORLD PRODUCTS ARE NOT AUTHORIZED FOR USE AS CRITICAL COMPONENTS IN LIFE-SUPPORT DEVICES OR SYSTEMS UNLESS A SPECIFIC WRITTEN AGREEMENT REGARDING SUCH INTENDED USE IS ENTERED INTO BETWEEN THE CUSTOMER AND Z-WORLD PRIOR TO USE. Life-support devices or systems are devices or systems intended for surgical implantation into the body or to sustain life, and whose failure to perform, when properly used in accordance with instructions for use provided in the labeling and user's manual, can be reasonably expected to result in significant injury.

No complex software or hardware system is perfect. Bugs are always present in a system of any size. In order to prevent danger to life or property, it is the responsibility of the system designer to incorporate redundant protective mechanisms appropriate to the risk involved.

All Z-World products are 100 percent functionally tested. Additional testing may include visual quality control inspections or mechanical defects analyzer inspections. Specifications are based on characterization of tested sample units rather than testing over temperature and voltage of each unit. Z-World may qualify components to operate within a range of parameters that is different from the manufacturer's recommended range. This strategy is believed to be more economical and effective. Additional testing or burn-in of an individual unit is available by special arrangement.

Trademarks

• Dynamic C® is a registered trademark of Z-World, Inc.

• PLCBus™ and Rabbit 2000™ are trademarks of Z-World, Inc.

• Z80/Z180 is a trademark of Zilog Inc.

# Introduction

The SF1000 is a serial-interfaced flash memory card designed to work with Z-World's single-board computers. Single-board computers equipped with the Rabbit 2000 processor can use the SF1000 with either a synchronous serial peripheral interface (SPI) or an emulated SPI via parallel I/O ports. Zilog Z180-based single-board computers must use the emulated SPI method.

Two SF1000 models are presently offered, as shown in Table 1.

Larger memories will be possible in the future when parts become available.

# Getting Started

## Headers

The SF1000 comes with a 10-pin, 2 mm, 5×2 header located at J1 as shown in Figure 1. Headers, either plugs or sockets, SMT or through-hole, may also be installed at J2 or J3. The pinouts for these positions are identical, and allow for a connecting cable to be hooked up in different ways. There is also a location at J4 for a 7-pin in-line header or socket with 0.1" spacing. Position 6 at J4 is not used, which allows this connection to be keyed.

### Figure 1. User Connection Points to SF1000

## Pinout

Only six connections are required to interface the SF1000 with a Z-World single-board computer:

• +5 V

• Ground

• Chip Select input

• Serial Clock Input

• Serial Data Input

• Serial Data Output. This output is inverted because the serial flash is a 3 V part and the signal is converted to 5 V via an inverting transistor buffer.

Figure 2 shows the pinouts for the SF1000 header locations.

### Figure 2. SF1000 Pinout

## Connections

### Rabbit 2000 Boards

Serial Port B on all the Rabbit-based boards is the recommended port to use to connect the SF1000 serial flash card. Table 2 lists the connections.

Refer to the user's manual for you Rabbit-based single-board computer for the locations of these connection pins.

While Serial Port B is the recommended port for connecting the SF1000 serial flash card, the programming port (Serial Port A), which is compatible with the header pinout on header J1 on the SF1000, or a parallel I/O port may also be used.

Note that the programming port (Serial Port A) will not be available for application development and debugging if it is used to connect the SF1000 serial flash card.

Refer to the "Programming Information" section of the "Software" chapter for details of the software associated with your choice of connections.

A synchronous Serial Port B is not available on the BL2000, and so the following parallel-port connections are recommended instead.

All three BL2000 outputs need to be pulled up to +5 V with a pull-up resistor of 1 kW to 2 kW. The following additional modifications need to be made.

• Remove R161 (removes GND from J9/J11 pin 12).

• Install R160 (adds VCC to J9/J11 pin 12).

• Remove C46, C47, and C48 (removes filter capacitors, which slow down the output signals).

• Remove C31 (removes filter capacitor, which slows down the input signals).

Figure 3 shows the locations of these components.

### Figure 3. Locations of BL2000 Components to be Added or Removed

### Z180 Boards

The following Z180-based boards are currently supported:

• BL1100

• BL1500

• BL1700

• LP3100

• PK2200

Figure 4 shows the connections to these boards. These connections may be modified as long as the library functions are also modified accordingly in the library specific to the single-board computer (e.g., EZIOBL17.LIB).

### (a) BL1100 Connections

### (b) BL1500 Connections

### (c) Bl1700 Connections

Note that a capacitor must be removed on the BL1700 as indicated in Figure 4(c) to keep the SER_IN signal from getting slowed down too much by the capacitor.

### (d) LP3100 Connections

### (e) PK2200 Connections

Figure 4. SF1000 Connections to Z180-Based Boards

Note that a capacitor must be removed on the PK2200 as indicated in Figure 4(e) to keep the SER_IN signal from getting slowed down too much by the capacitor.

Be sure to add a 1 kW pull-up resistor to pull up each of the three PK2200 outputs used to +5 V.

# Software

The SF1000 serial flash expansion card implements a flash memory chip with a single, large, linear address space. It is up to the user to maintain appropriate information within the program in order to store and retrieve data in the flash memory.

The flash memory chip consists of a series of "sectors." The size of each sector is the same within a given chip, but can vary from one chip to another. A sector also contains extra bytes that are not made available to the user. Some of these bytes are used by the driver as follows:

• a fixed sync value, indicating that the sector has been written to at least once,

• a version number, and

• a long integer value for the number of times the sector has been written.

The user should keep in mind that a flash memory chip has a limited number of write cycles per sector, and that an entire sector must be written at a time. The chips used in the SF1000 serial flash cards are specified at 50,000 write cycles typical. The most efficient usage dictates that the user "block" all writing to the flash memory so that only full sectors are written.

More than one SF1000 serial flash card may be used in the control system built around the Z-World single-board computer. Users have to write their own CS_enable/CS_disable functions to control the chip select signals on the SF1000 serial flash cards. The only restriction is that all the SF1000 serial flash cards have the same size of flash memory chip, i.e., 4M or 8M.

## Dynamic C

Z-World's Dynamic C integrated devlopment software is used to add API functions from the SF1000.LIB library to your program. The SF1000.LIB library is available in Dynamic C Premier for Rabbit-based boards and in DC 32 for selected Z180-based boards.

### SF1000.LIB Library Functions

The following API functions are available in the Dynamic C SF1000.LIB library. These functions are blocking functions, but do not disable interrupts. The functions are not re-entrant.

    •     int SF1000Init ( void );

Minimum setup needed to verify correct flash operation.

PARAMETERS: None.

RETURN VALUES:

- 0 = success
- -1 = invalid density value read
- -2 = unknown response
- -3 = maybe no SF1000?

GLOBALS DEFINED:

    int SF1000_Density_Value
    int SF1000_Sector_size
    int SF1000_Block_size
    int SF1000_Nbr_of_Blocks

    •     int SF1000Write ( long FlashAddrDest, void* Data, int ByteCount );

Write a block of data to the flash.

PARAMETERS:

- 1 = (long) address of destination
- 2 = (void*) source RAM starting address
- 3 = (int) number of bytes to write

RETURN VALUES:

- 0 = success
- -1 = illegal byte count
- -2 = illegal flash address

    •     int SF1000Read ( long FlashAddrSource, void* Data, int ByteCount );

Read a block of data from the flash.

PARAMETERS:

- 1 = (long) address of source
- 2 = (void*) destination RAM starting address
- 3 = (int) number of bytes to write

RETURN VALUES:

- 0 = success
- -1 = illegal byte count
- -2 = illegal flash address

    •     long SF1000CheckWrites ( int Block );

Read the number of times that a block has been written.

PARAMETER: (int) block number (0 relative)

RETURN VALUE: the number of times the block has been written.

## Programming Information

### Rabbit 2000 Boards

Define the following values before the #use SF1000.LIB statement.

1. Interface (default is SF1000_SER_B)

- SPI_SER_A use Serial Port A
- SPI_SER_B use Serial Port B
- SPI_PARALLEL use a parallel I/O port

2. SPI bit rate (if using a serial port—default is 5)

- SPI_CLK_DIVISOR

This is the divisor for the appropriate Timer A register.

3. I/O bit to be used for Chip Select (default is PB7)

- SF1000_CS_PORT
- SF1000_CS_PORTSHADOW
- SF1000_CS_BIT

4. I/O bits for parallel interface

- SPI_TX_REG register for clock and Tx data (default is PDDR)
- SPI_TXD_BIT bit number for Tx data (default is bit 1)
- SPI_CLK_BIT bit number for clock (default is bit 0)
- SPI_RX_REG register for Rx data (default is PDDR)
- SPI_RXD_MASK mask for Rx bit (default is 8, bit 3)

The default values will be used if SPI_TX_REG is not defined. If SPI_TX_REG is defined, then all the values must be defined.

The I/O port must be initialized for proper operation of the input and output!

If you are using the alternate Serial Port B I/O pins, you need to define SERB_USEPORTD.

#### BL2000

These are the required setup definitions when the BL2000 connections are made using Parallel Port A as described in this manual.

    #define SPI_MODE_PARALLEL 1 // show using parallel I/O
    #define SF1000_CS_PORT PADR
    #define SF1000_CS_PORTSHADOW PADRShadow
    #define SF1000_CS_BIT 1
    #define SPI_TX_REG PADR
    #define SPI_TXD_BIT 3
    #define SPI_CLK_BIT 2
    #define SPI_RX_REG PBDR
    #define SPI_RXD_MASK 0x20
    #define SPI_INVERT_CLOCK
    // define the chip select macro
    #define CS_ENABLE BitWrPortI ( SF1000_CS_PORT,
    &SF1000_CS_PORTSHADOW, 1, SF1000_CS_BIT );
    #define CS_DISABLE BitWrPortI ( SF1000_CS_PORT, &SF1000_CS_PORTSHADOW, 0, SF1000_CS_BIT );
    #define PROC_RABBIT

These are the initialization statements.

    brdInit();     // initialize the I/O of the BL2000
    SPIxor = 0xFF; // invert the received bits due to
                   // inverter on SF1000
    SPITXxor = 0xFF; // invert the transmitted bits
                     // due to BL2000 output

### Z180 Boards

The following Z180-based boards are currently supported.

• BL1100

• BL1500

• BL1700

• LP3100

• PK2200

Figure 3 in the "Getting Started" chapter shows the connections to these boards. These connections may be modified as long as the library functions are also modified accordingly in the library specific to the single-board computer (e.g., EZIOBL17.LIB).

# Appendix. Specifications

## General Specifications

Table A-1 lists the electrical, mechanical, and environmental specifications for an SF1000 serial flash card.

## Mechanical Specifications

Figure A-1 shows the mechanical dimensions of an SF1000.

### Figure A-1. SF1000 Dimensions

Table A-2 lists the pin 1 locations.

Figure A-2 shows the footprint of another board that the SF1000 would be plugged into. These values are relative to the header connectors.

### Figure A-2. User Board Footprint for SF1000

# Schematics

SF1000 Schematic

Z-World http://www.zworld.com Voice: (530) 757-3736 FAX: (530) 757-3792 sales@zworld.com