Beginning Embedded Electronics - Lecture 2 problems

I’m a complete noob at embedded electronics, this is my first adventure with micro controllers, and I’m having trouble with the Beginning Embedded Electronics tutorials. I got the power supply from the first lecture to work, but when I ran in to trouble with the second lecture.

As near as I can tell, I have everything wired up exactly like this diagram (http://www.sparkfun.com/commerce/images … ogram4.jpg), but when I try to actually program the ATmega168 I get timeout errors.

I’ve tried both the STK500 Compatible USB Programmer (https://www.sparkfun.com/commerce/produ … ts_id=8702) and the AVR STK Serial Port Dongle Programmer (https://www.sparkfun.com/commerce/produ … ucts_id=14). I’ve used my multimeter to test all of the 5 volt lines and they are getting just about +5.03 volts.

Here are some pictures of my board in case that helps. Once again, I’m a complete noob at this so any assistance is much appreciated.

[<LINK_TEXT text=“http://i669.photobucket.com/albums/vv54 … AG0187.jpg”>http://i669.photobucket.com/albums/vv54/zort15/ATmega168%20programming/th_IMAG0187.jpg</LINK_TEXT>

[<LINK_TEXT text=“http://i669.photobucket.com/albums/vv54 … AG0188.jpg”>http://i669.photobucket.com/albums/vv54/zort15/ATmega168%20programming/th_IMAG0188.jpg</LINK_TEXT>

[<LINK_TEXT text=“http://i669.photobucket.com/albums/vv54 … AG0189.jpg”>http://i669.photobucket.com/albums/vv54/zort15/ATmega168%20programming/th_IMAG0189.jpg</LINK_TEXT>

[<LINK_TEXT text=“http://i669.photobucket.com/albums/vv54 … AG0190.jpg”>http://i669.photobucket.com/albums/vv54/zort15/ATmega168%20programming/th_IMAG0190.jpg</LINK_TEXT>](http://i669.photobucket.com/albums/vv54/zort15/ATmega168%20programming/IMAG0190.jpg)](http://i669.photobucket.com/albums/vv54/zort15/ATmega168%20programming/IMAG0189.jpg)](http://i669.photobucket.com/albums/vv54/zort15/ATmega168%20programming/IMAG0188.jpg)](http://i669.photobucket.com/albums/vv54/zort15/ATmega168%20programming/IMAG0187.jpg)

Wiring something up like that is asking for trouble. You’d be better off using a prototyping board and soldering the thing together properly.

Leon

leon_heller:
Wiring something up like that is asking for trouble. You’d be better off using a prototyping board and soldering the thing together properly.

Eh, not really. Its good to learn a few times the hard way :slight_smile:

Is pin 1 where you think it is? Are you counting pins in the right order? It can differ between headers and DIP parts…

theatrus:

leon_heller:
Wiring something up like that is asking for trouble. You’d be better off using a prototyping board and soldering the thing together properly.

Eh, not really. Its good to learn a few times the hard way :slight_smile:

Is pin 1 where you think it is? Are you counting pins in the right order? It can differ between headers and DIP parts…

I agree - course title suggest prerequisite basic EE courses have been done. Time for harder stuff.

Glad to help, but can’t tell much from photos. What’s your arrangement for crystal or internal oscillator?

I’m using the internal oscillator. I have the 16 MHz crystal for the next tutorial, but it’s not hooked up yet.

Pin 1, as far as I know, is in the upper right of the chip in the pictures. I’m counting from Pin 1 going left, and from Pin 15 on the other side going right, which, as near as I can tell, is correct based on the chip manual.

I looked at a few prototyping boards, but ultimately I decided I just wanted to take the plunge and get my hands dirty. I figured this way I could get a better feel for what is actually going on.

As to which is pin 1, look at the Atmel specification, packaging diagrams. In dual-inline packages for ICs, pin 1 often has, on the surface/top side, a dot, as a depression or as an ink marking, at pin 1. Also in these packages, the pin 1 end usually has a “u” notch in the center of the narrow dimension.

Again, look at the spec sheet.

For the internal oscillator - read the data sheet to see how the chip is configured at the factory. If the chip has been used by another person, the “fuse” (configuration) settings may be different, to include setting it for external crystal, in which case you can’t get by without a crystal or equivalent.

When all is correct, your programming tool should be able to retrieve the part ID code, before you attempt to program the chip (flash it).

There is only one thing I could suggest as to why it is timing out. Are you sure your reset button is oriented correctly? It could be shorted to ground full time, in which case the MC won’t respond. The wiring looks correct otherwise.

Also, just a suggestion in case of further troubles, if you get it programmed but still don’t get a blinking light, move the LED to pin 2. The lecture shows using pin 23 but when I dug into the actual code it oscillated on the PD pins (2-6) instead of the PC pins (23-28).

ok, I’m not sure exactly what is going on, but I got it to work.

It looks like it might be a problem with the programmers and/or avrdude on Vista (both x86 and x64). I gave it to my brother to look at and he hooked it up to his eee PC running Windows XP, and it worked fine.

So, I setup a virtual machine running windows XP on my laptop. It still didn’t work with the serial programmer. It also didn’t work with the USB programmer at first, but I think that might have been the fault of a loose ground wire. After tweaking the wiring it seems to be working with the USB programmer in Windows XP.