Problem changing avr lockbits using avrdude.

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

Hello 

 

Im using avrdude to program my avr atmega32 . I write my program in flash memory and set hfuse and lfuse . but when I set the lockbits , my program will be changed . This is the results in terminal mode after programming: 

 

As you see when I change the lock bit my program will be changed !!!

what should i do ?

 

Last Edited: Wed. Oct 25, 2017 - 07:06 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Erase the chip. That resets the lockbits.
Re-program the Flash. Think carefully before setting the appropriate lockbits.

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

tnt1374 wrote:
As you see when I change the lock bit my program will be changed !!!

No, your program does not change. You set the lock bits to protect the Flash from being read, therefore you get some rubbish instead of the real content.

Stefan Ernst

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

sternst wrote:
some rubbish
@tnt1374, In fact study the "rubbish"...

00 00 01 01 02 02 03 03 ...

Can you see the pattern? When the lockbits are set they effectively say "don't return real flash contents, instead return the low byte of the WORD address for each opcode". So opcode location 0 returns 00 00, then location 1 returns 01 01 and so on. Obviously these numbers in no way relate to real AVR opcodes and the pirate trying to break in who feeds this data to a disassembler is not going to get any kind of sensible result.

 

BTW lock bits are a bit of a "toy" anyway. A dedicated hacker can simply pay $500 to break through such lock bits.

Last Edited: Wed. Oct 25, 2017 - 09:06 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

thank you 

 

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

yes . I searched and found out my fault. thank you for response

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

your answer was realy complete. thank you very much