PIC24 USB

This tutorial will explain how to wire and program a PIC24FJ64GB002 to interface to a PC via USB using no crystal.  This has been discussed several times on the Microchip forums and I have dug through all of them to come up with a working solution.  The trick is getting the configuration bits right.  I’ll show you how.

Go to the Engineer Tutor Library – Getting Started to see how to wire up your board.  Follow it till it adds the LED.  Don’t add the LED but add the USB connection below.

I have added the wiring necessary for the USB connector.  You will also notice that I have added the regulator cap.  Now would be a good time to attach a PicKIT 3 to the microcontroller to see if you can talk to the microcontroller.  You will have to provide power to the microcontroller through the PicKIT 3.  You should see a connection to the microcontroller via the PicKIT 3.  If you don’t see a connection or you get the error Device Not Connected carefully check your wiring and try again.

USB Wiring

USB Wiring

Here is the completed circuit.  You will notice a home made mini B connector break out board.  There is a how to tutorial about building this board in another tutorial.  Now we need to talk about the software that goes into this device.

Completed Circuit

Completed Circuit

The Microchip USB example stacks don’t have an explicit PIC24FJ64GB002 example.  I took the PIC24FJ64GB004 example and adapted it for the PIC24FJ64GB002.  I will give you instructions on how to change the code to get this working.