Mystery Problem with Standalone Arduino

Hello all,

I built a circuit board recently that was designed to have an atmega328 communicate with a SM130 RFID Chip. I’m received my boards and assembled them, but they’re acting very strangely. Whenever I try a program on the commercial UNO board, it works fine. If I remove that microcontroller and plug it into a socket on my board, it doesn’t work at all – even simple sketches like Blink.

I’ve attached an image of my schematic. I checked the following things on my board:

-+5V on VCC, AVCC, AREF, RESET
-GND on pins 8 and 22.

I have an external 16 MHz crystal with 2x 22 pF capacitors.

As far as I can tell, there doesn’t seem to be any shorts, so I’m at a loss as to how to approach this any further. As I said, if I upload the Blink sketch on my UNO Board, I can test Pin 13 (Pin 19 on the microcontroller) to see if I get a square wave – and I do. As soon as I place the Atmega onto the board’s socket, Pin 19 stops outputting a square wave.

Any thoughts on how to move forward? Any general troubleshooting techniques would be greatly appreciated.

side_table.pdf (51.4 KB)

Except for connecting Aref to +5, it should only have 0.1uF to Gnd, and not have 0.1uF caps on VCC and AVCC to Gnd, the design looks okay.

How are you testing the SCK output? 1K resistor to LED anode, cathode to Gnd? Does the chip feel at all warm to the touch?

Oh, I didn't realize that. Will it interfere with my circuit if I'm running from a 5V regulator and I'm not using the analog pins? The standalone page on the arduino:

http://arduino.cc/en/Main/StandaloneAssembly

shows AREF going to +5V (though each of the pins does not have its own 0.1 uF as you noted).

What do you mean by 'SCK'? I'm testing the digital out on Pin 13 (Pin 19 on the chip) with oscilloscope probes and getting nothing; using the same technique on the UNO I'm seeing the square wave output.

I think the problem must be in your assembly.Check the voltage levels at various pins of Atmega328.

SCK is D13/physical pin 19.

Aref is connectable internally to AVCC (normally 5V) or an internal 1.1V reference. If hardwired to 5V externally, it is not changeable.

If the same chip works on one board and not the other, then it's time to check the wiring of the non working board closer.

Especially the xtal caps - if they are larger than 22pF, that will keep the xtal from oscillating.

The xtal caps are 22 pF +- 5%, so they should be fine. I wanted to verify for my sanity, but I think my handheld multimeter has too much capacitance on the leads because it reads closer to 200 pF when I read them (I would be worried if the capacitors weren't clearly labelled 22J, which should be 22 pF).

I'll start with another fresh board and see where this goes. Any suggestions on where/how to hunt down a possible short?

asymptoticdesign: Any suggestions on where/how to hunt down a possible short?

Short? Is something taking down your supply? Don't stuff the board, probe a bare board.

You should be able to scope for clock (16MHz), too.

For cap-meter you should make a short pair (3 inches or less) to test the caps out-of-circuit.

You have R3 on the "PWM" line shown as going to 12V. That is a blunder.

If you really want to test 22pf capacitors, you want one of those testers advertised on eBay where you hold the capacitor against the pads on the tester PCB, or use a one inch piece of wire inserted into the connector on the "live" side, to probe the capacitor.

Seems to have been a board-specific error -- perhaps solder that shorted something, somewhere? I pulled out a new board from my pile and populated it a component at a time and everything works as expected!

Paul__B: Could you elaborate why that is a blunder? I'm not certain what the best practice is, but I tried it with both a pull-up to +12V on a breadboard and it worked just fine. Because the arduino is pulling down, shouldn't it be fine as long as the arduino can sink the current (~1 mA?).

asymptoticdesign:
Could you elaborate why that is a blunder? I’m not certain what the best practice is, but I tried it with both a pull-up to +12V on a breadboard and it worked just fine.

The ATmega ports have protective diodes which clamp the voltage at a diode drop above the supply voltage (or below ground), so in the first instance, your FET gate will never be allowed to rise above 5.6V.

Mostly, if you define it as an output, it will be pulled closely to either ground or Vcc. If you define it as an input, or at reset and before the pin is defined as an output, the 10k resistor will pull it up to that 5.6V. Presumably that is what you intend; that it defaults to “on”. If you thought however that it would turn the FET on “harder” by rising to 12V, you would be wrong. It will be feeding some 700 µA into the pin and protective diode. You will generally “get away with it” but it is certainly contrary to the recommended use of the pin.