atmega328P not accepting anything

For Adafruit customers who seek help with microcontrollers

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
smkoberg
 
Posts: 55
Joined: Tue Aug 11, 2009 3:45 am

atmega328P not accepting anything

Post by smkoberg »

Hey everyone!
I've been racking my brain and seeking help over at the arduino.cc forum, but I'm still at a loss. I'm trying to create a board with an ATMEGA328P TQFP-32 to fade a series of green LEDs in a random fashion to resemble fireflies. My issue is that nothing seems to be working in the way of programming the chip.

The sketch works fine when using my boarduino, but when I try to program the TQFP, it doesn't want to work.

First, I tried using my boarduino, with the ArduinoISP sketch loaded on it, to burn a bootloader to the target board, which, appeared to load the bootloader, but when it tried uploading the sketch, it wouldn't work. I tried selecting the target board as an Uno, a LiliPad, a proMini, etc. Each time the bootloader would "load" but when it came to uploading the sketch, nothing would happen.

Then I moved to tying to use the boarduino without the 28pin DIP Atmega328 and use jumper wires to the corresponding sockets to program the TQFP chip, again, nothing worked.

Finally, I tried using my PocektISP programmer and upload the a bootloader through avrdude and the command prompt. Again, nothing is working.

I need this for my sisters BANNED, which is in August, so the faster I can figure out/get help with programming the chip, the sooner I can solder 40 of these boards together.

Below is a screen capture of the schematic I'm using. Also, I've tried taking the resistor off the MOSI pin to try an avoid any issues with that, but, as you might have guessed, it didn't work.

Image

mtbf0
 
Posts: 1645
Joined: Sat Nov 10, 2007 12:59 am

Re: atmega328P not accepting anything

Post by mtbf0 »

have you tried uploading your sketch or even a rudimentary blink sketch using isp to make certain isp programming is really working?

philipm
 
Posts: 29
Joined: Tue Dec 27, 2011 10:50 am

Re: atmega328P not accepting anything

Post by philipm »

I'm not able to see your schematic at work. I'd sugest checking the crystal/resonator connections. The bootloader upload doesn't depend on an external crystal. Have you considered building a second to see if that works?

I have successfully built 8 or so different boards based around the TQFP-32 variant. The issues I have encountered have been:
- solder bridges between the pins (you really need almost no solder!)
- the timing issue with loading the bootloader (v1.0 arduino, fixed in v1.0.1)
- i needed a capacitor on the reset line for my serial programmer (silabs device based)

Other than that, it's all worked pretty much first time. If you have an arduino, I would encourage you to try that to burn the bootloader, if successfull in establishing comms, the TX/RX/D13 LEDs go disco for quite a few seconds giving a good indication that it is working.

If you've programmed the boarduino, you should be able to get this to work. =)

smkoberg
 
Posts: 55
Joined: Tue Aug 11, 2009 3:45 am

Re: atmega328P not accepting anything

Post by smkoberg »

mtbf0 wrote:have you tried uploading your sketch or even a rudimentary blink sketch using isp to make certain isp programming is really working?
I have uploaded a blinking program which I had written/compiled in AVRStudio and uploaded with the avrdude/pocketavr programmer, and that worked fine.
philipm wrote:Have you considered building a second to see if that works?
I've ordered a new set of components since I have two more practice boards to get this right so I have to wait a few more days until UPS delivers my stuff.
philipm wrote: - solder bridges between the pins (you really need almost no solder!)
I can't find any bridges, if they exist, and I keep looking out of a fear of missing something.
philipm wrote: - the timing issue with loading the bootloader (v1.0 arduino, fixed in v1.0.1)
I downloaded the latest version of the IDE (1.0.1) the day the first set of components came in.
philipm wrote: - i needed a capacitor on the reset line for my serial programmer (silabs device based)
I'm using pogo pins to connect the board to my breadboard/boarduino/ISP, and have tried the capacitor on the reset line which still isn't helping me. I've also tried the cap/resistor combo, but nothing came out of it.
philipm wrote:
If you've programmed the boarduino, you should be able to get this to work. =)
I think that's whats frustrating me the most: I've burned bootloaders to 9 other 328 28pin DIP chips before, as well as programming random things on them, but when it comes to the 32pin TQFP, it aint workin'

mtbf0
 
Posts: 1645
Joined: Sat Nov 10, 2007 12:59 am

Re: atmega328P not accepting anything

Post by mtbf0 »

i don't see a cap on the reset line in the schematic.

User avatar
abqlewis
 
Posts: 71
Joined: Fri Dec 11, 2009 2:19 am

Re: atmega328P not accepting anything

Post by abqlewis »

mtbf0 wrote:i don't see a cap on the reset line in the schematic.
Or a 10K pullup to Vcc. You HAVE to have both, or the board won't work, or at least not work consistently (timing issues). The cap I've used is a 0.1uF, but I don't know how important the value is. Look at the Uno schematic, or even better, the boarduino schematic (http://www.ladyada.net/images/boarduino ... inosch.png). Your bootloader is probably loaded OK, but just can't come out of reset long enough to do anything useful.

philipm
 
Posts: 29
Joined: Tue Dec 27, 2011 10:50 am

Re: atmega328P not accepting anything

Post by philipm »

I couldn't see your schematic at work. Now I am home, I can. I agree, you need a pullup on the reset line. I use 4.7k on my boards. This is pretty essential otherwise the line will be floating and somewhat unpredictable.

The cap is only needed for programming. I use 0.1uF also. It goes in series on the reset line.

smkoberg
 
Posts: 55
Joined: Tue Aug 11, 2009 3:45 am

Re: atmega328P not accepting anything

Post by smkoberg »

I've tried all these suggestions and I'm still not having any luck. I figured I'd let everyone know what I have and how I'm trying to accomplish this hoping that this will shed some light on everyone trying to help me and solve this problem.

On the PCB, I have everything listed in the schematic:
1 x Atmega328P
1 x 16MHz resonator
6 x 47Ohm resistors
6 x Green smd LEDs
1 x 3V CR2032 battery w/ battery clip
1 x power switch

If any specifics are needed, let me know and I'll supply the information.

J1 and J2 were put there for programming purposes, they're not actually headers, just the mounting holes for headers and I'm using pogo pins on a breadboard to make the connections with the target board.

When trying to burn the bootloader using the ArduinoISP sketch on my boarduino, I have the connections set up like this (boarduino pins on the left and target board pins on the right):

V+ -- V+
GND -- GND
D10 -- RTS
D12 -- MISO
D11 -- MOSI
D13 - SCK

I also have a 0.1uF capacitor in series with the D10 -- RTS line as well as a 10KOhm pull up resistor.

When I use the Arduino IDE to burn the bootloader, I get the following in the console:

Code: Select all

C:\Program Files\arduino-1.0.1\hardware/tools/avr/bin/avrdude -CC:\Program Files\arduino-1.0.1\hardware/tools/avr/etc/avrdude.conf -v -v -v -v -patmega328p -cstk500v1 -P\\.\COM3 -b19200 -e -Ulock:w:0x3F:m -Uefuse:w:0x05:m -Uhfuse:w:0xde:m -Ulfuse:w:0xff:m 

avrdude: Version 5.11, compiled on Sep  2 2011 at 19:38:36
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2009 Joerg Wunsch

         System wide configuration file is "C:\Program Files\arduino-1.0.1\hardware/tools/avr/etc/avrdude.conf"

         Using Port                    : \\.\COM3
         Using Programmer              : stk500v1
         Overriding Baud Rate          : 19200
avrdude: Send: 0 [30]   [20] 
avrdude: Send: 0 [30]   [20] 
avrdude: Send: 0 [30]   [20] 
avrdude: Recv: . [15] 
avrdude: stk500_getsync(): not in sync: resp=0x15

avrdude done.  Thank you.

mtbf0
 
Posts: 1645
Joined: Sat Nov 10, 2007 12:59 am

Re: atmega328P not accepting anything

Post by mtbf0 »

Code: Select all

avrdude: stk500_getsync(): not in sync: resp=0x15
looks to me like you're not able to communicate with your isp device. it's failing while trying to set the fuses on the mega.

philipm
 
Posts: 29
Joined: Tue Dec 27, 2011 10:50 am

Re: atmega328P not accepting anything

Post by philipm »

stk500_getsync(): not in sync: resp=0x15
This message means the sketch isn't being uploaded. If you google it, you'll see that it's quite often associated with a reset issue.

Just to double check, have you wired up the cap and resistor as shown in the attached image?
Attachments
reset.jpg
reset.jpg (30.59 KiB) Viewed 5377 times

smkoberg
 
Posts: 55
Joined: Tue Aug 11, 2009 3:45 am

Re: atmega328P not accepting anything

Post by smkoberg »

philipm wrote: Just to double check, have you wired up the cap and resistor as shown in the attached image?
I did, however, the reset pin on the target board goes directly to the header holes on the target board and the capacitor and resistor are on the breadboard.

philipm
 
Posts: 29
Joined: Tue Dec 27, 2011 10:50 am

Re: atmega328P not accepting anything

Post by philipm »

That will not introduce any issue.

When you upload the sketch, are you using the same power source for everything? It is a good idea to.

smkoberg
 
Posts: 55
Joined: Tue Aug 11, 2009 3:45 am

Re: atmega328P not accepting anything

Post by smkoberg »

philipm wrote:When you upload the sketch, are you using the same power source for everything? It is a good idea to.
I am. I remove the battery while uploading, or, rather, trying to upload the bootloader/sketch, but still nothing happens.
I have two more sets of components, including two more ATMEGA328P's, coming in tomorrow to populate the two remaining PCB's I have and I'm going to try again with those from scratch. I fear I may have fried the chip I have now so I'm going to give it a go with new chips.

What I'm going to do is solder in everything except the resistors connecting the LEDs to the circuit. Hopefully that will remove any potential issues with the MOSI pin being pulled to ground during the programming of the chip.

What I'll be doing, as far as a step-by-step guide to programming the chip is as follows:
1) Upload the ArduinoISP sketch to the 28pin DIP on the boarduino.
2) Connect the wires from V+, GND, D10, D12, D11, and D13 on the boarduino to the V+, GND, RTS, MISO, MOSI, and SCK pins on the target Atmega328.
3) Within the Arduino IDE set the board, under tools, to UNO, set the programmer to ArduinoISP, and plug the FTDI cable into the boarduino headers. Then make the connection between the pogo pins and the target board.
4) Select burn bootloader and cross my fingers.

Theoretically, this should work without issue, correct?

philipm
 
Posts: 29
Joined: Tue Dec 27, 2011 10:50 am

Re: atmega328P not accepting anything

Post by philipm »

Yes that should work. It will burn a bootloader and the Arduino IDE will tell you pretty clearly it it worked or not. It sometimes takes a couple of goes in my experience.

I noticed you have no bypass cap on the supply for the chip. I'd definitely suggest adding a 0.1uF to smooth out the power during programming. It may not need it when running off a battery, but to be honest every design I have seen has at least this one!

philipm
 
Posts: 29
Joined: Tue Dec 27, 2011 10:50 am

Re: atmega328P not accepting anything

Post by philipm »

Just a general thought too, you might want to consider the power requirements. With 6 LEDs, you might be pushing the envelope for the chip too far (depending on the milliamps per LED).

Details of the chip's limitations are here:
http://arduino-info.wikispaces.com/ArduinoPinCurrent

The trick will be to not turn on too much at once!

You'll only have 150-200mAh from a fresh CR2032 also. This will give about 10 hours for the atmega alone (at 16MHz). With the lights on, you may get an hour. One thing you can do is drop the resonator and use the internal clock. This will give you an underclocked, less power hungry chip (great if it's going to be in "standby" waiting for an IR instruction).

Hope this is helpful, looks like a very magical and special project. =)

Locked
Please be positive and constructive with your questions and comments.

Return to “Microcontrollers”