Purpose
This basic example shows how to use the Flash service available on the Atmel SAM flash microcontrollers. It reads and displays the Unique Identifier stored in the Flash.
Requirements
This package can be used with SAM evaluation kits.
Description
To read the Unique Identifier, the sequence is:
-
Send the Start Read Unique Identifier command (STUI) by writing the Flash Command Register with the STUI command.
-
When the Unique Identifier is ready to be read, the FRDY bit in the Flash Programming Status Register (EEFC_FSR) falls.
-
The Unique Identifier is located in the first 128 bits of the Flash memory mapping. So, at the address 0x80000-0x80003.
-
To stop the Unique Identifier mode, the user needs to send the Stop Read Unique Identifier command (SPUI) by writing the Flash Command Register with the SPUI command.
-
When the Stop Read Unique Identifier command (SPUI) has been performed, the FRDY bit in the Flash Programming Status Register (EEFC_FSR) rises.
Usage
- Build the program and download it into the evaluation board.
- On the computer, open and configure a terminal application (e.g., HyperTerminal on Microsoft Windows) with these settings:
- 115200 bauds
- 8 bits of data
- No parity
- 1 stop bit
- No flow control
- Start the application.
- In the terminal window, the following text should appear:
-- Flash Read Unique Identifier Example --
-- xxxxxx-xx
-- Compiled: xxx xx xxxx xx:xx:xx --
-I- Reading 128 bits unique identifier
-I- ID: 0xxxxxxxxx, 0xxxxxxxxx, 0xxxxxxxxx, 0xxxxxxxxx