Archive for the ‘ Linux ’ Category

An AVR Programmer that rocks!

With the latest Sparkfun shipment arrival, a very much waited little helper was able to be put together – finally! 🙂

Since I started using AVR microcontrollers I’ve been using the AVR-PG1B serial programmer from Olimex built according to this datasheet. 

It was built in such way that I can plug it in a breadboard directly, and I used it with the great avrdude with the following sequence (example for an ATmega8515, 10MHz crystal and serial port /dev/ttyUSB0):

>avr-gcc -mmcu=atmega8515 -DF_CPU=1000000UL -g -O1 -o file.elf file.c
>avr-objcopy -j .text -j .data -O binary file.elf file.bin
>avrdude -c ponyser -p m8515 -P /dev/ttyUSB0 -U flash:w:file.bin:r -U hfuse:w:0xc9:m -U lfuse:w:0xef:m

Or just the last line, if using Eclipse with the AVR plugin.

The bad side about this programmer is the speed. It just takes toooooo long to program – I was taking something like 3min to program and verify…:-/

Now the fast USBasp is in town! 🙂 I couldn’t find an ATmega(4)8 in the shops near me so I ordered a couple from Sparkfun. This is a super simple to put up programmer that worked at the first try 🙂

Shown here as I have it working in a breadboard right now before it migrates to perforated board and then PCB. After the components were correctly put in a breadboard and the firmware was programmed (using the serial programmer mentioned before ihih) I just connect the USB cable to the computer and the red led went on! After testing that it could program (green led lights up when working), time for a little tweak for using it without being root – found here. Niiiiiice 🙂

In the end, I’m using it in Eclipse with:

>avrdude -p m8515 -c usbasp -P -e -u -U flash:w:file.hex:a -U lfuse:w:0xee:m -U hfuse:w:0xd9:m

and it programs in about 2 seconds…supa cool!

NOTE: Which wires are needed as a minimum to program an AVR with USBasp? MOSI, RESET, SCK, MISO and GND!!! (all the smart people out there ignore this obvious fact…it’s just a self reminder!)


Linux lessons 1

Linux lessons of the day:

  • How to search for a string inside files:

  • One of the linux kernel numbering rules:

Odd numbers are unstable, Even numbers are stable. Ahhhh…so that’s why it jumped from 2.4 to 2.6! 🙂

  • When trying to satisfy compilation dependencies:

Try to find the root of the problem and not manually include every dependency!

I feel like I learned some stuff today.