1.2 FAT Filesystem Using SDMMC Media
This application shows an example of using the MPLAB Harmony File System to access and modify the contents of a SD card using the SDMMC driver.
Description
File System Operations on the SD Card:
- Application opens a file
named FILE_TOO_LONG_NAME_EXAMPLE_123.JPG in the root directory of
the SD card and reads its content into memory
- The image file could be any arbitrary JPEG (image) file chosen by the user and then renamed to FILE_TOO_LONG_NAME_EXAMPLE_123.JPG
- Application creates directory named Dir1 in the root directory
- Application creates a new file named FILE_TOO_LONG_NAME_EXAMPLE_123.JPG inside Dir1
- Application copies the content from step 1 into this newly created file
The reason for choosing a JPEG file for test purposes is that the duplicate file, Dir1/FILE_TOO_LONG_NAME_EXAMPLE_123.JPG created by the demonstration could be easily verified for correctness. If the new file inside Dir1 opens for viewing on the computer and matches to original image, the test is deemed to have passed. Otherwise, if the file does not open (i.e., is corrupted), the test will be considered to have failed.
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/sdmmc_fat.
To build the application, refer to the following table and open the project using its IDE.
| Project Name | Description |
|---|---|
| sam_a7d65_curiosity.X | MPLAB X project for SAMA7D65 Curiosity Board |
| sam_a7d65_curiosity_pro.X | MPLAB X project for SAMA7D65 Curiosity Pro Board |
Setting Up AT91Bootstrap Loader
To load the application binary onto the target device, it is necessary to use at91bootstrap loader. Refer to the at91bootstrap loader documentation for details on how to configure, build, and run bootstrap loader project and use it to bootstrap the application binaries.
Setting Up the Hardware
The following table shows the target hardware for the application projects.
| Project Name | Description |
|---|---|
| sam_a7d65_curiosity.X | SAMA7D65 Curiosity Board |
| sam_a7d65_curiosity_pro.X | SAMA7D65 Curiosity Pro Board |
Setting Up SAMA7D65 Curiosity Board
- SD card with FAT32 file system
- Create a new JPEG file in the SD Card with name FILE_TOO_LONG_NAME_EXAMPLE_123.JPG
- Connect the USBA port J3 on the board to the computer using a USB Type-C® cable (to power the board)
- Use SDMMC1 (J10) slot
Setting Up SAMA7D65 Curiosity Pro Board
- SD Card with FAT32 file system
- Create a new JPEG file in the SD Card with name FILE_TOO_LONG_NAME_EXAMPLE_123.JPG
- Connect the USBA port J1 on the board to the computer using a USB Type-C cable (to power the board)
- Use SDMMC1 (J42) slot
Running the Application
- Build the application using its IDE.
- The LED is turned ON if there was no error during creating the directory and copying the file into it.
| Board | LED Name |
|---|---|
| SAMA7D65 Curiosity Board | RGB_LED (Green) |
| SAMA7D65 Curiosity Pro Board | RGB_LED (Green) |
