Get 12% off, TODAY ONLY 12/12 – use the code TWELVE on check out! Some restrictions apply!

Atmega328P-AU programming problems
Moderators: adafruit_support_bill, adafruit

Atmega328P-AU programming problems

by ry842002 on Sat Oct 06, 2012 11:20 pm

I have recently created my own boards, and am SO close to having them work... but I can’t seem to program any of the raw Atmega328P-AU (TQFP-32) chips.
I used Adafruit’s USBTinyISP to burn the Lilypad bootloaders on to the raw chips, but after that, I am not able to upload any sketches to them.

I’m using “1 Inch of Square of Goodness” by the Custom Geek (http://thecustomgeek.com/kits/one-squar ... -build-it/) and I’m able to burn the bootloaders to the chips. And, I’ve then tried connecting the same board to FTDI, and it appears to upload the sketch, but then finishes with the “avrdude not in sync” message that the entirety of the internet doesn’t know how to solve, lol.
I've also tried using a TQFP adapter, to no avail.

I know the FTDI cable is fine, as I can use it without issue to upload sketches to my Arduino Lilypad Simple board.
I've tried uploading via FTDI, and using the "Upload Using Programmer" option, but neither give me any results.

My concern is why I can’t upload any sketches to the ATMEGA328P-AUs I bought from Mouser. I had trouble burning the bootloader at first, but now I’ve at least got that working. I thought that would be the end of the issues, but if I can’t upload the sketch, this entire PCB is useless, lol.

Any suggestions? I need to know soon, as I've got a deadline to meet with these. Thanks to anyone who is able to help. :)
ry842002
 
Posts: 2
Joined: Sat Oct 06, 2012 11:14 pm

Re: Atmega328P-AU programming problems

by westfw on Sun Oct 07, 2012 12:41 am

Are you sure you're attaching the ftdi cable correctly? It looks like you have to put a 6pin cable on a row of 7pins, which might be a bit tricky. Do you have the board fully populated with the reset capacitor and everything?

Which bootloader are you using? Which "board type" are you selecting? (do they "match"?)
Do you see the initial flashes after reset on the pin13 LED? Are you sure you're burning fuses correctly as well as the bootloader? (are you using the Arduino IDE to burn the bootloader, or avrdude directly? If the latter, what command lines are you using?) Doesn't lilypad run at 8MHz, while the sq in runs at 16MHz?

If you can do ISP programming, you can potentially just use ISP to load your sketch, instead of the bootloader...
User avatar
westfw
 
Posts: 1373
Joined: Fri Apr 27, 2007 1:01 pm
Location: SF Bay area

Re: Atmega328P-AU programming problems

by ry842002 on Sun Oct 07, 2012 1:05 am

These are all very good questions.

westfw wrote:Are you sure you're attaching the ftdi cable correctly? It looks like you have to put a 6pin cable on a row of 7pins, which might be a bit tricky. Do you have the board fully populated with the reset capacitor and everything?


Yes, the board does have 7 pins, but the last one is an analog pin and not necessary for the FTDI. I had the capacitor there, took it away - neither arrangement resulted in success.

westfw wrote: Which bootloader are you using? Which "board type" are you selecting? (do they "match"?)


I've tried with three different bootloaders: Lilypad 328, Duemilanove w/ 328, Arduino Pro Mini 5V and 3V, both 328. I then tried programming with the same board selected, and though I was able to burn the bootloader for all of them except the 3V Mini, none of these resulted in a successful upload of the Blink sketch.

westfw wrote: Do you see the initial flashes after reset on the pin13 LED?


Yes, after burning the bootloader it does flash on and off continuously.

westfw wrote: Are you sure you're burning fuses correctly as well as the bootloader? (are you using the Arduino IDE to burn the bootloader, or avrdude directly? If the latter, what command lines are you using?)


I am using the Arduino IDE to burn the bootloader, so I leave the fuse burning in the hands of that software.

westfw wrote: Doesn't lilypad run at 8MHz, while the sq in runs at 16MHz?


Good point. Though, if I skip the Square and just use the USBTinyISP connected to my QFP32 Adapter, will that resolve the problem?

[quote="westfw"If you can do ISP programming, you can potentially just use ISP to load your sketch, instead of the bootloader...[/quote]

Yeah, I tried that as well, and it gives the same result:
"avrdude: initialization failed, rc=-1 Double check connections and try again, or use -F to override this check."

Does this information help?
ry842002
 
Posts: 2
Joined: Sat Oct 06, 2012 11:14 pm

Re: Atmega328P-AU programming problems

by westfw on Sun Oct 07, 2012 3:02 am

So which bootloader is in there now? You need to pick one and stick with it if you want to actually figure out what's wrong. I would guess that some failed due to wrong clock rate.
"Duemilanove w/328" or "Pro mini 5V" are probably closest to correct.

I am using the Arduino IDE to burn the bootloader

So you haven't actually gotten avrdude to work with your progammer, manually, right?

I tried [programmer the sketch with the programmer] as well, and it gives the same result:
"avrdude: initialization failed, rc=-1 Double check connections and try again, or use -F to override this check."

Still using the Arduino IDE? Hmm. I wonder if that sets fuses appropriately? Or if you're using avrdude directly, you may also need to set fuses so that it doesn't try to run the bootloader.

If the IDE can burn the bootloader, it should be possible to burn a sketch as well. Can you collect the verbose output of the attempt? (either via the IDE, or from adding "-v -v -v" to the avrdude command.)
User avatar
westfw
 
Posts: 1373
Joined: Fri Apr 27, 2007 1:01 pm
Location: SF Bay area