USB Flash Drive Audio Player Tutorial: Step 4

Step 4: Configure File System

A file system is needed to access the files on the flash drive.

1

Expand the Harmony Framework Configuration > System Services > File System selection tree. Note that MPLAB® Harmony Configurator (MHC) has already selected the Use File System Service? option for you (as described in the previous step).

2

Expand the Use File System Service?. Keep the Maximum Simultaneous File Access value at 1.

3

The Size of block is set to 512 and is grayed out.

4

Keep the Size of Media Flash Page Buffer value at 2048.

This is used to reserve a static buffer of this size in cases where the media block size is higher than 512 bytes. In such cases, a read-modify-write operation is performed. You need to provide a value equal to the block size of the corresponding media (flash drive in this case), for holding one complete block of memory for the read-modify-write operation.

5

Enable the Use File System Auto Mount Feature?. This causes the USB MSD Host client driver to automatically mount the file system on the drive and then notify the application through SYS_FS_MOUNT_EVENT in the file system event handler registered by the application. Note that in previous MHC versions, mounting of file system was handled by the application when the application received a USB_HOST_MSD_EVENT_ATTACH in the USB Host MSD event handler registered by the application.

6

Keep the Total Number Of Media value at 1. This application supports only one mass storage media (the flash drive). If the application needed to support 1 flash drive and 1 SD card, then the Total Number Of Media must be set to 2.

7

Now, the media must be configured. Expand Media 0 > Media Configuration (0) (note the Media 0 box is already checked). Change the Media Type to SYS_FS_MEDIA_TYPE_MSD. This causes the media driver functions to use the USB Mass Storage SCSI functions in order to access the media.

8

Make sure the File System Type for Media 0 is selected as FAT.

9

Keep the Number of Volumes value at 1. This reflects the number of valid partitions available on the media. Make sure Volume 1 is selected, and that the Device Name and Media Mount Name are set to /dev/sda1 and /mnt/myDrive1 respectively.

10

Keep the File System Types value at 1. Note that this setting is different from the File System Type setting present under Media 0.

Some applications could use multiple medias (e.g., one flash drive and one SD card), each using either a FAT file system or the Microchip File System. In this case, you would need to enable support for both FAT File System and the Microchip File System under the File System tab; and then select one of these file systems for each Media under the individual media configuration (example: Media 0) tab.

image_fs_config.png



Next Step >

© 2016 Microchip Technology, Inc.
Information contained on this site regarding device applications and the like is provided only for your convenience and may be superseded by updates. It is your responsibility to ensure that your application meets with your specifications. MICROCHIP MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND WHETHER EXPRESS OR IMPLIED, WRITTEN OR ORAL, STATUTORY OR OTHERWISE, RELATED TO THE INFORMATION, INCLUDING BUT NOT LIMITED TO ITS CONDITION, QUALITY, PERFORMANCE, MERCHANTABILITY OR FITNESS FOR PURPOSE. Microchip disclaims all liability arising from this information and its use. Use of Microchip devices in life support and/or safety applications is entirely at the buyer's risk, and the buyer agrees to defend, indemnify and hold harmless Microchip from any and all damages, claims, suits, or expenses resulting from such use. No licenses are conveyed, implicitly or otherwise, under any Microchip intellectual property rights.