Can't connect to target atmega328p-pu
Moderators: adafruit_support_bill, adafruit

Can't connect to target atmega328p-pu

by dmogle on Mon Jun 18, 2012 2:16 am

Greetings! I am trying to connect to an atmega328p-pu using a usbtiny built from the adafruit kit. I'm using avrdude 5.11.1 on Ubuntu 12.04 on a Lenovo Essential B570. I'm using a diy unpowered 6-pin target board a la Evil Mad Scientist here: ... et-boards/.

The green LED lights when I connect the programmer and I get the "initialization failed, rc=-1" message and a brief flash from the red LED on the programmer. However, I get that whether the programmer is attached to the target board or not. I've checked the connections on the target board for shorts, haven't found any (a miracle considering my poor soldering skills!); I've checked that the pins are connected to the ZIF socket with success; and I've double checked the pinout of the 328p and I don't see anything wrong. I don't have an oscilloscope to watch what's going on on the pins.

I've attached a screenshot of my avrdude command and the error message, along with top and bottom shots of the usbtiny board. I can also attach shots of the target board if that will be helpful.

Thanks for any help!
usbtiny board bottom
dmogle_usbtiny_bottom.jpg (104.42 KiB) Viewed 2226 times
usbtiny board top
dmogle_usbtiny_top.jpg (61.03 KiB) Viewed 2226 times
avrdude command and error
dmogle_avrdude.png (33.04 KiB) Viewed 2226 times
Posts: 1
Joined: Wed May 16, 2012 9:59 pm

Re: Can't connect to target atmega328p-pu

by adafruit on Tue Jun 19, 2012 10:29 am

it sounds like you have a wiring problem to the chip - the usbtiny is working fine and talking to the computer, it cant find the target chip
User avatar
Posts: 11712
Joined: Thu Apr 06, 2006 4:21 pm
Location: nyc

Re: Can't connect to target atmega328p-pu

by abqlewis on Tue Jun 19, 2012 4:43 pm

A few ideas:
1) show us your target board - even if you don't have a short on it, there might be something visible.
2) The ISP connector confuses a lot of people - If you have a meter - remove the 328 from the target board and plug it into the usbtiny and plug the usbtiny into the computer (you say you've already checked for shorts!). You should be able to measure +5v from pin 8 to 7 (and maybe 20 and 21). If you don't read 5v, the isp connector could be mis-wired or backwards (mine was backwards the first time I used my usbtiny).
3) Depending on where you got the 328, it may be setup (fuses) to require an external clock. You can try a different 328, or (what I did) get a resonator (or crystal) and hook it to the xtal inputs (9&10 I think).
4) I don't see a lot of these target (or minimalistic programming) boards with bypass caps on them, yet most would agree that a cap is extremely important, if not required, when running the micro-controller. I bricked the 2nd (or maybe 3rd) AVR I tried to program. Now my little programming board has a cap from Vcc to Gnd, and no problem since. I think it's a .1uF.
Posts: 67
Joined: Fri Dec 11, 2009 2:19 am

Re: Can't connect to target atmega328p-pu

by Poofjunior on Sun Aug 19, 2012 2:50 am

Hi, dmogle,

Yep, I also had the same problem where initialization failed in Ubuntu Linux.

Solution number 3 (above) worked for me, though! I threw in a 16 [mhz] oscillator on pins 9 and 10 along with two 22 [pF] capacitors. I also placed a capacitor between vcc and gnd. After that, I was able to rewrite the fuse bits, pull out the oscillator and two capacitors out, and program without them.

(I got my atmega328p-pu chips from Digi-Key)


-- Poofjunior
Posts: 1
Joined: Thu Oct 14, 2010 11:04 am