Microchip have a free but non-distributable USB stack source code available.

However, what open source virtual serial port code exist? And which one should I invest my time in using?

  • \$\begingroup\$ Why can't you use the Microchip code? \$\endgroup\$ May 1, 2011 at 12:46
  • 2
    \$\begingroup\$ I can use it. But it's inevitable that a free and easily distributable source code will exist, if not already. \$\endgroup\$ May 1, 2011 at 12:53
  • \$\begingroup\$ Why do you need open-source code? You can distribute and sell software built with the Microchip code. \$\endgroup\$ May 1, 2011 at 13:05
  • 2
    \$\begingroup\$ @Leon - There are a large number of reasons why open-source code would be desired, including (but not limited to) ability to integrate into an open-source product, cost, community support, not being tied to any one manufacturer, ease of debugging, ability to port to other architectures, other customization possibilities...the list goes on. \$\endgroup\$ May 9, 2011 at 20:39
  • 1
    \$\begingroup\$ There are open source USB stacks for many micros, assuming they make the necessary hardware documentation available there is no reason there cannot be one for the PIC. But that's not the same as saying there is one. \$\endgroup\$ May 23, 2011 at 1:48

2 Answers 2


I don't have a answer to your whole question, but I do have a open source USB stack for the Microchip 18F USB hardware. I have not implemented a serial port class, although that shouldn't be too hard of a layer on top of the code that is already there.

My USB code uses the hardware ping-pong buffering mode with triple software buffers per endpoint. You define which endpoints you use, their transport mode (bulk, interrupt, etc), how big each buffer should be, and the software configures itself to this at build time.

The USB firmware is in a incremental release you should install after installing the main PIC Development Environment release. Both are available at http://www.embedinc.com/pic/dload.htm.


I use bit-bang serial on most of my projects for debugging purposes. A good implementation you can find here: http://www.romanblack.com/bitbangserial.htm
For reading (and sometimes writing) I'm using RealTerm with a Serial-USB converter and thus think I'm protected against most mishaps.
I'm using 19k baud for almost everything since I haven't seen an error until now, but in some tests 56kBaud was also working ok (8MHz internal oscillator).
Might not be what you're looking for but others seeking for advice might find this useful.

  • 3
    \$\begingroup\$ This doesn't address the question at all. He was asking about firmware to use the USB hardware, specifically a firmware USB implementation that enumerates such that the operating system installs it as a standard serial port. What you are talking about is completely orthagonal to that. \$\endgroup\$ Jun 25, 2011 at 20:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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