CPLD board build

The nice guys at DangerousPrototypes sent me a free PCB code with which I picked up a CoolRunner-II breakout board. Yesterday I build the board, so here is a small walk through:

Like I read many times from other free PCB code’s builders, the famous DP free PCB packaging. Simple and effective.

The inspection. I’m no specialist, but it looks good :P

Taking some parts from a previous project, a button from a kind donor PCB and a few more ordered from elpro.

This is a hand soldering job, so many tools around. I’m using a liquid flux from Loctite expired in 07.

Here, the four more legged parts are already in place posing with my trustworthy solder wick.

A detail of the 0603 leds on 0805 pads.

And the power section is complete.

 

After the headers are in place. Got them straight by inserting them in a breadboard.

The finished board.

And the beauty shot.

That’s all for now. Checking all electrical connections and power up test comes next time.

AVR debug on Eclipse

Assuming a previous installation of AVR CrossPack and working Eclipse environment one will need 2 things:

  1. Hardware for in chip debugging or a chip simulator;
  2. The gdb debugger.

In my case, since I don’t have a JTAG interface, the choice goes for the chip simulator. The solution is called simulavr and is already included in the AVR CrossPack. It can be called by issuing:

>simulavr

Now, according to these guys, this should show me a list of supported chips:

>simulavr -L

But my version doesn’t know this command…I think the version included with AVR CrossPack is older. According to their release notes it’s version 0.9. But what version is this that I can’t find it in simulavr releases? Anyway I get the latest (from 2009…apparently the recent development is done on a git repository if anybody wants the latest of the latest) package and that is 0.1.2.6.

Uncompress and apparently 3 steps install so say the instructions:

>./configure

Goes fine.

>make

Gives me: ‘adc.c:270: warning: cast from pointer to integer of different size’. Throwing it at Google I find the solution here. Luckily someone already made a patch to correct this:

— src/simulavr-0.1.2.6/src/intvects.h.old 2011-04-13 02:26:29.000000000 +0000

+++ src/simulavr-0.1.2.6/src/intvects.h 2011-04-13 02:27:37.000000000 +0000

@@ -26,6 +26,8 @@

#ifndef SIM_INTVECTS_H

#define SIM_INTVECTS_H

+#include <stddef.h>

+

enum _sleep_modes

{

SLEEP_MODE_IDLE,

@@ -83,7 +85,7 @@ struct _IntVect

an index enumeration. */

#define irq_vect_table_index(vect) \

- ( ((unsigned int) (&( ((IntVectTable *)(0)) -> vect))) / sizeof(IntVect) )

+ ( offsetof(IntVectTable, vect) / sizeof(IntVect) )

/* No device will have all of these vectors, but must define a structure which

has a slot for each interrupt. If the device doesn’t support the

and it can be applied like this:

>patch -p2 -i offsetof.diff

And then proceed with the installation:

>make install

Now it should work:

>simulavr -L

at90s1200 at90s2313 at90s4414 at90s8515 atmega8 (Yay!) atmega16  atmega32 atmega103 atmega128 at43usb351 at43usb353 at43usb355 at43usb320 at43usb325 at43usb326

Cool, so my chip is in the list.

As for gdb, it is also included in the AVR CrossPack:

>avr-gdb

Now I’m ready to follow this tutorial on debugging an AVR with Eclipse.

First set the chip simulator:

Don’t forget the port set here, we’ll need this to tell avr-gdb where to connect. Next we set the debug tool:

And that’s it! To run, first start the simulator and then the debugger. Don’t forget to set some breakpoints!

Posting from mac osx with Ecto

Testing Ecto!

Stuttgart s-bahn graffiti

More in the flickr set.

AVR programmer: part II

My new AVR programmer was serving good its purpose, so it was about time I gave it a more permanent state :-P

I built it in a black painted perforated board I had left over, from a previous project, and it’s now robust enough for intensive use. The component placing was done, as usual, in the think-as-you-go style trying to minimize size, get a nice final shape and placement of certain components as well as, and this is a major plus I managed to comply with: only fixed/hard wires are used!

As can be seen in the above picture (bottom of the board) all the wiring is done using left over resistor or capacitor legs. This leads to a very durable finishing that isn’t so prone to failure over wire interruptions (as opposed to using wires to make connections). It takes longer to route it all and takes up more space but I think it pays of…let’s see! :-)

Meanwhile, I also did a nice little cable so that I can plug directly on a breadboard:

After trimming the extra board, rounding the edges nicely and fitting the ATmega8:

Just another finishing touch to keep the bottom from shorting – a piece of thin gluing felt fabric.

DONE! Look at how it poses for the picture :-)

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

Careful! cause this sounds good…

A quite recent project that lauched the first album a couple of days ago:

http://orelhanegra.wordpress.com/

http://www.myspace.com/orelhanegra

These guys are good…and funny too! Today I spent my working hours listening to the podcasts on their website :)

Not to miss of course are the videos ahahahah :D

Follow

Get every new post delivered to your Inbox.