I am playing with an atmega328p microcontroller to try and build a simple circuit which open/close a relay to control a garden light, my problem is that while the circuit works fine on my breadboard for some reasons the mcu does not seems to boot when in the prototype board.

the circuit is fairly basic, I can post the full diagram but the relevant part is a standard application circuit with a 16MHz crystal and two 22pf capacitors:

Basic circuit

And here is the beautiful result on the prototype board:

enter image description here

(you can see the two capacitors at the bottom, the crystal is on the other side, sorry for the crappy quality I have nothing better currently than my iPhone 3GS :/)

And another version with an ugly overlay to show better what is connected where:

enter image description here

the blue line at the bottom is the ground "rail", the big rectangle is the atmega socket on the other side of the board (the top of the chip is on the right) and the other green thing is the crystal on the other side too

That's my second attempt at building a prototype board circuit with an atmega328P, the first one went flawlessly and is powered and has been working fine for months now but with this one the chip won't boot.

I have the working prototype on my breadboard so what I did to try isolate the problem:

  • upload a blink program turning the realy on and off with the 1s delay to the chip, checked that it worked on the breadboard and then put this atmega on the prototype board: the relay stays off.
  • I checked the power rail of the prototype board and that the atmega chip was receiving proper volatage (5V), everything was fine (I power the circuit from an arduino like the breadboard).
  • If I try to upload a sketch via the arduino IDE to the prototype board it fails because the programmer is not responding.
  • I tested each connection with a multimeter and there is no bridge or faultly connection, I am fairly confident that everything is connected where it should be (first thing I checked).

I have really run out of ideas, my guess is the clock does not "start" but I am not familiar with clock circuit and I admit I am not clear how a crystal works, is it possible that the way I soldered the capacitors and the crystal on the board prevent the normal behavior of the clock circuit ?

Can I test that the crystal is working fine with basic tools (I only have a multimeter) ?

Thanks for any help, failing is not a problem as long as you manage to learn something from it when you have no idea what has gone wrong this is really frustrating :(

  • 1
    \$\begingroup\$ How about enabling the internal RC oscillator for test purposes? That way you are sure it is not the crystal clock circuit. If you have a scope, you may be able to pick up the 16MHz signal wit an inductor connected to your scope. Also there is a fuse that will output the system clock on an ouput pin, that would help in debugging the clock circuit too. \$\endgroup\$
    – jippie
    Commented Apr 21, 2014 at 9:31
  • \$\begingroup\$ Double check fuses via ISP. You can setup by fuse to provide clock (i.e. crystal) on a port pin. And ideally probe with logic analyzer. With multimeter I suppose you should detect value around Vcc/2 when clock is working. \$\endgroup\$
    – TMa
    Commented Apr 21, 2014 at 10:05
  • \$\begingroup\$ BTW is GND pin connected? There is no wire at schema. \$\endgroup\$
    – TMa
    Commented Apr 21, 2014 at 10:06
  • \$\begingroup\$ Until now my attempts to make an atmega328 use its internal oscillators all failed, I will try to change the fuses to output the clock see if I can get something out. The power is connected via a connector on the other side of the board, you can see the pins on the top left of the board. \$\endgroup\$
    – Schmurfy
    Commented Apr 21, 2014 at 11:00
  • \$\begingroup\$ I managed to make it work on the internal oscillator so there is definetely something wrong with it, for this circuit the precision of it should be enough so I think I will stick with it. I cannot easily test the output of the clock since I already use this pin but I suspect there wouldn't be much to look at there since I don't have a scope. \$\endgroup\$
    – Schmurfy
    Commented Apr 21, 2014 at 12:05

1 Answer 1

  1. check if your wire is corect, with no short-circuit. If it is ok, moving on
  2. I assume you solder socket for chip. so disconect chip, put it in protobort in check if works like it should. If it is ok, moving on.
  3. Enable internal clock 8Mhz inside in chip in divider by 8...with fuses and put your chip back to socket. If now works, you have a problem with external cryistal and capacitors. That means crystal dos not start..mybe circut capatance is grather (bad soldering) and ... check it. If do not work, somethink is wrong with your power or wrong wire.
  • \$\begingroup\$ As I mentioned in my question the same chip works on the breadboard with the same circuit, same alimentation (and even the same relay board), I will make another attempt at using the internal oscillator since that's still the best guess for now. \$\endgroup\$
    – Schmurfy
    Commented Apr 21, 2014 at 11:04
  • \$\begingroup\$ I managed to make the atmega run on its internal oscillator and it works so it looks the issue is really with the clock circuit as I feared :( \$\endgroup\$
    – Schmurfy
    Commented Apr 21, 2014 at 12:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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