Pages: [1]   Go Down
Author Topic: avrdude hfuse verification mismatch  (Read 1437 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 3
Posts: 20
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

So, about maybe half the time when I'm flashing new chips, avrdude spits back something like this:

Code:
orbimac:firmware pfriedel$ avrdude -c usbasp \
  -C /Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/etc/avrdude.conf \
  -p m328p -U lfuse:w:lfuse-LifeClock.hex:i -U hfuse:w:hfuse-LifeClock.hex:i \
  -U efuse:w:efuse-LifeClock.hex:i -U flash:w:flash-LifeClock.hex:i

avrdude: warning: cannot set sck period. please check for usbasp firmware update.
avrdude: AVR device initialized and ready to accept instructions

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

avrdude: Device signature = 0x1e950f
avrdude: NOTE: FLASH memory has been specified, an erase cycle will be performed
         To disable this feature, specify the -D option.
avrdude: erasing chip
avrdude: warning: cannot set sck period. please check for usbasp firmware update.
avrdude: reading input file "lfuse-LifeClock.hex"
avrdude: writing lfuse (1 bytes):

Writing | ################################################## | 100% 0.00s

avrdude: 1 bytes of lfuse written
avrdude: verifying lfuse memory against lfuse-LifeClock.hex:
avrdude: load data lfuse data from input file lfuse-LifeClock.hex:
avrdude: input file lfuse-LifeClock.hex 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 "hfuse-LifeClock.hex"
avrdude: writing hfuse (1 bytes):

Writing |                                                    | 0% 0.00s ***failed; 
Writing | ################################################## | 100% 0.03s

avrdude: 1 bytes of hfuse written
avrdude: verifying hfuse memory against hfuse-LifeClock.hex:
avrdude: load data hfuse data from input file hfuse-LifeClock.hex:
avrdude: input file hfuse-LifeClock.hex contains 1 bytes
avrdude: reading on-chip hfuse data:

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

avrdude: verifying ...
avrdude: verification error, first mismatch at byte 0x0000
         0xde != 0xd9
avrdude: verification error; content mismatch

avrdude: safemode: hfuse changed! Was de, and is now d9
Would you like this fuse to be changed back? [y/n]

Clearly, hfuse is failing to write and verify the first time.  But I would swear that it works flawlessly every time (on that chip) after that.  Am I missing some intricacy of avrdude and fuses - i.e. lfuse in one run, hfuse in another run, then go ahead and do flash and eeprom in a combined run?
Logged

0
Offline Offline
God Member
*****
Karma: 0
Posts: 593
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

maybe the effects of LFUSE needs some time to take effect, maybe the reset pin is not toggled between LFUSE and HFUSE operations

separate runs is a good idea, use a bash/batch script or makefile if you must automate it
Logged

Freelance engineer, consultant, contractor. Graduated from UW in 2013.

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 495
Posts: 19035
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I think frank26080115  is probably right. The Lfuse change might change the clock speed (turn off divide by 8) and attempting to change another fuse at that moment might be problematic.
Logged


Offline Offline
Newbie
*
Karma: 3
Posts: 20
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Ah, good point about CKDIV.  Yeah, this is already a bit of a batch script, so it's easy enough to split into separate processes.
Logged

Pages: [1]   Go Up
Jump to: