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
-
\$\begingroup\$ The reset pin needs a diode to VCC (see AVR042) \$\endgroup\$uhours– uhours2017年08月29日 07:15:15 +00:00Commented Aug 29, 2017 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– hacker8042017年08月29日 07:17:36 +00:00Commented Aug 29, 2017 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– uhours2017年08月29日 07:23:58 +00:00Commented Aug 29, 2017 at 7:23
2 Answers 2
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 :)
-
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– Daniel2017年08月29日 17:47:41 +00:00Commented Aug 29, 2017 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.
-
\$\begingroup\$ Any idea how I can do that? \$\endgroup\$hacker804– hacker8042017年08月29日 07:15:46 +00:00Commented Aug 29, 2017 at 7:15
-
\$\begingroup\$ Google "usbasp low speed" electronics.stackexchange.com/questions/49606/… or avrfreaks.net/forum/usbasp-1 \$\endgroup\$filo– filo2017年08月29日 07:17:44 +00:00Commented Aug 29, 2017 at 7:17
-
\$\begingroup\$ Most people said that the Chinese USBasp, which I have, will set the SCK period automatically so there is no need to manually specify it. \$\endgroup\$hacker804– hacker8042017年08月29日 07:20:58 +00:00Commented Aug 29, 2017 at 7:20