We want to implement USB on our PIC24 based embedded system.

Hardware: All done
Firmware: USB part is currently Non-existent
My role: Make it all work
Questions: The protocols are very complex

Please point me to relevant sources of info.

The specific chip is: PIC24FJ256GB210.
It will be a "device", and I don't think it will ever be a host, even a host-to-go I have previously spent time at these places...

A tutorial, here: http://www.usbmadesimple.co.uk/ums_5.htm

Microchip's forums, here: http://www.microchip.com/forums/

The USB Implementers Forum, here: http://www.usb.org/developers/docs/

Jan Axelson's site, here: http://www.lvr.com/usbc.htm and purchased her book "USB Coomplete"

The firmwware in the embedded device is what I need to write. The protocol is what I need to research the most. Pointers invited and welcome.

Protocol, Protocol, Protocol; that is what nobody can explain.

  • \$\begingroup\$ What do you need it to do? If a serial channel would be workable, USB-serial is generally fairly simple, probably has drivers, and lots of examples. Also many other common USB peripheral types - keyboards & mice, mass storage, etc. You'll need to decide what existing or custom protocol you need before you can implement anything. \$\endgroup\$ Apr 29, 2013 at 19:26
  • \$\begingroup\$ The box uses BlueTooth, but as you are probably aware, that can go to pot very quickly on a PC. For that reason, the boss wants me to utilize the USB port as a backup. \$\endgroup\$
    – User.1
    Apr 29, 2013 at 20:18
  • \$\begingroup\$ Reason #2: we want to use the USB port to charge the battery on the device \$\endgroup\$
    – User.1
    Apr 29, 2013 at 20:19
  • \$\begingroup\$ You've still failed to specify what sort of communication you want to achieve on the USB port. You will get absolutely nowhere until you determine your precise requirement. \$\endgroup\$ Apr 29, 2013 at 20:21
  • 2
    \$\begingroup\$ Finished 2 chapters in Jan Axelson's book. Is this going to be a new career ? I swear a person could do nothing but learn new USB rules and regulations for the rest of his life \$\endgroup\$
    – User.1
    May 13, 2013 at 14:50

1 Answer 1


The PIC24 has a decent couple of demos in the Microchip Libraries for Applications (MLA). For help on the circuitry necessary, check out the microchip pictail board and the explorer 16 board. All microchip demo boards include a full set of schematics to help you get off the ground running. The usb protocol is generally taken care of for you in the USB stack that's included in the MLA. The configuration is mostly accomplished by setting up your USBDescriptor.c file (see the included demos in MLA and the Microchip USB Device Firmware Framework User's Guide).

All that's usually required code wise after that's done that is to call USBTasks() in a main loop after calling USBInitialize once before your main loop. Then it's a matter of sending and receiving USB data which will depend on how you've configured the stack.

The code for microchip's demo applications included in the MLA is a great starting point. Their licensing terms allow you to using it in commercial products royalty free (as long as you're using a microchip uC of course).




Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.