Saturday, July 24, 2010


I will update this post with more useful tidbits.

I'm dealing with PIC chips here. So far PIC18f*** but I also have a 16f which I might go back to later.

SDCC- Small Device C compiler
You can look up information about SDCC, but the one part that wasn't obvious is the meaning of all the registers included in the header files. They aren't just made up by SDCC. They correspond directly to the names given by the chip manufacturers. So basically if you want to do some SDCC programming, pop open the datasheet of the chip you are looking at, and that will give you an "API" of sorts to use from SDCC.

USB Stack
It seems there are quite a few USB stacks for PICs, but none are *definitive*. Microchip (the company who makes the chips) has their own for their own compiler, but the source is only somewhat open; you can only use it with Microchip devices, so not GPL compatible. A lot of them also seem to be derived from a Nuts and Volts article, which has a GPL source. Right now I'm looking at which seems promising.

update: with minimal changes I got it to work with SDCC in /usr/ (instead of /usr/local/) and changed it to compile for pic18f4550 instead of 2550.  At least with the minimal changes I made to the makefile, linux recognizes the chip as a USB device when I plug it in.  Here is the source.  It is derived from the above forum post which is derived from the GPL code in the magazine, so it is also GPL.

update: I have found another implementation which seems even better.  It worked with even less modification, and most significantly, it implements USB CDC as well as HID.  This basically means you can do serial port (rs232) emulation with it straight out of the box.  I'm going to need to do some configuration with baud rates for the debug from the actual rs232 port, because right now it's printing garbage.  Here is the source:  Look to the bottom.  This one is also derived from the Nuts and Volts source.

No comments:

Post a Comment