Author Topic: AVR lock bits programming error but lock works  (Read 5813 times)

0 Members and 1 Guest are viewing this topic.

Offline PsiTopic starter

  • Super Contributor
  • ***
  • Posts: 10124
  • Country: nz
AVR lock bits programming error but lock works
« on: February 15, 2013, 04:10:13 am »
Is it normal to get an error from AVRDUDE when setting fuse lock bits?
I can program normal fuses bits without errors but the lock bits always give an error (however the lock does seems to work fine)

I'm thinking maybe as soon as the lock byte is written the communication cannot continue due to the lock being in effect from that point on.

Here's the message i get

avrdude: AVR device initialized and ready to accept instructions

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

avrdude: Device signature = 0x1e9602
avrdude: reading input file "0xFC"
avrdude: writing lock (1 bytes):

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

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

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

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

avrdude: safemode: Fuses OK

avrdude done.  Thank you.
Greek letter 'Psi' (not Pounds per Square Inch)
 

Offline Bored@Work

  • Super Contributor
  • ***
  • Posts: 3932
  • Country: 00
Re: AVR lock bits programming error but lock works
« Reply #1 on: February 15, 2013, 04:50:02 am »
IIRC not all bits in that byte are used, and thus not all can be programmed. You could try to set those to 0 instead of 1  (or 1 instead of 0) in your input to see if the write and verification errors go away.

Check the datasheet for the unused bits. Also check the avrdude config file, the section for your particular MCU. It might contain a mask (but I am not sure if there is one. I haven't used avrdude in ages. We dropped AVRs when Atmel came up with Studio 5, making it absolutely clear they have no intention to support development on anything but Windows).
I delete PMs unread. If you have something to say, say it in public.
For all else: Profile->[Modify Profile]Buddies/Ignore List->Edit Ignore List
 

Offline PsiTopic starter

  • Super Contributor
  • ***
  • Posts: 10124
  • Country: nz
Re: AVR lock bits programming error but lock works
« Reply #2 on: February 15, 2013, 06:26:19 am »
Ah,  yes, you're right.
That fixed the error.

Thanks.
Greek letter 'Psi' (not Pounds per Square Inch)
 

Offline thebadtall

  • Newbie
  • Posts: 1
  • Country: gr
Re: AVR lock bits programming error but lock works
« Reply #3 on: July 02, 2016, 09:31:34 pm »
Hello , sorry for posting here, but i wanted to ask , how is it possible to set lock bit using avrdude ?
Can you share the appropriate command  for uploading a hex to an atmega328?

Thank you
 

Offline moreab

  • Newbie
  • Posts: 7
  • Country: in
Re: AVR lock bits programming error but lock works
« Reply #4 on: July 07, 2016, 07:27:17 am »
If you are using avrdude  then set Bit clock(-B) to  4 or even 10.
first detect the controller then upload bootloader and set low, high and extended fuse bits then seting lock bit is optional. then upload .hex file 
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf