MPLAB® Harmony v3 Drivers and Middleware on PIC32MZ EF MCUs using FreeRTOS: Step 3

Last modified by Microchip on 2023/11/09 09:08

Configure USB High Speed Driver

Click on the Resource Management [MCC] tab, In the Device Resources, expand Harmony > USB > Drivers.

Double-click on USB High Speed Driver to add the USB driver to the project.

​​​​​usb driver select​​​​​

sys time activation

​​usb driver project graph

  Click on USB High Speed Driver to verify the default MPLAB® Code Configurator (MCC) values.

usb driver conf

Associate SYS_TIME system service with CORE TIMER peripheral by right-clicking on the red diamond highlighted below.

core timer instance​​​​

core timer linked project graph​​​​

 Click on SYS_TIME to verify the default MCC values.

sys_time configuration​​

 Click on CORE TIMER to verify the default MCC values.

core timer conf​​

Back to Top

Step 3.2: Configure USB Host Middleware and File System Service

Click on the Resource Management [MCC] tab, In the Device Resources, expand Harmony > System Services.

 Double-click on FILE SYSTEM to add the File System Service to the project.

file system service select

file system linked project graph

 Associate the FILE SYSTEM Service with the Mass Storage Device (MSD) Client Driver by right clicking on the red diamond highlighted below.

​​msd driver instance

usb host activation

msd driver project graph linked

 Click on File System, check the box next to Use File System Auto Mount Feature, and select SYS_FS_MEDIA_TYPE_MSD for Media Type.

file system conf

Click on MSD Client Driver to verify the default MCC values.

msd client driver conf

Click on USB_HOST to verify the default MCC values.

usb host conf​​​

Back to Top


 Select the Clock Diagram tab and configure the USB clock setup as shown below.

  • Enable Primary Oscillator Mode (POSCMOD) as External Clock (EC) mode.
  • Setup Primary Oscillator clock speed as 12 MHz.
  • Select USB PLL Input Frequency Select bit (UPLLFSEL) as 12 MHz.

usb clock configuration setup

Back to Top


 Select the Pin Settings tab, scroll down to GPIO pin RJ13 (Pin Number 28) in the Pin ID column, and configure RJ13 as VBUS_AH to enable USB VBus.

usb vbus pin setup

VBUS needs to be enabled manually through a GPIO pin. The USB Host Application Programming Interface (API) periodically checks for VBUS status and VBUS is used to power any connected peripheral by supplying a +5 V voltage from the USB Host.

Back to Top