Tag Archives: gEDA

First step in kernel development

I wanted to work on linux kernel from some time, but didn’t really know where to start. One day a wise man told me “a good way to learn is to do it! So get an USB device and write the driver for it.” I answered: “Well I didn’t thought of that, usually I’d use libusb for such cases.”

A USB device

Some days later, I didn’t find any nice device, but I thought, why not building it as well?
As I already told you, I’ve already hacked out an USB device: USBtinyISP. So I got back to the original code: usbtiny and I build myself a small device with 4 LED and 2 buttons:

My prototype's picture

I didn’t use and ATtiny, but an ATmega8 to keep more room for future improvements ;-) (The ATtiny2313 is already full with the USBtinyISP code).

And here is the schematic: (as picture, the gschem sources stay in git under the sch folder):

The schematic

Once the wiring done, some few lines of code based on the usbtiny sample, and that’s it: A firmware for the ATmega (in the root of the project).

Then I needed to test it, so back to the first idea, some code lines using libusb, available in the test, helped to improve the firmware ;-)

Everything’s OK, let’s write a driver.

The Linux driver

Well I just followed some tutorials:

Finaly looking at the usbled.c file in Linux sources to get some more updates.

This build a module that adds the files leds and keys in the device folder that Linux creates in /sys/bus/usb/.

That’s it! I don’t know if you learned something, but I did learn a lot! ;-)

All source code are available under GPL2 or GPL2+ on my gitweb: jvdg_usbgadget.git

As for the egocentric name, it’s just to avoid any name conflict. This has no mean to be integrated anywhere anyway. (The device uses an USB ID reserved to prototyping, so unusable for products…)

it’s been a while…

Well, I’m actually more reading than writing since I added Planet Debian to my feed aggregator gregarious.

Also did a few changes to the themes, updated wordpress without issue. Thanks to both wordpress and debian.

Finally this blog has electronics in the headline and I’ve never talked about it yet, but I’m practicing ;)

I’ve been looking for software to draw my schematics and keep track of my work, first for myself and when ready to post my work here.
One project that seamed interesting is Fritzing but it seams too unstable, I don’t mean that the software is unstable but the file formats are. That means that some project done with it today might not be readable by tomorrow’s version.

So I ended up using The gEDA project tools. Starting with gschem to draw the schematics and then adding PCB to prepare my boards.
I’m not actually doing real PCBs, I prefer using prototyping boards and soldering lots of small wires, but using PCB with a 100mil grid really helps for arranging the placement.

I started hacking with Atmel’s AVR microcontrollers using avr-gcc and avr-libc. I first build an USBtinyISP avr programmer. I’ll post the gschem and PCB file some day. (It can come sooner if you ask for it).

Almost forgot, I recovered an old bookmark on Chip Directory. It’s a pinout database of many old chip references including 74xx TTL series and 40xx MOS series.