program works .... until AVcc connected

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

I am using a atmega328p, external 16MHz crystal oscillator programmed with an avrisp mkII. I made a test program which toggles PORTB

 

#include <avr/io.h>

 

int main(void)
{
    DDRB = 0xff;

    while(1)
    {
       PORTB = 0x00;
       PORTB = 0xff;

    }
}

 

Without AVcc connected, if I look on the PORTB pins with an oscilloscope i see them toggling at 1/4 the oscillator speed as i expected, but when I connect AVcc to 5V everything stops working. Is there an obvious reason for this? I am confused...

thanks!

 

 

 

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

Atmel on purpose made two GND pins, AVcc and Vcc. All these in pairs should be connected to supply rails and decoupled.

RST pin should be at high (Vcc) potential.

Should be okay then (assuming no other fancy HW is involved - eventually it's a test program, though).

 

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

And hopefully you did not connect Vref to anything, except perhaps another cap to ground, (unless you read the data sheet very carefully and know exactly what you are doing, and why).

 

JC

 

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

If you have run the chip without AVCC and ALL other VCC and GND pins connected you may have damaged the chip.

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

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

Everything apart from the AVcc is connected as it should be - both grounds are connected, Vcc is connected and de-coupled, reset pin is held high via pull-up.

The chip doesn't seem to be damaged, it runs the program absolutely fine... except when AVcc is connected! 

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

Breadboard?  PCB?  Show photos.

 

Post a schematic as well.

"Experience is what enables you to recognise a mistake the second time you make it."

"Good judgement comes from experience.  Experience comes from bad judgement."

"When you hear hoofbeats, think horses, not unicorns."

"Fast.  Cheap.  Good.  Pick two."

"Read a lot.  Write a lot."

"We see a lot of arses on handlebars around here." - [J Ekdahl]

 

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

Would agree with Joey - should be HW related phenomena.

Drop in a virgin chip (clocked internally) for quick test. Post diagram and elaborate "16MHz crystal oscillator" with fuse settings, please.

 

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

except when AVcc is connected! 

If the chip has been damaged then that part of the chip could short out VCC internally or externally. Maybe you have a short circuit on the AVCC pin on your board also.

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly