Can write fuses but CAN'T read back with usbtiny for ATMEGA328

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

Hi,

 

It's one of those fuse days again.  As you can see below, I can write the fuses for my ATMEGA328 (just the original ATMEGA328 not ATMEGA328P) using USBTiny programmer.  But I can't read it back.  Please advise.  Thank you!  I should say, though, that I have no problem at reading an ATMEGA8, but the ATMEGA328, which is a brand new one I got from digikey.com, has the fuse read problem.

 

 

avrdude -c usbtiny -p m328 -U lfuse:w:0xA6:m -U hfuse:w:0xDF:m

 

avrdude: AVR device initialized and ready to accept instructions

 

Reading | ################################################## | 100% 0.00s

 

avrdude: Device signature = 0x1e9514

avrdude: reading input file "0xA6"

avrdude: writing lfuse (1 bytes):

 

Writing | ################################################## | 100% 0.01s

 

avrdude: 1 bytes of lfuse written

avrdude: verifying lfuse memory against 0xA6:

avrdude: load data lfuse data from input file 0xA6:

avrdude: input file 0xA6 contains 1 bytes

avrdude: reading on-chip lfuse data:

 

Reading | ################################################## | 100% 0.00s

 

avrdude: verifying ...

avrdude: 1 bytes of lfuse verified

avrdude: reading input file "0xDF"

avrdude: writing hfuse (1 bytes):

 

Writing | ################################################## | 100% 0.01s

 

avrdude: 1 bytes of hfuse written

avrdude: verifying hfuse memory against 0xDF:

avrdude: load data hfuse data from input file 0xDF:

avrdude: input file 0xDF contains 1 bytes

avrdude: reading on-chip hfuse data:

 

Reading | ################################################## | 100% 0.00s

 

avrdude: verifying ...

avrdude: 1 bytes of hfuse verified

 

avrdude: safemode: Fuses OK (H:07, E:DF, L:A6)

 

avrdude done.  Thank you.

 

 

Fails to read back.

 

avrdude -c usbtiny -p m328 -U hfuse:r:high.txt:b -U lfuse:r:low.txt:b

 

avrdude: initialization failed, rc=-1

         Double check connections and try again, or use -F to override

         this check.

 

 

avrdude done.  Thank you.

 

With -F option

 

$ avrdude -c usbtiny -p m328 -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 ATmega328 is 1E 95 14

 

avrdude done.  Thank you.

Last Edited: Tue. Aug 25, 2015 - 12:46 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

My UsbTiny programmer is able to read the ATMEGA644.  I don't think it's a programmer.  So, why the ATMEGA328 (unfortunately, I don't have any ATMEGA328P) is such a pain.  If anyone has an ATMEGA328 and the UsbTiny programmer, greatly appreciate it if you have the same problem of reading the fuse values.

 

$ avrdude -c usbtiny -p m644

 

avrdude: AVR device initialized and ready to accept instructions

 

Reading | ################################################## | 100% 0.01s

 

avrdude: Device signature = 0x1e9609

 

avrdude: safemode: Fuses OK (H:FF, E:D1, L:CF)

 

avrdude done.  Thank you.

 

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

avrdude: safemode: Fuses OK (H:07, E:DF, L:A6)

So, taking your fuse settings and decoding with the datasheet, I see nothing of too much interest in E and H.

 

L value of 0xA6 is more interesting...

 

-- CKOUT is enabled.  (If you have circuitry on that pin, could it be drawing down the clock signal?)

-- CKDIV8 is disabled, so it probably isn't a case of 'dude's bit clock too fast.  Unless...

-- What is your actual clock source type and speed?  What connections are on XTAL1 and XTAL2?  Is there a clock signal on PB0?

 

Your A6 selects the Full-Swing Crystal Oscillator clock type, and the drill-down detail indicates "Ceramic resonator, BOD
enabled"

Is that the clock source you are using?  Why such a fast SUT if you have not enabled the BOD?

 

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

Yes, I think you set CKSEL fuse bits to Full-Swing Crystal Oscillator then you must install a crystal on your board or generate clock for XTAL1 pin of ATmega328. or use other programmer can generate clock.

 

atmega328

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

>What is your actual clock source type and speed?  What connections are on XTAL1 and XTAL2?  Is there a clock signal on PB0?

 

Hi, I have a 20Mhz crystal attached to the XTAL1 and XTAL2 with two 22pF ceramic capacitors to GND, the usual stuff.

 

>Your A6 selects the Full-Swing Crystal Oscillator clock type, and the drill-down detail indicates "Ceramic resonator, BOD
enabled"

 

Oh, s**t.  This is one of those little things that the author of a project on the net failed to mention :-(

 

Ok...Glad I have a couple ceramic resonators.  Sticking in the 20Mhz one and works like a charm.  THANK YOU VERY MUCH!  I am going to reprogram the fuses to use crystal!  This got me into trouble because I thought the fuse low byte fuse "A6" setting with the word "crystal" in the description was actually going to use a crystal.  The datasheet rules :-)

 

Here is the thing: I would test out a project with a 20Mhz external crystal. Checking the datasheet, CKSEL = 1110 can give me the max of 16Mhz with an external crystal.  How can I achieve a fuse setting to go even 20Mhz or even at 24Mhz overclocked with an external crystal?  Thanks!

 

$ avrdude -c usbtiny -p m328

 

avrdude: AVR device initialized and ready to accept instructions

 

Reading | ################################################## | 100% 0.00s

 

avrdude: Device signature = 0x1e9514

 

avrdude: safemode: Fuses OK (H:07, E:DF, L:A6)

 

avrdude done.  Thank you.

Thank you!

Last Edited: Sat. Aug 29, 2015 - 04:59 PM