0

I want to program an atmega328p-pu via my arduino uno as ISP in a circuit.

I omitted my connected sensors, LCD, etc in the schematic to keep it simple.

enter image description here

When I power the circuit via a 5V power supply (left) I get

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.02s

avrdude: Device signature = 0x000000 (retrying)

Reading | ################################################## | 100% 0.02s

avrdude: Device signature = 0x000000 (retrying)

An error occurred while uploading the sketch
Reading | ################################################## | 100% 0.02s

avrdude: Device signature = 0x000000
avrdude: Yikes!  Invalid device signature.
         Double check connections and try again, or use -F to override
         this check.


avrdude done.  Thank you.

When powering off the circuit and connecting 5V and GND from the arduino to the power and gnd lines in my circuit everything works fine.

I connect 5V and GND from the arduino via pin headers I added to the 5V and GND rails in my circuit to power external sensors etc.

Is there a reason I apparently have to use power from the arduino?

3
  • 1
    Even with an external supply, you must connect the ground. If it still doesn't work, perhaps your external supply is not 5 volts DC, or is noisy. Also keep in mind that the specifications prohibit applying signal voltages to unpowered ICs - so it's going to be a little tricky to startup an external supply at the same time as the internal one without violating that. If you have to start the external supply first since most signals are outputs from the programmer, and the 10K reset resistor is large enough not to challenge the programmer ATmega's protection diodes. Commented Mar 25, 2018 at 16:40
  • hackingmajenkoblog.wordpress.com/2016/12/06/…
    – Majenko
    Commented Mar 25, 2018 at 20:15
  • @ChrisStratton The external supply was powered first. But both you and majenko correctly pointed out, that my mistake was not sharing grounds. Does anyone want to make an answer out of that? Otherwise I'll answer myself to not leave the question open although the issue is solved.
    – idkfa
    Commented Mar 25, 2018 at 21:23

1 Answer 1

2

Even with an external supply, you must still have a common ground reference between the ATmega being programmed, and the Arduino/ATmega doing the programming. According to your comment this was the critical issue.

Also keep in mind that the specifications of most ICs including the ATmega prohibit applying signal voltages when the chip itself is unpowered. To stay within that specification, you would need to turn on the external supply first, and insure that all of the pins were in their high impedance state and not driving the programmer's ATmega when it is unpowered.

Your pullup resistor on the target's reset would weakly drive pin 10 on the programmer, but a 10K resistor should limit the current to within what the protection diode on the corresponding ATmega pin can tolerate (even such a weak current can however cause problems with clean startup, though the ATmega is less sensitive than some other devices).

If you can't be sure power is going to be applied correctly, putting 1K (maybe even 2.2K) series resistors between the two chips can help a little, but there's a balance between keeping the signals strong enough to work well, and keeping illicit currents weak enough to avoid stress.

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.