I recently soldered a ATMega328P in a TQFP package onto a PCB I designed. The conncetions seem to be fine and there are no bridges. I have used 100nF decoupling caps on the power pins. The RESET pin is connected to +5V through a 10k resistor. I use the USBasp for programming. However, the AVR does not respond to the programmer and avrdude issues the following error:

avrdude.exe -c usbasp -p m328p

avrdude.exe: warning: cannot set sck period. please check for usbasp firmware update.
avrdude.exe: error: programm enable: target doesn't answer. 1
avrdude.exe: initialization failed, rc=-1
             Double check connections and try again, or use -F to override
             this check.

avrdude.exe done.  Thank you.

What could be the problem here?. The picture of the connection as well as the board layout is attached.

Also, I have the same IC in a DIP28 package, and that one seems to work fine.

EDIT: After some tinkering around, I found that the MISO pin was connected to GND. The DMM showed a resistance of 1.1Ohms. But I see no possible way in which they can be shorted. Can you suggest some possible reasons and solutions.? Board

enter image description here

  • \$\begingroup\$ The reset pin needs a diode to VCC (see AVR042) \$\endgroup\$ – uhours Aug 29 '17 at 7:15
  • \$\begingroup\$ @uhours That is recommmended for ESD protection but is not absolutely required. It should work fine without it too. \$\endgroup\$ – hacker804 Aug 29 '17 at 7:17
  • \$\begingroup\$ I'm not saying it won't work, but I've fried chips by not having having it. It's definitely something to have in future designs. \$\endgroup\$ – uhours Aug 29 '17 at 7:23

Figured it out. The MISO Pin was shorted to ground. I heated the MISO pin on the 5x2 header with a soldering iron and maybe it loosened some solder and the connection broke from GND. It works fine now. I can write code to blink the LED and its working fine.

Thank you all for your help :)

|improve this answer|||||
  • 2
    \$\begingroup\$ Someone else can correct me if I'm wrong, but I think that the convention here is to accept your own answer. This way, the question is resolved and won't get bumped to the homepage in the future. \$\endgroup\$ – Daniel Aug 29 '17 at 17:47

If the chip is blank from the factory it will run off its internal slow oscillator. You have to reduce clock speed in avrdude (or with a jumper on the USBasp - depending on version) during initial programming until you change the fuses to make the MCU run faster.

|improve this answer|||||

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.