Many people interesting how to create USB device using the microcontroller. Microchip Technology produces many microcontrollers with USB port. For the demo purpose I use new microcontroler PIC32MX220F032B. Circuit diagram of my demo board you can find here.
In order to connect USB device to the computer you will first need to write and compile firmware. For this reason I took project “Device – HID – Custom Demos” from Microchip’s Application Library and adapted it to the PIC32MX220 microcontroller.
- Firmware is targeted for the Microchip C32 compiler
- Microchip’s Application Library must be installed before (for the USB stack)
- At this moment polling method only is supported
How to run project?
1. Install Microchip’s Application Library (tested version 2012-02-15).
2. Copy project folder to USB folder of the MAL, for e.g:
C:\Microchip Solutions v2012-02-15\USB\USBDevice – HID – Custom Demos PIC32MX2\Firmware…..
3. Build project and program your MCU.
4. Attach MCU to the USB Host.
The reference hardware provides 2 LEDs – one indicate power, second (RB15 pin) flashes after USB is attached. For the demo purposes I left 2 files of the host (Windows) software – GenericHIDSimpleDemo.exe and HID PnP Demo.exe
Projects and source code of these files you can find in Microchip Application Library, “USBDevice – HID – Custom Demos” folder.
Project and firmware for the microcontroller you can download here: