Jump to main content

##

# 1.17 SPI Flash Write Read

This example shows how to use the SPI Peripheral library to perform erase, write and read operation with the SPI Serial Flash memory.

## Description

This example uses the SPI peripheral library to erase and write an array of values to the SPI Serial Flash memory. It verifies the value written by reading the values back and comparing it to the value written.

## Downloading and Building the Application

To clone or download this application from Github, go to the main page of this repository and then click Clone button to clone this repository or download as zip file.

Path of the application within the repository is apps/spi/host/spi_flash_write_read.

To build the application, refer to the following table and open the project using its IDE.

Project Name | Description
--- | ---
pic32ak_gc_curiosity.X | MPLABX project for Curiosity Platform Development Board and PIC32AK1216GC41064 General Purpose Dual In-Line Module (DIM)

## Setting Up the Hardware

The following table shows the target hardware for the application projects.

Project Name | Description
--- | ---
pic32ak_gc_curiosity.X | Curiosity Platform Development Board and PIC32AK1216GC41064 General Purpose Dual In-Line Module (DIM)

### Setting Up Curiosity Development Board

- Insert the GP DIM on to DIM slot of Curiosity Board
- Connect the PKoB (J24) on the board to the computer using a USB type-C cable

## Running the Application

1. Build and Program the application project using its respective IDE
2. Reset the device by power cycle
3. The LED indicates the success or failure:
   - The LED is turned ON when the value read from the SPI Serial Flash memory matched with the written value

The following table provides the LED name:

Board | LED Name
--- | ---
Curiosity Platform Development Board and PIC32AK1216GC41064 General Purpose Dual In-Line Module (DIM) | LED0