I bought an ATMega328P-PU and burned OptiBoot onto it using a second Arduino Uno R3 with great success.

I then put the microcontroller back on the (empty) Uno R3 (DIP) Board for programming, connected USB and uploaded the blink sketch successfully.

Now to the weird stuff:

Blink works on the Arduino Board itself, but if I pull it out and stick it into my breadboard, the program seems to not start. Here are some facts:

  • happens with or without external crystal 16.000 (Pin 9-10)
  • happens with or without the 22pF capacitors from crystal to GND (9-GND, 10-GND)
  • happens with Fuses set to internal OSC or to external clock (Uno default)
  • happens with or without the ADC VCC (Pin 20) and REFERENCE (Pin 21) Pins @ 5V
  • happens on 5V and on 3V3
  • happens with or without external Pullup on RESET Pin (1)
  • Most of the output Pins sit at 0.8 V
  • 1
    Could you post a diagram of your circuit (the one on breadboard). Particularly useful would be power supply and its regulation. Also, do you use a decoupling capacitor, between 5V and GND, near the MCU? – jfpoilpret Oct 13 '14 at 22:07
  • I supplied either 5.1 V from my computer, or 5 V by using an LM7805 (without any capacitors, yet). I also use a 100 nF ceramic capacitor at the nearest point of the MCU between VCC and GND. – SiLeX Oct 13 '14 at 22:26
  • I would expect if you connect a scope to your +5 it is oscillating like crazy. ALWAYS put the recommended capacitors as close as possible to the regulator (check manufacturer's data sheet they are not all the same). It is amazing how many designs I have seen with problems caused for this very reason and the variety of abnormalities displayed. Finding this problem without a scope is extremely hard so simply add them they are not expensive and the regulator will operate cooler. – Gil Sep 26 '20 at 15:48

I found the solution by accident.

While I used my multimeter to measure the voltages between GND and the Pins (for the last fact), I noticed the program running at weird speeds. I. e. the LED started blinking.

What did I measure?

Actually I was just measuring one of the crystal pins (Pin 9 or 10). The sketch went running for a few seconds and very different speeds and then stopped.

This small change in voltage gave the ATMega the clock signal it needs to step through the program.

Maybe I need less capacitance of the two capacitors as mentioned in the comments. I will update the answer with more information later on.

The perfect solution

As pointed out in the comments, I really chose the wrong capacitors. It worked without, but we want the stability so use a bright light and a magnifying glass if you are unsure. Really, do it.

  • 1
    This is not an answer to your question! You should rather edit your question to include the content of your answer, and then delete your answer. – jfpoilpret Oct 13 '14 at 22:05
  • @jfpoilpret - untrue, this is an answer as it solves the problem. It may not satisfy all curiosity though. – Chris Stratton Oct 14 '14 at 3:56
  • 3
    Seems like you might have a resonator not designed for external caps rather than a crystal. Or the substantial parasitic capacitance of your breadboard may add up to too much with the caps (ideal value takes layout into consideration!) Another possibility is misinterpreting capacitor value markings - they could be bigger than believed. – Chris Stratton Oct 14 '14 at 4:00
  • @Chris-Stratton You're right, actually I misread the answer and did not see upfront that it worked without the 22pF caps, I needed to read it a second time to see it as a solution! Maybe editing it would make that appear better? – jfpoilpret Oct 14 '14 at 4:43
  • Dear Sir @ChrisStratton. You were absolutely right. I just checked the printed numbers on the two capacitors under the magnifying glass. They are not 22pF, they are 220nF (Code 224). The 4 was on the side of the capacitor... Pure human failure. Thank you for the tip, I would not have checked it else. – SiLeX Oct 14 '14 at 17:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.