Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

ATMega8 LOCK BITS question

Status
Not open for further replies.

kasamiko

Full Member level 3
Joined
May 23, 2004
Messages
154
Helped
16
Reputation
32
Reaction score
18
Trophy points
1,298
Location
Philippines
Activity points
1,121
Hi,

I'm trying to protect the HEX of my ATMega8L, How can I set it in AVR Studio? and one thing if ever I'll set the LOCK BITS will I'll be able to used again the chip? by erasing the flash and the locks?

I'm a bit hesitant I might lock my Mega8 again and cannot access via ISP..(AVRISP)
 

You have to set the bits LB2 and LB1.

Setting LB1 to 1 and LB2 to 1 disables all lock features.

Setting LB1 to 0 and LB2 to 1 - Further programming of the Flash and EEPROM is disabled in Parallel and Serial Programming mode. The Fuse Bits are locked in both Serial and Parallel Programming mode.

Setting LB2 to 0 and LB1 to 0 - Further programming and verification of the Flash and EEPROM is disabled in parallel and Serial Programming mode. The Fuse Bits are locked in both Serial and Parallel Programming modes.

Program the fuse bits before you program the lock bits.

If you erase the code-locked chip, you can use the chip again.

Hope this helps.
Tahmid.
 
I can ERASED it again using? AVRISP? or via ISP programming? It cannot be READ or WRITE BUT can be ERASE via ISP?
 

Hi,
You can write it and then lock it. After being locked, it can not be read (strictly speaking, it can be read, but the read data will not be the code, it'll just be gibberish). However we can still erase it. When you erase it, you can write to it again.

Hope this helps.
Tahmid.
 

you cannot read it once locked... after locking if you read then you read only FF in all memory location... then to erase write and read you have to before you lock it again...
 
you cannot read it once locked
Of course you can read it, it's just that you won't be reading the code. You'll get gibberish. Not necessarily FF.

You just have a hex file filled with garbage.

Actually it's a bit more than garbage. It's the word addresses presented at byte locations so you get:

00 00 01 01 02 02 03 03 04 04 .. 0E 0E 0F 0F
10 10 11 11 12 12... and so on
 
Of course you can read it, it's just that you won't be reading the code. You'll get gibberish. Not necessarily FF.

I dont agree with you... i have played with almost all teh controller in the market, and found 90% of the controllers have FF filled when the code is locked, and when it is read, it displays only FF in all the memory location... it should as per rule never show garbage in the memory.... i think you dont read the hex file, but read something else and have confused yourself...

it also depends on the level of locking security you provide to the controller...

Usually there will be 4 levels and depending on the level the security is achieved with respect to
1. reading.
2. writing and reading
3. writing
4. erasing and writing and reading.
 
Have you played with AVR? Have you even tried with PIC? When you read a locked PIC you get all 00's (as I've always found). With a locked AVR, you are likely to get the byte locations. As I have written before AVR only provides 2 lock modes (and 1 mode which is where locking is disabled). You can't disable erasing. AVR allows you to reprogram the device if you erase it first. The other lock you have is boot lock. If you have doubts about what I said, read here:

View topic - Reading hex files from Locked AVR chips?? :: AVR Freaks
AVR Freaks :: View topic - Memory Lock Bits for Intellectual Property Protectionhttp://www.avrfreaks.net/index.php?name=PNphpBB2&file=printview&t=30701&start=0
View topic - Security/LockBit Confusion with ATmega8535 :: AVR Freaks

Hope this helps.
Tahmid.

---------- Post added at 15:41 ---------- Previous post was at 15:19 ----------

This is about the PIC:
PIC code protection - read 0x00?

---------- Post added at 15:42 ---------- Previous post was at 15:41 ----------

PIC code protection - read 0x00?
 
Last edited:
FC is fine for locking AVR's. But for safety sake just reda back the chip and see what you get is not the original hex file you loaded in the buffer. I have seen that ProgISP doesnt do it despite we enable the "lock chip" feature in the "Auto" options. I always lock it with the command on the menu bar.
Cheers
 
you have to set the bits lb2 and lb1.

Setting lb1 to 1 and lb2 to 1 disables all lock features.

Setting lb1 to 0 and lb2 to 1 - further programming of the flash and eeprom is disabled in parallel and serial programming mode. The fuse bits are locked in both serial and parallel programming mode.

Setting lb2 to 0 and lb1 to 0 - further programming and verification of the flash and eeprom is disabled in parallel and serial programming mode. The fuse bits are locked in both serial and parallel programming modes.

Program the fuse bits before you program the lock bits.

If you erase the code-locked chip, you can use the chip again.

Hope this helps.
Tahmid.
thanks very much tahmid
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top