Tag Archives: avr

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…)

CPU review: PicoBlaze, LatticeMico32 and ARV clones

The study items are listed on the Open Source CPUs post, especially the category description.

PicoBlase

However wikipedia marked it as open source, it’s not what I call open source hardware! Ok you will have the source code, but you have to register and accept a licence explicitly restrict you to use it only on Xilinx chips to access the download page. Not to count the warning against some possible patented content in each file…
Definitely non-free !

LatticeMico32

I could not find the licence text from the lattice web site. It’s possible to download some LatticeMico32 demo code, but it does not include the license text.

First time I’ve read about LatticeMico32 was in a French GNU/Linux magazine, an article presenting the Milkymist project. So I headed here and there archive contain the licence text from Lattice.
The most important part from our point of view the Appendix C: “Lattice Semiconductor Corporation Open Source License Agreement”.

Note sure about the section 6 ‘export control’, but I guess it’s just repeating something from the US laws (any legal experts reading me?). To me, it looks like a particular case of GPL2 point 7 or 8: the intent is to protect the license not to prevent the use. I mean if it’s illegal, then there is no way a license text will make it become legal !

But overall it looks fairly open to me.

So let’s look at this CPU !

It’s a 32Bits RISC (instruction and data) with no MMU and optional caches. That makes it fit the embedded CPU category.

The lm32 architecture seams to be integrated in binutils and gcc, so no need for extra patch, just build it.

Navré

To stay on the Milkymist project, lets consider Navré. This one was created for Building a free OHCI host controller for USB.

So It’s GPL, it’s very new, it’s very small, it perfectly fits the tiny micro-controller category. Let’s wish it good luck.

On the AVR cloning idea, I don’t know Atmel’s opinion on this… If we end up building Arduino clones using open source AVR clones they might argue, but I think for now at least in term of cost and process, we are far from it. (Is there any opens source flash process to build our chips ?)

While we are at it, let’s look a few other AVR clones.

pAVR

Targeted to be a superset of all AVR at its origin, the project has stopped. It has some bugs open and this has not evolved since 2005.

AVR core

This is a clone of AT mega 103. Unfortunately I could not find any licence in the archive… So it can not be considered open source hardware 🙁

AVRtinyX61core

This is a Atmel AVR ATtiny261/461/861 compatible core. LGPL and not updated since Nov 10th, 2008.

Reduced AVR Core for CPLD

AVR core in single verilog file… There is not much info, the project was recently created on opencores and the homepage (from the source header) is in Russian…

Ok that’s all for today 😉

As usual the summary table is there: Open Cpu Study Summary.

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.