USB Flash Drive Audio Player Tutorial: Step 3

Step 3: Configure USB Library (Mass Storage Host)

1

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. 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).

2

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

3

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

4

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.

5

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

6

Keep the Number of TPL Entries to 1. The TPL (Targeted Peripheral List) 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 MSD Devices.

usb_tpl.png


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: SCSI transparent command) and 0x50 (Protocol code : Bulk-only Transfer).

7

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 4 interfaces, then the Host Max Interface per Device value should be a minimum of 4, or the device will not be processed by the USB host layer. The mass storage device descriptors define only one interface, so the Host Max Interface per Device may be changed to 1.

8

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 FAT.

9

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.

image_32.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.