Atmega328p Circuit Blinking Circuit

atmegaatmelatmel-studiomicrocontrollerprogrammer

So I am trying to build a standalone circuit using the Atmega 328p. After uploading the code using Atmel Studio and AVRDude I get no response from the circuit; however, when I take the Atmega and put it on an Arduino board I can verify that the code uploaded works. Can anyone shed light on what I may be doing wrong?

Here is what I have so far:

  1. I am using a 16Mhz crystal with 2 22pF capacitors
  2. An LED which verifies that Atmega is powered on
  3. I am using a USBAsp clone programmer

I took an image of the circuit I have below.

My ATMEGA 328P

Best Answer

Remove the LED and use either an oscilloscope or a voltmeter to examine D13. Do you see it pulsing up and down? If so, then the LED isn't working. As @Connor Wolf said above, you need a current limiting resistor in series with the LED to protect both the LED and the controller pin from excessive current.

If the pin doesn't pulse, then try pulsing a different pin to see if you've blown the D13 pin.

If you do have a scope, check for oscillation on the two crystal pins (use a high impedance scope probe to do this). If you don't see that, then it's possible the crystal is the wrong kind. You need to match its load capacitance up with the loading caps. See this article.

Lastly, I would not connect AREF to Vcc. If you want a Vcc analog reference, you use analogReference(DEFAULT). AREF should - for production circuits - have a decoupling cap to ground and/or be fed a reference voltage (selected via analogReference(EXTERNAL)). If you're not using it, then you can let it float.

I've done what you're trying to do, and it does work. There's nothing obvious that you've missed.