First Technology Transfer

Standard and Advanced Technical Training, Consultancy and Mentoring

Course M303 - A Comprehensive Introduction to USB and USB Programming Using PIC32 Microcontrollers

Duration: 5 Days

Intended Audience

Attendees are expected to have some familiarity with C programming, as well as some experience of working on embedded systems.


The course will provide an introduction to programming USB devices in PIC32 based applications. The emphasis will be on practical applications covering Human Interface Device (HID), Communication Class Device (CDC) and Mass Storage device classes. The course will also cover usage of USB Protocol analysers for testing, debugging and reverse engineering of USB application protocols. Key topics covered will include

  • An overview and critique of the USB 1.x and 2 protocol standards
  • The use USB Protocol analysers in troubleshooting and debugging USB application problems
  • An guided tour of the Microchip USB protocol stack
  • Use of MPLAB Harmony for Setting up the USB Protocol Stack
  • Techniques for implementing USB based applications for control, data logging and data acquisition purposes

Course Outline

  • Overview of USB
    • History of USB
    • Uses, benefits and limitations of USB
    • Evolution of USB Standards - USB 1.0, USB 1.1, USB 2.0, USB 3.0, USB On-The-Go, Wireless USB
    • Overview of USB Transfers and Transactions
  • USB Transfer Types
    • Control transfers
    • Bulk transfers
    • Interrupt transfers
    • Isochronous transfers
    • Time-critical transfers
  • Device Enumeration - How the host learns about devices
    • The enumeration process
    • Device insertion and removal
    • Interfaces and descriptors
  • Control Transfers
    • Structure of the control transfer process
    • Standard USB requests
    • Class-Specific requests
    • Vendor-Defined requests
  • Microchip PIC32 Devices and associated firmware and hardware
    • PIC32 USB on chip device peripheral
    • Overview of the MLA USB Protocol Stack
    • Overview of the MLA USB Protocol Stack APIs for application development
  • Understanding Host Communication with a USB Device
    • USB Windows device driver model
    • Linux USB device driver model
    • Kernel mode vs. user mode drivers
    • How a driver is matched to a device
    • How a device is detected
  • Human Interface Devices
    • Overview of HID
    • HID Reports
    • HID case studies
    • HID compliant consumer control devices
    • Implementing a target board HID device
    • Implementing a PC based application for controlling and interacting with a target HID device.
  • Mass Storage Device Implementation
    • Overview of SD Card technology
    • Adding SD card support to Microchip applications
    • Microchip File system and FAT32 filesystem firmware
    • Case study - Implementing an SD Card - PIC32 based mass storage device
  • Implementing Communication Class Devices (CDC) using Microchip Controllers
    • Implementing a PIC32 based CDC device
    • Microsoft Windows CDC device driver aspects and driver signing
    • Controlling and interacting with a CDC target device from a PC
  • USB - Bootloaders
    • Overview of Bootloaders
    • Overview of an Implementation of a USB based bootloader for a PIC32 microcontroller
  • Advanced USB Topics
    • USB OTG (On The Go) Protocol
    • USB OTG compared with Host USB
    • PIC32 Microcontrollers having a USB OTG Modules
    • Overview of DMA - Direct Memory Access
    • DMA support in PIC32 Microcontrollers
    • Using DMA with USB