0

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

  • 2
    *Sigh*. [Bypass](http://electronics.stackexchange.com/questions/12286/bypass-capacitors-needed-in-low-frequency-digital-logic-systems) [Capacitors](http://electronics.stackexchange.com/questions/30279/what-is-the-function-of-this-circuit/30281#30281). (Note: I'm principally exasperated at any tutorial you're following that doesn't mention the requirement for bypass caps, not you.) – Connor Wolf Nov 25 '14 at 09:40
  • 1
    Also, I do not see any resistor inline with the green LED, so you may have blown the LED. You need a current limiting resistor for every LED! The ATmega can generally drive 40 mA, and most T 1 3/4 LEDs are rated to 20 mA max. – Connor Wolf Nov 25 '14 at 09:43
  • Are you sure you've got the reset tact-switch right? Remember that the four pins are permanently linked in two pairs. The two pairs are shorted together when you press the switch. – John Honniball Nov 25 '14 at 13:49
  • Well I know that the LED is working since I have tested it directly with the with the power pins. I followed a tutorial when wiring the pins for the reset switch and as of now I am using the programmer to power the atmega. Anyways, if the tutorial was wrong can anyone point me to a tutorial that would show me how to correctly wire this circuit? –  Nov 25 '14 at 15:45
  • I recently was doing something similar. I checked and re-checked everything until I found out I had the brown out fuse set too low. Make sure you are using 5v or have the appropriate brown out settings. – tehwalris Dec 15 '14 at 01:00

1 Answers1

2

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.

nsayer
  • 1,543
  • 1
  • 18
  • 35