USB Flash Drive Audio Player Tutorial: Step 3

Step 3: Configure USB Library (Mass Storage Host)


Expand the Harmony Framework Configuration > USB Library selection tree and check the Use USB Stack? box.

The USB library is dependent on the Timer System Service for maintaining internal timing requirements. MPLAB® Harmony Configurator (MHC) knows this, so it enables the Timer System Service for you. Note the Use Timer System Service? option has been selected under the System Services > Timer selection tree.

MHC also knows the Timer System Service needs a Timer driver to function, so it enables this for you too. Note the Use Timer Driver? option has been selected under the Harmony Framework > Configuration > Drivers > Timer selection tree. Observe that MHC has configured Timer Instance 0 to use the Timer1 peripheral (TMR_ID_1).


The Interrupt Mode is checked by default. Keep this selection.


Expand the Select Host or Device Stack option. Uncheck the USB Device option and check the USB Host (Recommended) option.


Keep the Host Speed as USB_SPEED_HIGH. The PIC32MZ Host supports both Full Speed and High Speed operations. Selecting High Speed allows the device to work at both Full Speed and High Speed.


Keep the Number of Devices to the default value of 1.


Keep the Number of TPL Entries to 1. The Targeted Peripheral List (TPL) allows the USB host to focus on specific USB devices. For Mass Storage Class, the Host Layer attaches the MSD Host Client Driver to a device when the class, subclass, and protocol fields in the Interface Descriptor matches the entry in the TPL table. The following code shows a TPL table design for matching Mass Storage Devices (MSD).


This shows that the Host Layer attaches the USB_HOST_MSD_INTERFACE driver whenever the class code, sub-class code, and protocol code in the USB interface descriptor of the device matches 0x08 (Class code: Mass Storage), 0x06 (Sub-class code: Small Computer System Interface (SCSI) transparent command) and 0x50 (Protocol code: Bulk-only Transfer).


Keep the Host Max Interface per Device at 5. This defines the maximum number of interfaces the host can support.

If the attached device's configuration descriptor indicates four interfaces, then the Host Max Interface per Device value should be a minimum of four, or the device will not be processed by the USB host layer. The MSD descriptors define only one interface, so the Host Max Interface per Device may be changed to 1.


Since this is a USB MSD Host application, check the Use MSD Host Client Driver box.

MHC knows the USB MSD Host Client Driver is dependent on the File System Service, so it enables this for you. Note the Use File System Service? option has been selected under the System Services > File System selection tree. Observe MHC has configured the File System type to File Allocation Table (FAT).


Keep the Number of MSD Host Driver Instances at 1. This defines the maximum number of MSD Host Driver instances. If you wanted to support two Flash drives, then you would set this value to 2.


Next Step >

© 2024 Microchip Technology, Inc.
Notice: ARM and Cortex are the registered trademarks of ARM Limited in the EU and other countries.
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.