Bitbanging Nano: initialization failed

Hi all,

About two months ago, I got this burning urge to make an LED cube with an Arduino. Because I wanted it to be as small as possible, I chose to use the Nano variant.
Now, I've gotten all the parts (I didn't buy it pre-made, I wanted to solder it myself) and put it all together. I plugged in the cable to the Nano and it does show up on my computer as /dev/ttyUSB0. The problem is that whenever I try to burn the bootloader onto it, it displays this error:

avrdude: AVR device not responding
avrdude: initialization failed, rc=-1
         Double check connections and try again, or use -F to override
         this check.

I'd be perfectly willing to provide pictures, but I have double triple quadruple n-tuple checked the connections.
Now I'm afraid I might have burned the FT232 or the ATMEGA chip while I was soldering. Is there any way to check both like some magical resistance value between pins?

I am using Ladyada's FTDI Friend bitbang method to burn the bootloader but have also tried the original method published by Kimio Kosaka. I notice that the tutorials are for an Arduino Diecimila, but figured it should work anyway because it's the same basic ICs. Am I missing something there?

Also: if anyone else wants to build a Nano by themselves, here's the part list. I couldn't find it in the V3.0 user guide even though it was there in the V2.3. (Pretty sure it's correct. Everything fits on the board)

1 ATMEGA328P-AU AVR MCU (TQFP-32 package)
1 6-pin 2.54mm/0.1in pitch ICSP header
1 UA78M05 5V regulator (SOT-223 package)
2 10uF solid tantalum capacitors (1206 size, I used P/N 293D106X9016A2TE3)
5 0.1 uF ceramic capacitors (0805 size, P/N GCM21BR71H104KA37L)
1 MBR0520 diode (SOD-123 package, I substituted P/N PMEG3010ER,115)
1 680 Ohm 4-resistor array (0603 size each, P/N 742C083681JP)
1 1K Ohm 4-resistor array (0603 size each, P/N 742C083102JP)
1 FT232RL UART (SSOP-28 package)
1 red LED (0805, P/N APL3015NC)
1 green LED (0805, P/N LGR971-Z)
1 amber LED (0805, P/N LOR976-Z)
1 blue LED (0805, P/N VAOL-S8SB4)
1 mini-B USB female connector (P/N 1734035-1)
1 reset pushbutton (P/N B3U-1000P)
1 ceramic 16MHz resonator (P/N CSTCE16M0V53-R0)

If it is any help, I'm using avrdude 5.10 on Ubuntu 10.10. A million thanks to anyone who can help!

and it does show up on my computer as /dev/ttyUSB0.

That means that the FT232 is working. :slight_smile:

to provide pictures, but I have double triple quadruple n-tuple checked the connections.

It is hard to check your own homework so post away and lets see if we can spot something.

Hi Mike,

Thanks. This is also a school project, so you're saving my rear end here. :slight_smile:



(Yes, I did peel out a couple solder pads. Although, whether or not the FTDI chip is on the board shouldn't matter while I'm just bootloading because it doesn't involve any of its standard functions.)

(I peeled off the pad for analog pin 2 :(, so I just soldered the pin on the chip to the pin on the board. Shouldn't matter.)

(Peeled off the pad for a capacitor. Connected it to where it should've been through a jumper.)

These are scaled down, and higher res pictures are here, here, here, and here.
I'll post pictures of my bootloading setup tomorrow.

Well to be honest it is a bit of a mess isn't it.
Do you have any test equipment, if it is a school project I would suspect you have. Get an oscilloscope and see if you have any oscillation on the clock input to the processor. Check also that the power is getting to the pins of the chip and the reset line is high.
Then look at the RX line and see if anything is coming in from the USB interface.

It looks like pin 1 and 2 of the FTDI chip are bridged.

Well to be honest it is a bit of a mess isn't it.

I couldn't help but smash a couple eggs while making this omlete. :stuck_out_tongue:

Do you have any test equipment, if it is a school project I would suspect you have. Get an oscilloscope and see if you have any oscillation on the clock input to the processor.

I don't know if most high schools have that kind of equipment, but mine doesn't. All I have is the multimeter I bought. Is there any way to check oscillation with that?

Check also that the power is getting to the pins of the chip

The blue power LED lights up when I plug in the cable and when I wire 5V to the 5V pin. I tested for continuity from VCC pins 4, 6, and 18 on the ATMEGA chip itself to the 5V pin, and it checked out ok.

and the reset line is high.

The voltage at the reset pin is the 4.8V and when I measure the resistance between RST and 5V, I get 670 Ohms.

Then look at the RX line and see if anything is coming in from the USB interface.

I shorted out RX and TX temporarily on my breadboard to perform the "loop back" test. I opened up Serial Monitor and whatever I typed in came back as soon as I pressed enter.

It looks like pin 1 and 2 of the FTDI chip are bridged.

That's just my messy clean-up. I tried cleaning up my flux residue with 91% alcohol and it left some stuff behind. It seems non-conductive, though. I checked with my multimeter, and theres no short between those 2 pins.

Thanks again, everyone! I'm just happy I'm getting any help at all. :smiley:
By the way, I bought supplies to make another 3 in case I made these complete duds. They should be arriving by the end of the week or Monday. Any SMD soldering advice?

Ok, here's an update for anyone who wants to try building a Nano completely from scratch.

I finally figured out what made initialization fail. It wasn't a jumper that was wired to the wrong pin or anything. It was the VCCIO pin. I was using a TSSOP adapter to mount the FT232RL on my breadboard, so it didn't have the preset jumpers on the bottom that the breakout boards from Adafruit and Sparkfun have. VCCIO should have been connected to +5V, but it wasn't, so there was no voltage for the FT232 to hit the Atmega with. Here's a writeup of all the pins that need to be connected. (I'm counting the Nano pins in DIP format, with pin 1 being the top right pin (D1/TX) and pin 28 as VIN.)

FTDI pin 1 (TXD) -> Arduino SCK (Nano pin 16/D13)
FTDI pin 2 (DTR) -> Arduino RST (Nano pin 3 or 26)
FTDI pin 3 (RTS) -> Arduino MOSI (Nano pin 14/D11)
FTDI pin 4 (VCCIO) -> +5V source (THIS IS IMPORTANT)
FTDI pin 11 (CTS) -> Arduino MISO (Nano pin 15/D12)
FTDI pin 15 (USBDP) -> USB -Data (Slice open a USB cable and strip the ends of the wires. It's either the white or green wire. It won't fry the FT232 if you put them in backwards, it'll appear as a "low speed device" in Linux syslog if you did it wrong.)
FTDI pin 16 (USBDM) -> USB +Data
FTDI pin 20 (VCC) -> +5V source (A 10uF and 0.1uF capacitor should be placed in between +5V and GND for smoothing the power source)
FTDI pin 25 (GND) -> GND (All the other pins labeled GND seem to be internally connected, so it's not necessary to wire them all up to GND)
FTDI pin 26 (TEST) -> GND (IMPORTANT, chip will fail otherwise and may overheat)

If you want indication of receiving and transmitting USB data, an LED + a 680 Ohm resistor each for FTDI pins 22 and 23 will do the trick. The cathode (- or shorter leg) should be connected to the pins themselves and the anode should be connected to +5V. The Nano itself should be attached to +5V and GND at the appropriately labeled pins.

After you plug in the USB cable to the computer, you should be ready to burn the bootloader. The command I used was

cd /usr/share/arduino/hardware/arduino/bootloaders/optiboot/ #It'll depend on your install location. This is the default for Ubuntu, I believe.
avrdude -P /dev/ttyUSB0 -p atmega328p -c ftdifriend -U flash:w:./optiboot_atmega328.hex # /dev/ttyUSB0 may be different, check the syslog for what port the FTDI chip was attached to.

You could probably use the IDE, but I used the console because I'm that kind of guy. It took a little under 9 hours for me.

For some reason, some Nanos wouldn't work after burning the bootloader. In one of them, this was solved by setting the fuses to the right values.

avrdude -P /dev/ttyUSB0 -p atmega328p -c ftdifriend -U lfuse:w:0xFF:m -U hfuse:w:0xDE:m -U efuse:w:0x05:m -U lock:w:0x3F:m

The other ones had to have the bootloader burnt again.

Hope this helped someone!