Go Down

Topic: Fail to reset lock bits. (Read 436 times) previous topic - next topic

daveyjones

I was having a problem with my atmega328p, so I figured I'd do a complete reset on it.
so far so good.  However, I noticed the lockbits are set to 0x3F; when I try to reset it to 0xFF, I get an error:
Code: [Select]
avrdude.exe: AVR device initialized and ready to accept instructions

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

avrdude.exe: Device signature = 0x1e950f
avrdude.exe: reading input file "0xFF"
avrdude.exe: writing lock (1 bytes):

Writing |  ***failed; 
################################################## | 100% 0.07s

avrdude.exe: 1 bytes of lock written
avrdude.exe: verifying lock memory against 0xFF:
avrdude.exe: load data lock data from input file 0xFF:
avrdude.exe: input file 0xFF contains 1 bytes
avrdude.exe: reading on-chip lock data:

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

avrdude.exe: verifying ...
avrdude.exe: verification error, first mismatch at byte 0x0000
             0xff != 0x3f
avrdude.exe: verification error; content mismatch

avrdude.exe done.  Thank you.

~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~

avrdude.exe: AVR device initialized and ready to accept instructions

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

avrdude.exe: Device signature = 0x1e950f
avrdude.exe: reading lock memory:

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

avrdude.exe: writing output file "C:\Users\josh\AppData\Local\Temp\12f4ac26-6697-4bc9-b61f-1f02406a8557.TMP"

avrdude.exe done.  Thank you.


writing the other fuse bits is no problem... just the lock bits. Ideas?

spycatcher2k

-=-
http://www.uk-pcb.co.uk - UK Based PCB Fab & Assembly Company
Design & Assembly work undertaken - Arduino repairs & testing - PM for details. Arduino & C# PC programming.

daveyjones

I misread some posts then  What is 'default' (new chip) setting supposed to be? -- I can't change it at all.  Here's an attempt to write 0x3e

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

avrdude.exe: verifying ...
avrdude.exe: verification error, first mismatch at byte 0x0000
             0x3e != 0x00
avrdude.exe: verification error; content mismatch

dmjlambert

#3
Nov 08, 2016, 10:09 pm Last Edit: Nov 08, 2016, 10:12 pm by dmjlambert
For certain lock settings the way to unlock is to do chip erase, which is the avrdude -e option.  So, you can't really unlock by unprogramming bits or setting the value.  But you can program lock bits.  It is a one way process to set lock bits, until you do chip erase.  I recommend an online fuse calculator, it makes programming the bits easier to understand.
http://eleccelerator.com/fusecalc/fusecalc.php?chip=atmega328p
So, to summarize, FF is a valid value, you just can't write it, you have to do chip erase instead.

daveyjones

AWESOME!  Thank you for the information! Very helpful; I appreciate that you explained it to me.

Go Up