1.3 FAT Filesystem using NVM and SDSPI Media
This application shows an example of using the MPLAB Harmony File System to access files across multiple media (NVM, SDSPI).
Description
File System Operations on NVM and SD Card:
- The application contains a FAT disk image consisting of a Master Boot Record (MBR) sector, Logical Boot Sector, File Allocation Table, and Root Directory Area, placed in the internal Flash memory (NVM).
- A SD card is used as another disk, which might have FAT16 or FAT32 implemented on it (dependent on the formatting of SD card).
- The application searches the NVM media for a file named FILE.TXT, opens and reads the contents of the file in NVM and copies the contents to the file, FILE.TXT, in the SD card.
- Once the copy is successful, an addition string “Test is successful” is added to the file. If the write operation is successful, LED indication is provided.
File system layer uses:
- Memory driver to communicate with underlying NVM media
- SDSPI Driver to communicate to SD Card over SPI
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. This content can also be downloaded using content manager by following these instructions.
Path of the application within the repository is apps/fs/nvm_sdspi_fat_multi_disk/firmware.
To build the application, refer to the following table and open the project using its IDE.
Project Name | Description |
---|---|
pic32mz_ef_sk_freertos.X | MPLABX project for PIC32MZ Embedded Connectivity with FPU (EF) Starter Kit |
Setting Up the Hardware
The following table shows the target hardware for the application projects.
Project Name | Description |
---|---|
pic32mz_ef_sk_freertos.X | PIC32MZ Embedded Connectivity with FPU (EF) Starter Kit |
Setting Up PIC32MZ Embedded Connectivity with FPU (EF) Starter Kit
- To run the demo, the following additional hardware are required:
- Multimedia Expansion Board II
- One micro-sd card
- Mount the PIC32MZ Embedded Connectivity with FPU (EF) Starter Kit on to the Multimedia Expansion Board II
- Insert the micro-SD Card in the micro-SD Card slot of the Multimedia Expansion Board II
- Connect the Debug USB port on the board to the computer using a mini USB cable
Running the Application
- Build and program the application using its IDE
- The LED is turned ON when the content from the NVM media is copied to SD-Card
successfullyRefer to the following table for LED name:
Board LED Name PIC32MZ Embedded Connectivity with FPU (EF) Starter Kit LED1 - If Success, Insert the SD Card on to your host PC
- FILE.txt should have the content “This data from NVM Disk Test is successful”