31 December 2008

Fixing device signature = 0x000000


Use AVRDUDE with "-B 8" to write the arduino bootloader of your choice. Then use arduino to do it again.


Last post was about discovering that I couldn't write a bootloader to a bunch of atmega 644's from the arduino ide. Ditto using avrdude. Indeed, trying to do anything using avrdude resulted in the message:

avrdude: Device signature = 0x000000
avrdude: Expected signature for ATMEGA644 is 1E 96 09
Double check chip, or use -F to override this check.

Turns out that AVR ships many chips with a slow clock speed. So avrdude has to be told to chill out a bit ;->Which can be done by using "-B DELAY" to slow avrdude's clock speed. One of my chips respond with DELAY set to 4. Another 6. Others may require even larger settings. We'll see.

Burning a bootloader using avrdude with "-B 6" seems to change the clock speed on the chip, so that "-B DELAY" is no longer needed, so that bootloaders can now be written from the arduino IDE. But the bootloader loaded using avrdude doesn't seem to interact with the arduino IDE correctly. So, go to the arduino IDE, and burn the bootloader again.

Now all should be well, and you should be able to download sketches to the chip over the serial line.

Clearly, what's happened is downloading using avrdude set the chips clock bits, but did not use the right flags to download the bootloader correctly. With the clock running quickly enough, the arduino IDE uses the correct avrdude options to download the bootloader. I could figure out the right flags and do it in one shot. And probably will. But for now, this is good enough to make my chips useful.

Not dead, just mostly dead

So, to work on my breadboard Sanguino, I needed some Atmega644P's. They were on back order everywhere, and the Sanguino zip files seemed to suggest that it also worked with Atmega644's. Something like $7+ quantity 1, $5 quantity 25. So I got 25 from mouser.

After building the breadboard I needed to download the bootloader. Connected my AvrISPmkII. And ... first chip wouldn't take it - got some weird error from avrdude (more later). Second chip worked like a charm. Ditto third. I figured I'd fried the first chip. Later, I tried to burn the bootloader on the remaining chips. All got the same error:

sudo avrdude -p m644 -c avrisp2 -P usb

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.01s

avrdude: Device signature = 0x000000
avrdude: Expected signature for ATMEGA644 is 1E 96 09
Double check chip, or use -F to override this check.

avrdude done. Thank you.

Now, no way did I fry all them chips. Nor could they all be bad, maybe it was a glitch on the bread board? But that didn't make sense, what about them two good 644's that were working just fine ... So I ignored it for the time being.

So, I finished my PCB design, sent it in to golden phoenix PCB - yet another suggestion from Zack (thanks Zack!) - and got it back a week later. Arrived on my doorstep a matter of hours after I left to visit my family for a week. Argh! So I got back late Sunday, and built the first board Monday figuring that no way could the first board I ever designed work, that $120 was surely down the tubes, but that I'd debug it and the second set of PCBS would work fantastic. WRONG. First board worked right first time out.

So I decided to burn the bootloader on the rest of my chips. Again, no go, device signature was 000000. On the 23 remaining chips. Every single one dead.

Hmm, but that doesn't make sense. While a bread board might be electrically wonky, I was now pretty sure my PCB was pretty solid. And I couldn't believe I got 23 dead chips from Mouser. So something weird is afoot.

I poke around on google. Pretty much nothing. Except a hint. Some AT Tinys come from the factory with a slow clock setting, and require some other programmer to set a jumper to slow down the download clock.

Maybe my chips weren't quite dead. Maybe they were just mostly dead.

Now the AvrMkIspII has no such jumper. And avrdude didn't seem to have any such thing. Till I read the help again:

-B bitclock Specify JTAG/STK500v2 bit clock period (us).
-i delay ISP Clock Delay [in microseconds]

Well that looked promising. Didn't know which to try first, so -B it was. BING! It worked. Now on one chip I needed to slow it down to 4us. The next 6us. And once the 644 bootloader is downloaded, it seems to adjust the clock speed, so there's no need for that nonsense any further.

I'm pretty sure the rest of my chips are fine. Just need to play around with the clock speed for each one.

So, while my chips sure seemed dead, as Miracle Max said, mostly dead is not all dead.

12 December 2008

Bread board Sanguino notes


Okay, so you want a Sanguino but you don't want Zach's Sanguino. It's too expensive ;-> Or too red ;-> Or you just have to have it NOW. And you just used up the last of your solder so a strip board is out. What are you to do ... bread board Sanguino.

Of course, nothing in life is free. While the bread board Sanguino is easy and quick, it also is very limited. You'll need a +5V regulated power source. You can either put one together yourself or use something like the Solarbotics bread board power supply. And there's not much space left for other components. And it takes up a bit of space. And ... if all that is okay it's a pretty easy way to quickly get a Sanguino.

Oh, and by the way, I lied. You'll need to do a bit of soldering if you are going to download the Sanguino bootloader or use the USB serial cable ...


Thanks to the Arduino creators. And the entire Arduino community. I knew nothing about micro-controllers before I got my first Arduino. Now I know just enough to be dangerous. Actually, a whole lot more than just enough ... And thanks to Zack. One of my projects was bumping against the 16K limit. Sanguino to the rescue. Plus he's been quite helpful as I've been designing a bit beefier board derived from Sanguino.


16MHz crystal
momentary switch
4 x .1uF capacitor
2 x 22pF capacitor
10K resistor
3 x 6 pin male header
1 3 pin by 2 row male header
6 wire ribbon cable, about 4-6 inches
3/32 heat shrink tubing, about 4-6 inches
22g wire
Wire cutter and stripper

644p pin configuration

I'll list the 644p pins that are important to the bread board sanguino. See the [[http://www.atmel.com/dyn/Products/Product_card.asp?part_id=3896 summary data sheet]] for more info. Pins 1-20 are on the left side of the chip, pin one at top, pin 20 at bottom. Pins 21 to 40 are on the right side of the chip. Pin 21 on the bottom, pin 40 at top.

6 - MOSI. Side A, row
7 - MISO. Side A, row 16.
8 - SCK. Side A, row 17.
9 - Reset. Side A, row 18.
10 - VCC. Side A, row 19
11 - GND. Side A, row 20
12 - XTAL1. Side A, row 21
13 - XTAL2. Side A, row 22
14 - RXD (read from serial port). Side A, row 23
15 - TXD (transmit to serial port). Side A, row 24
30 - AVCC. Side B, row 20
31 - GND. Side B, row 19
32 - AREF. Side B, row 18

Build it

The bread board Sanguino was derived from the Sanguino schematics. I kept all the critical stuff and tossed the rest.

What is critical: The stuff in the parts list above. Need the crystal to give the Sanguino a clock signal. The 22pf caps are required for the crystal. Three of the .1 uF caps are needed to decouple VCC and GND, AVCC and AGND, and AREF and AGND. The fourth .1 uF cap is used for the reset on download feature. 10K resistor is the reset pin pull-up resistor. A pull-up resistor keeps a pin "pulled" high until a switch connects it to ground, which in this case causes the 644 to reset. Two of the 6 pin male headers are used to make a connector for the FTDI USB to serial cable. The third 6 pin header and the 3 pin by 2 row header are used to make a conversion cable from the AVRMK-ISP2 or USBTiny to the bread board. Ribbon cable is used to make the connecting cables. Heat shrink is used for the connecting cables, making sure that the soldered pins don't short. And lastly, the 22g wire is used to make connections.

**Components **

Put the bread board down vertically. Row 1 at top, blue rail left, red rail right.

Place the 644p into the bread board. Pin 1 into bread board hole 10D.

Place the momenteary switch's pins into bread board rows 1 and 3.

Place the crystal into side A, rows 30 and 32, column B.

Place a .1 uF cap into row 9, one pin in side A, the other in side B. This is the reset on RTS cap. We'll be "building" a serial port on side B, pins 4-9.

Place a .1 uF cap into side B, rows 18 and 19, column H. Decouple AREF from AGND.

Place a .1 uF cap into side B, rows 19 and 20, column I Decouple AVCC from AGND. Yep, row 19, pin 2 from right has 2 cap leads in it. It's a tight fit but can be done.

Place a .1 uF cap into side A, rows 19 and 20, column C. Decouple VCC from GND.

Place 10K resistor into side A, VCC rail, to Side A, hole 18A. This is the pull up resistor for RESET. Strictly speaking it isn't necessary. The 644p has an internal pull up resistor. But it's a little tiny one that is easily defeated. Better to put a bigger one off chip.

Place a 22pf capacitor from Side A, GND rail, to Side A, hole 30A.

Place a 22pf capacitor from Side A, GND rail, to Side A, row 32A.

** Wires

Side A, VCC rail to hole 1a. Used as part of circuit bridging VCC from left rail to right.

Side B, hole 1J to side B VCC rail. Also part of bridge from VCC left to right.

Side A, hole 3B to hole 9B. This will carry RESET from the RESET cap to the momentary switch.

Side B, hole 4J to GND. Carry GND to serial port.

Side B, hole 6J to VCC. Carry VCC to serial port.

Side A, 7A to 23A, and 7E to Side B, 7G. Bring Rx to serial port.

Side A. 8A to 24A, and 8E to SideB, 8G. Bring Tx to serial port.

Side A, 9C to 18C. Bring RESET from chip to reset cap.

Side B, 18J to VCC on right. AREF.

Side B, 19J to GND on right. AGND.

Side B, 20J to VCC on right. AVCC.

Side A, 21C to 31C. XTAL from chip to crystal. Note that the picture is deceiving. It looks like the pin goes to 30C. It doesn't. The wire is bent a bit and goes to 31C. Ditto 21C, it really goes there.

Side A, 22C to 32C. XTAL from chip to crystal.

HUZZAH!!!! That's it, you've got a bread board Sanguino. And no way to talk to it ... Next up, yackety yack.

Yikes, back to the blog

Can't believe it. Ya stop blogging for a couple days and pretty soon it's nine months.

Been doing a bunch of stuff with Arduino's and robotics. Just haven't blogged about 'em. Let's see if I carry through.

I really like Arduino and it's clones/variants. Many interesting ideas, with each having a cool idea. But none having all the stuff I want together in one board. And, recently I've become particularly interested in Sanguino, a big brother to Arduino, using the Atmega644p. So, it seemed like the natural thing to do is build my own board.

First thing to do was bread board the guts to make sure I understood things even minimally. Next post will be working notes which I hope to turn into a web page. I've already taken half of them and posted them at http://sanguino.cc/BreadBoardSanguino. I'm going to put the here too, finish them, and then post them back there again.

I'm now wrapping up the board design. I'll post an article about that too, both here and at Sanguino. Gotta say that Zach has been a big help!

Then I'll post my notes from constructing a TCP/IP traffic light and how I connected it to reflect the status of my companies continuous build system.