# Basic Serial Flash Project 1.4

## Purpose

This program tests the dataflash present on the evaluation kit by erasing and writing each one of its pages.

## Hardware Requirements

This package can be used with any of the Atmel evaluation kit.

An external AT26 serial dataflash must be connected to the SPI bus of the microcontroller for this example to work properly. A convenient solution is to use an external PCB with the SD card form factor: that way, it can be directly plugged into the SD card port of the evaluation kit (since SPI pins are multiplexed with MCI pins).

The photo below show a possible implementation of that solution, as done by Atmel (download the schematic):

## Description

Upon startup, the program will connect to the serial firmware dataflash through the SPI and start sending commands to it. It will perform the following:

- Read the JEDEC identifier of the device to autodetect it
- Erase the chip
- Check that each page is blank
- Write a "Walking one" pattern on each page:

> `Byte 0 = 00000001
> Byte 1 = 00000010
> Byte 2 = 00000100
> ........`

- Verify that the pattern has been correctly applied on each page

## Usage

1. Build the application.
2. On the computer, open the DBGU port with a terminal application (e.g. HyperTerminal on Microsoft Windows).

- Settings: 115200 bauds, 8 bits, 1 stop bit, no parity, no flow control.

3. Download the program inside the evaluation board and run it. Please refer to the SAM-BA User Guide, the GNU-Based Software Development application note or to the IAR EWARM User Guide, depending on your chosen solution.
4. Upon startup, the application will output the following lines on the DBGU:

   > `-- Basic Serial Firmware Dataflash Project 1.4 --
   > -I- SPI and At26 initialized`

5. The next line should indicate if the serial dataflash has been correctly identified. For example, this is what appears when an AT26DF321 chip is recognized:

   > `-I- AT26DF321 Serial Flash detected`

6. If a chip has been recognized, then the tests described in the application description will be run.

###### Atmel Corporation ©2008