fuses confusion.

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

I'm having some trouble with the atmega8-16pu.
After a bit of trial and error I shortened my test program to:

int main(void)
{
  int16_t Cnt = 0;

  DDRD = DDRB = 0xff;		// Set to outputs.
  for(;;)
  {
    Cnt++;
    PORTD = Cnt;
    PORTB = Cnt >> 8;
  }
}

This program just generates a bunch of sqare waves of different frequencies. The strange thing is that if I use the crystal oscillator (make fuses) then PD6 and PD7 are high impedance (Checked wit a scope). If I then change the fuses back to default (make fuses8default) then the square waves on PD6 and PD7 re-appear. All other outputs on PORTD and PORTB have the expected waveforms, regardless of fuse settings.

Quote:

fuses:
avrdude -p $(MCU) -c usbasp -i30 -Uhfuse:w:0xc7:m -Ulfuse:w:0xff:m

fusesm8default:
avrdude -p $(MCU) -c usbasp -i30 -Uhfuse:w:0xd9:m -Ulfuse:w:0xe1:m

There are no loads on the outputs and both the crystal oscillator (11.0592MHz and 552kHz on PD0) and internal oscillator (1MHz, 49.9kHz on PD0) works as expected.

The only alternative uses for PD6 and PD7 are for the analog comparator and I cannot find any reference in the latest datasheet (downloaded a fresh copy today) of a possible cause for this behavior.

Does anybody have a hint of how to solve this?

Doing magic with a USD 7 Logic Analyser: https://www.avrfreaks.net/comment/2421756#comment-2421756

Bunch of old projects with AVR's: http://www.hoevendesign.com

Last Edited: Thu. Jul 4, 2019 - 04:10 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

I use the crystal oscillator (make fuses) then PD6 and PD7 are high impedance (Checked wit a scope).

Are you sure that you don't mean PB6 and PB7 which are the crystal pins?

BTW, how does one check for high impedance with a 'scope? Pull them lightly one way or the other?

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

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

It's really PD6 and PD7 (Pin's 12 and 13).
Note that these pins are "high" impedance if the ATMEGA8 is running on the crystal and so confusion is not likely because the crystal is connected at that time.

Yesterday I did a "quick" test for the high impedance state by simply shoring 2 pins because I saw more than a volt of noise on these 2 pins. If 2 ouputs are shorted I see intermediate 2.5V levels on the scope but with a hard short the "high impedance" pins follow the 0V/5V square wave of the other output pin.

Now I did a bit more thorough examanination by plugging the microcontroller directly in a breadboard. (See photo). The 4 scope dumps are all from the scope connected to PD7:
- Open High impedance.
- 100k to PD5.
- 10k to PD5.
After these 3 screendumps I reprogrammed the fuses to the default value and made another screendump with a hard short between PD5 and PD7

After more then 10 years on this forum these are the first pictures I post here and I can't seem to figure out how to attach more than 1 picture to a post, so I'll put them in separate messages.

Photo of the ATMEGA8 on the breadboard:
-Scope is grounded on the left (barely visible)
- 2 blue 100nF decoupling caps.
- 2 18pF caps on the crystal.
- 10k resistor
- 220 uF buffer elco on the 5V supply.

Attachment(s): 

Doing magic with a USD 7 Logic Analyser: https://www.avrfreaks.net/comment/2421756#comment-2421756

Bunch of old projects with AVR's: http://www.hoevendesign.com

Last Edited: Thu. Oct 4, 2012 - 03:07 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I discovered my error and converted the bmp screendumps to png.
These are the 3 screendumps with the external crystal and with 100k and 10k between PD7 and PD5 and with the open PD7 pin.

Attachment(s): 

Doing magic with a USD 7 Logic Analyser: https://www.avrfreaks.net/comment/2421756#comment-2421756

Bunch of old projects with AVR's: http://www.hoevendesign.com

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

Finally the last scope dump with the internal oscillator and a hard short circuit between PD7 and PD5.
- Lower frequency.
- Intermediate 2.5V when the outputs are "fighting".

Attachment(s): 

Doing magic with a USD 7 Logic Analyser: https://www.avrfreaks.net/comment/2421756#comment-2421756

Bunch of old projects with AVR's: http://www.hoevendesign.com