ATMega328p Fuse problem

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

I have 2 "Evil Mad Scientist" ATMega328p boards one with a 16mHz external crystal with 2 18pf caps and the other has a 20mHz external crystal with 2 22pf caps and the problem pertains to both.
I have tried to set the fuses to enable the processor to run using the external crystals but when I set to what I understand to be correct value it bricks the chip and I am no longer able to program it. Fortunately I have a dragon and can reset using the PP mode.
According to the datasheet for the ATMega328p the value should be lfuse: 0xe7 or 0xf7.

Thanks,
Mike

Happy Trails,

Mike

JaxCoder.com

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

That looks right to me. It is setting up the oscillator for full swing operation but that shouldn't be a problem.

How are you programming it (besides parallel)? What is (not) happening?

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

I am using an USBTiny. After setting the 328 with;
avrdude -p m328p -c usbtiny -U lfuse:w:0xe7
the fuse is programmed correctly (assuming here) and
then I issue the command to download the hex file;
avrdude -p m328p -c usbtiny -U flash:w:DigPot.hex
I get an; "initialization failed, rc=-1...blah blah"
Then I unbrick it and issue the same command to program and it works.

Happy Trails,

Mike

JaxCoder.com

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

AVRisp mkii mega328p selection shows extended =0x3f, hi=-xDD, lo=0xff

Imagecraft compiler user

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

Thanks for the input

bobgardner wrote:
AVRisp mkii mega328p selection shows extended =0x3f, hi=-xDD, lo=0xff

No that didn't work, it shows that it's an Ext. Crystal at 8mHz with the /8 clock bit set?

Happy Trails,

Mike

JaxCoder.com

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

Hi, Mike.

mike32217 wrote:
After setting the 328 with;
avrdude -p m328p -c usbtiny -U lfuse:w:0xe7
the fuse is programmed correctly (assuming here)
Why not read back the fuse settings ('-U lfuse:r:-:h') and be certain?

Also, you're not specifying the (optional) ':format' field on the fuse setting command. In other words, you use '-U lfuse:w:0xe7' instead of '-U lfuse:w:0xe7:m'. The AVRDUDE manual says that, if unspecified, the default format is "to use auto detection for input files, and raw binary format for output files." I strongly suspect that may not be giving you the desired fuse settings.

Hope that helps a bit....

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

meteor,

Thanks for the input but that didn't work either although I thought that was it also.

Mike

Happy Trails,

Mike

JaxCoder.com

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

I use the following for a 16Mhz external crystal on a M328p...

avrdude -p atmega328p -c usbasp -U lfuse:w:0xff:m -U hfuse:w:0xd9:m -U efuse:w:0x07:m

What does http://www.engbedded.com/fusecalc say?

Nigel Batten
www.batsocks.co.uk