Nov 092014

I am working on a project that needs high speed real time data acquisition, large data storage, and a rich interface to the web. Put these requirements together and one solution is to use an embedded real time system for the data acquisition and a general purpose computer for the data storage and web interface.

Of the many ways to implement a solution like this the solution I chose utilizes a Microchip PIC microcontroller for the high speed data acquisition and and embedded PC style platform running Linux for the data store and web interface. The connection between the PIC microcontroller and the embedded PC is USB.

Over the course of the next few posts I will be showing a how to bring up USB on a PIC microcontroller, both as a bootloader and as an embedded application. I will be relying on Microchip’s Libraries for Applications or MLA to provide the USB and bootloader frameworks. Part of the MLA is a USB framework targeting Microchips 8, 16, and 32 bit processors. The MLS also provides a wealth of example code including a USB bootloader. I will be showing how to target the USB framework for a couple different PIC processors and how to go end to end from a naked chip to a USB application exchanging data with a PC.

I plan to post on the following topics:

  • USB on the PIC – Introduction
  • Installing the MPLAB-X PIC development environment
  • Microchips Libraries for Applications
  • PIC development tools
  • Bootloaders
  • Building the MCHPUSB bootloader for the PIC18
  • Building the HID bootloader for the PIC18
  • Building the HID bootloader for the PIC24
  • Building the HID bootloader for the dsPIC33
  • Writing a USB application
  • USB slave application on the PIC
  • USB host driver and application on the PC

  • You can acquire some of the following tools if you want to follow along:

    A USB Bit Whacker. The UBW is a simple, relatively inexpensive development board sporting the PIC18F2553. The UBW is well supported and ships with a an open source USB bootloader and application. This makes it an excellent starting point for USB development. You can get a SMD UBW or through hole UBW from Sparkfun Electronics.

    [Update] Since I snagged some PIC18F25K50 P-Star development boards on Pololu’s 2014 Black Friday Sale I’ll be updating this series to also work with these micros.

    A Bus Pirate. The Bus Pirate is base on a PIC24 and is an excellent tool to have in your embedded development toolbox. That we can also use it for a development platforms is gravy. You can get a Bus Pirate from Sparkfun, Adafruit, or Seeedstudios.

    You will also want to download the Microchip Libraries for Applications v2014-07-22 and the v2010-08-04 version from the Archives tab.

    I will be building the demo applications in MPLAB-X which you will want to download and install for you flavor of operating system.

    You will need the Microchip XC compiler for the architecture of the chip you will be using, XC8 for the PIC18 chip and XC16 for the PIC24 and dsPIC33.

    If you are serious about Microchip PIC development you will need an ICSP. I use the PICkit2 but the ICD2, PICkit3, ICD3 all should work equally as well.