Solved: Atmega328p Short between Ground and VCC?

Go To Last Post
17 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

So im really confused right now, I've attempted to breadboard and program my AVR chip using the Sparkfun Pocket AVR programmer.

I've gotten the drivers installed and so forth. However im running into an issue.

 

Right now I have the AVR Sitting on the board by itself. I followed a few guides on how to Plug in wires from the AVR Programmer to the bread-boarded AVR.

This is where it starts to fail: http://imgur.com/a/DPqCk (hopefully the pictures are readable), but let me explain what's going on. I have the 5v (Which the AVR Programmer can provide 5v from USB) and GND coming from my ISP Port (You can see in the third image).

Port Configuration taken from Sparkfun (This is what I used):

 

Config

 

Basically if you can see in the images, I have the + and - rails from each side of the breadboard connected, and I have the 5v from ISP to the + rail on the right, and GND from ISP going to the - rail on the right side as well.

 

The issue I run into is when I plug a Jumper wire from The chips VCC to the + rail and GND to the - rail. You can see in the image below the Atmega328p pinout, so you can see on my breadboard Pin 7 is going to the + rail and Pin 8 is going to the - rail. When I do this the programmer leds go out, and it shorts out and the programmer disables itself LEDS go off, and Windows loses "connection" to it. So im assuming there is some kind of short. (Same thing happens if you touch the 5v from ISP and GND from ISP together). So im guessing thats what the problem is.

Is there something im missing? I've tried connecting the whole thing up just to see if that made a difference and it did not. Soon as I connect both of them up the programmer shuts off and I assume shorts or something?

Last Edited: Sun. Dec 25, 2016 - 01:12 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

A couple of thoughts:

 

Breadboarding the chip is fine.

You may hear some "Why don't you just use a Nano" comments, but ignore them.

You should be able to get your chip working on the breadboard without too much difficulty.

 

Next, Hard to see in the photos, but I assume you know that the power rails on one side of the breadboard are not connected to the power rails on the opposite side of the breadboard.

So, you either have to connect all of your Vcc to one rail, or jumper the two Vcc power rails together if you want to connect on both sides of the breadboard.

Likewise the Ground rails.

 

Next:

The M328 has TWO V+ and TWO Ground pins.

The "second" V+ is labeled AVCC on the pin out.

You need to connect both Vcc and AVcc to the V+ power rail, and connect BOTH ground pins to the Ground rail.

 

Next:

Leave Aref open, or put a 0.1 uF cap on Aref to ground.

The chip will run fine, and flash an LED, with just leaving Aref unconnected.

 

Next:

The micro needs by-pass capacitors, 0.1 uF, from the Vcc to Ground, and from the AVcc to Ground, pairs of pins.

Put these close to the micro chip itself, right up next to the chip.

 

I gave my Spark Fun Programmer away years ago, as I never used it.

So I can't give you any advice on the software to drive it.

 

But, it is possible that you are viewing the connector on the programmer incorrectly, (backwards, upside down, etc.).

 

The pin out for the programming header you have posted is as if one were looking down onto the male pins sticking up from the circuit board, (in this case your breadboard).

The female connector would slide down on top of the programming header's male pins.

 

You need to make sure you are connecting your wires to the programmer's connector correctly.

If you have a DMM, (voltmeter), you should be able to check the Vcc & Ground pins on the programmer's cable connector.

 

Next:

How are you going to test your micro?

Probably need to add a 470 ohm, or so, resistor and an LED to one of the I/O pins.

 

Please report back on your progress.

What you are trying to do is very doable.

 

JC

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Next, get used to drawing a schematic of you circuit.

Here is an old one for a minimal setup for a Mega168, (same pin out as your 328).

You can ignore the Max 232 USART to PC interface chip.

You do not need the external crystal or its two caps.

You can ignore the 2-Pin header on the Vcc pin of the programmer, it is there to account for programmers which supply Vcc to the micro, vs. programmers which read the chip's Vcc to set the programming signal levels, (3V vs 5V, etc.).

 

JC

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Here is a photo of an almost minimal M168 breadboard setup.

There is an RC on the Reset\ pins.

There are two yellow by-pass caps across the Vcc/Ground and AVcc/Ground pins, on each side of the center of the chip.

There are a couple of LEDs, with their resistors also hooked up.

The programming pins go to a jerry-rigged connector to connect to the ISP programmer.

 

Note, also, that the larger breadboards often have a break in the power rails in the middle, hence the little brown jumper wires on the power rails.

 

Labeling the power rails is a good idea, it helps to reduce mistakes.

That is what the little sticker is for.

 

JC

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

In addition to Doc's excellent notes (especially to tie all VCCs and GNDs), it appears in your photo 3 that you have GND into pin1 of the 6-pin connector and VCC into pin5

David (aka frog_jr)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Last question:

How's your soldering skills?

 

This little do-dat makes it much easier to connect your programmer's cable connector to the breadboard.

 

The outer row of pins plugs into the breadboard, while the inner Header sticks up in the air for the programmer's cable connector.

You still need to interpret the pinout correctly, but at least it does away with jiggling wires and intermittent connections.

 

Carl, (MicroCarl), sent me one when I first started with AVR's.

 

I'd be glad to send you one. 

Much easier to mail it as a kit, i.e. flat and unassembled, if you have a soldering iron.

"PM" me your address, (top right hand corner on the Forum's page).

 

You want to put the breadboard pins in the breadboard, then drop the PCB on top, and then solder the connections.

That way the pins are aligned correctly for the holes, and are not skewed outwards.

 

JC

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

For reference I faced the same issue when I had the breadboard fully assembled with the chip I had just reduced it down to this to try and diagnose the problem. I had all the vcc and GND etc connected previously.

For whatever reason soon as I plug both GND into GND and +5v into VCC on pin 7 and 8 the ISP programmer turns off.

In picture 3 it's hard to tell but they are actually in the right spot it's just hard to tell on the picture.

I had the breadboard fully assembled accordin to tutorials but I reduced it down to this to figure out what was causing it.

Also the GND and power rails I connected together on the bottom so it should be a full circuit. I'm really stuck but I'll try some stuff out suggested and come back.

Last Edited: Sun. Dec 25, 2016 - 03:17 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

How did you verify the connections to the programmer. I only ask because everything else looks OK. The best way is with a meter. If you don't have one, you can get one from someplace lilke Harbor Freight for less than $10. ( They work OK, but the leads are touchy).

 

If you have a meter, you can also check the power and ground connections with the ohms function to see if they do show a short when the chip is connected. Disconnect your programmer and just read between the power and ground.

 

(Just so you know, I'm not 'talking down' to you. When I have no idea of somebody's experience, I try to cover all of the details). Anyway, I've been known to reverse power supply connections (recently!) , and I've been doing this stuff for 50 years.

 

I have a Sparkfun programmer and it works fine. I used a separate power supply because I didn't want it to quit when I hooked up a few LEDs. I've used it with both the  AVRDude and the Arduino software IDE.

 

Good Luck,

 

hj

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

It does show a short on my multimeter (Shows a solid Line when it's a short) that's how I was able to tell it was presumably a short....unless my ISP cable is just borked. And don't worry I don't feel talked down to.....I mean im not by any means "good" or even "not" a beginner at this but I felt like everything should "look" ok.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Something absolutely must be wrong with this 6 pin ISP, connecting just +5v to Pin 7 (VCC) and GND to pin 8 directly causes a short.....

 

Heck even this Is causing a short: Plugging the +5v pin to the + rails and the GND pin to the - rail and checking between them is a short........what.

 

Edit: I ended up realizing the Pins on the ISP programmer were connected wrong, Which DocJC mentioned, it makes more sense "looking down" at them. So I finally have them all connected and it's not shorting (YAY!)

 

However something is still wrong (I triple checked my connections just in case this time) and switched the Arduino chips with another one (Just in case this one got fried). I get this in AVR dude now:

C:\WINAVR>avrdude -c usbtiny -p atmega328p -V -F

avrdude: initialization failed, rc=-1
avrdude: AVR device initialized and ready to accept instructions
avrdude: Device signature = 0x000000 (retrying)
avrdude: Device signature = 0x000000 (retrying)
avrdude: Device signature = 0x000000
avrdude: Yikes!  Invalid device signature.
avrdude: Expected signature for ATmega328P is 1E 95 0F

avrdude done.  Thank you.

 

So something is obviously off. Im guessing with my wiring. I've added the capacitors as suggested. Ill keep fooling around till I get this thing! ha

 

edit2: GOOD NEWS I got it working, Got a LED blinking. Im honestly not sure what the actual problem was. everything is actually the same on my board from the above ^^ errors. I replaced the Crystal with a new one and Instead of using jumper wires to go from pin 9/10 to the Crystal and .22uf caps I put the crystal between 9/10 and then the caps going to GND from 9/10 at the end.....and I uploaded it and it worked! feels good.

 

 

Legit question though: Since MOSI and MISO are on ports PB4 and PB3.....if you had say an LED hooked to those, could you Program the chip AND have LEDS connected to those at the same time? or would that mess stuff up. In my program I have an LED on PB1 since it doesn't have any connectors to it.

 

Also legit question 2: So....the AVR has a blink program now, I should just be able to make a normal 5v connector for it.....but when the AVR powers off and I power it on do I need to "reprogram" it...or just hit reset (Once I actually add a button) and it'll go back to the program that was loaded? Besides normal decoupling caps on the 7805 any other considerations when moving to a battery?

 

Last Edited: Sun. Dec 25, 2016 - 07:24 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You don't put 0.22uF caps in the crystal -22pF is the value.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

My bad, they were actually 22pf I mis-typed. (they were originally 22pf as well). Maybe I just had a bad crystal. Thank goodness it's working though! thanks everyone for your help! I was getting so frustrated (But thats part of the process I suppose!)

Last Edited: Sun. Dec 25, 2016 - 07:33 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You can have LEDs on the Programming lines, they will flash when you program the chip.

As far as sharing pins goes, an LED is probably a good choice.

 

The micro will retain the last programmed program.

When you power it up it will automatically run the program, you don't need to hit the Reset\ switch to "start" the program.

 

Good to hear you have it all working.

 

JC

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

DocJC wrote:
You can have LEDs on the Programming lines
Don't forget current limiting resistors for the LEDs or they may interfere with programming.

David (aka frog_jr)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Atmel's Application note-910, page #3 says:

 

Figure 1-2. Recommended In-System Programming Interface Connector Layout (Top View)

       Top View
       ---------
 MISO  | 1 | 2 |  VCC
       ---------
 SCK   | 3 | 4 | MOSI
       ---------
!RESET | 5 | 6 |  GND
       ---------

http://www.atmel.com/Images/Atme...

 

EDIT:

             TYPO...

You can avoid reality, for a while.  But you can't avoid the consequences of reality! - C.W. Livingston

Last Edited: Sun. Dec 25, 2016 - 01:46 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Mercfh wrote:

Something absolutely must be wrong with this 6 pin ISP, connecting just +5v to Pin 7 (VCC) and GND to pin 8 directly causes a short.....

 

 

You don't mention pin 20 (AVCC) , that must be connected to your Vcc +5v.  Also connect pin 22 to ground.

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I think the Sparkfun's "hookup guide" is just a little confusing since it said the "NOTCH" in the ISP programmer denotes Pin 1, but it was actually notched where RESET was and a tiny almost non-visible arrow was on the programmer itself which was actually Pin 1 (I had to hold it in a certain light angle to even be able to see it).