Open source USB echo demo ported to the PIC18F2550 Breakout Board

We ported the open source USB echo demo to the PIC18F2550 Breakout Board. It has only the bare essentials you’ll need to get a CDC class USB project going on a PIC18F2550.

The code is setup for a 12 MHz crystal. To change to another just edit the #pragma config PLLDIV = 3 line in the configwords.h file with a value hat divides your clock down to 4MHz. The equation for the PLLDIV parameter is [Frequency of your crystal]/4. Here are a few common examples:

  • 20 MHz, #pragma config PLLDIV = 5
  • 16 MHz, #pragma config PLLDIV = 4
  • 12 MHz, #pragma config PLLDIV = 3
  • 8 MHz, #pragma config PLLDIV = 2
  • 4 MHz, #pragma config PLLDIV = 1

You can download the source code from SVN.

Join the Conversation


  1. I’m embarrassed to ask but how do I download or copy those project files in the “SVN” onto my laptop hard disk driver, please? TIA…

  2. Ok, I got them copied. I open up the project and I “locate missing files” but it won’t compile (I have MCC18 & MPLAB 8.84). Is there a step-by-step procedure somewhere? I’ve never used multiple file projects. TIA…

  3. Here’s the error;

    Clean: Deleted file “C:\Users\Michael\Documents\PIC Projects\18F2550 USB Demo\PIC18F18250BB_USB_BASE.mcs”.
    Clean: Done.
    Executing: “C:\Program Files (x86)\Microchip\mplabc18\v3.42\bin\mcc18.exe” -p=18F2550 “main.c” -fo=”main.o” -Ou- -Ot- -Ob- -Op- -Or- -Od- -Opa-
    C:\Users\Michael\Documents\PIC Projects\18F2550 USB Demo\main.c:9:Error [1027] unable to locate ‘..\dp_usb\usb_stack_globals.h’

    The dp_usb folder is located in the 18F2550 USB Demo folder. Do I need to put all of the file from the dp_usb folder into the 18F2550 USB Demo folder?

  4. Thank you Filip. Someone told me how to add a search path to the dp_usb folder and now it compiles…

    1. Could you plz post the instructions here, It’ll help us a lot, with futture support. I;m not that good at moving projects with multiple files/folders…the connection always gets broken..

  5. Is there a problem with the “PIC18F2550 Breakout Board” page referenced in the article above? The page seems to be missing all of the graphics, like schematic, etc.

  6. After programming the ‘2550, my Windows 7 Device Manager shows a “CDC Test” device under “Other Devices” but the device status is;

    The drivers for this device are not installed. (Code 28)

    To find a driver for this device, click Update Driver.

    Windows cannot find a device driver when I click the button. Am I missing a step, Gentlemen?

    TIA, Michael

    1. I think you may need an inf file. I’ll be sure to put one in the next release package. For now, you can probably use one from our USB IR Toy project (it includes a handful of USB IDs, and you can include your own if you’ve used a different USB ID)..

  7. I have used a 4MHz crystal (so #pragma config PLLDIV = 1) and low speed device (#define USB_LOW_SPEED_DEVICE 1) with system clock @24MHz. As soon as I plug it the installation process starts but then fails with error code 10. I have tried at high speed (system clock @ 48MHz) but then it doesn’t even recognize the device. Any idea?

Leave a comment

Your email address will not be published. Required fields are marked *

Notify me of followup comments via e-mail. You can also subscribe without commenting.