One of very nice USB capable microcontrollers is the C8051F320 produced by Silabs (formerly Cygnal). Unfortunately to start playing with this chip you need to buy a rather expensive development kit. On this page I present some alternatives for building a cheaper toolset.
The first component is a simple and cheap development board with C8051F320. The schematic is based on the original development board from Silabs. It has been designed as single layer PCB, and therefore it is really easy to be produced at home.
The PCB design has been prepared with the free PCB program. For those of you, who are not able to run PCB (eg. because yur PC runs only under the broken operating system® ) I've provided the PDF file.
The schematic diagram has been prepared with the free gschem program, but again the PDF version is also available.
The board itself however is useless without the programmer. To keep the costs as low as possible, I've prepared a simple programmer (here are the schematics sources in a XFig format) connected directly to the PC's LPT port.
The programmer is controlled with a dedicated software, written in C language. The software (source available under GPL) consists of two parts. The first one is a dedicated Linux driver, and the next one is a program "cygprog". To use the programmer you need first to load the driver (as root):
# insmod cygnal_c2 io_base=0x378 major=233
(certainly you should adjust the io_base to the LPT port address in your PC, and the "major" number to a free value; you can also don't set the major - it will be allocated dynamically and then you'll need to find the allocated number in the /proc/devices).
Then you should create the appropriate device node. Now the programmer expects to find it in its working directory, under the "cygnal" name (you can modify sources if you want to).
# mknod cygnal c 233 0
Then you can use the program. It is wise to give the normal user access to the cygnal device and use the program as a normal user:
# chown user.user cygnal
One important remark - my driver is not "parport" compatible. It is necessary to remove "parport" driver and/or "lp" driver, before using the cygnal device.
My programmer software now understands only the raw binary files starting from address 0. You can convert standard "ihx" files (as produced by the SDCC compiler) into the binary files, using the "srec_cat" tool (available eg. in the Debian "srecord" package). You should use a command line like this:
$srec_cat -Output test.bin -Binary wzab.ihx -Intel
to convert the "ihx" file into the binary one.
Then you can use the cygprog to write your program into the device's memory:
$./cygprog p test.bin
The software can also verify the program (./cygprog v test.bin) and dump the device's memory into the file (./cygprog r output.bin).
Certainly this only the first draft version (however it is usable for me), so any corrections and suggestions are appreciated.
I've received some messages, that it is not possible to compile the driver for kernel 2.6. I've checked it, and cleaned up the source a little. Here you can find the source modified for kernel 2.6. The archive contains two subdirectories: "driver" and "program". Make command in the "driver" subdirectory should build a driver module (however some warnings may be issued during the compilation), while make in the "program" directory should build the user mode part of the programmer software.