Code Protection Again

That is the gist of it. Try it. You should be able to use avrdude to read back the memory after setting the lock bits, and get only 0xFF.

donovanpl123: In order to upload a new sketch, I would have to perform a chip erase cycle.

Chip erase cycle is done by default in the ide (actually by default avrdude which the IDE uses), if you do not want a chip erase cycle you actually have to specify with a -D argument in avrdude. Additionally I believe you can set the lock bits through "burn bootloader" if you edit boards.txt to include something like this (in my case I am using a tiny85)...

attiny85at8.bootloader..lock_bits=0x3C

It appears from my testing that as long as erase cycle is specified the lock bits do not interfere at all with upload functionality, that is to say that I think that you could set the lock bits using "burn bootloader" and upload as normal without even being able to tell they were set, the chip would function as it always does, just the code would not be readily available to read out of the chip, and you can not upload without an erase cycle.

One other thing I will say, and I know it was touched on before, but..There are "services" out there that will remove the top of the chip chemically and reset the lock bits (I believe they somehow do this with a laser) for a pretty nominal fee (I have seen this offered for around $100 U.S.). If the value of your product will not exceed the cost to have the bits manually flipped then really this is of no concern, however if the product which you hope to produce will significantly exceed the cost of code retrieval then perhaps you should investigate a more secure microcontroller.

BH72: It appears from my testing that as long as erase cycle is specified the lock bits do not interfere at all with upload functionality, that is to say that I think that you could set the lock bits using "burn bootloader" and upload as normal without even being able to tell they were set, the chip would function as it always does, just the code would not be readily available to read out of the chip, and you can not upload without an erase cycle.

Sounds good so far, although I'm still digesting all this. I. Will test ASAP.

donovanpl123: Sounds good so far, although I'm still digesting all this. I. Will test ASAP.

Ok, everything's good now. Modified Arduino IDE board.txt file for my Pro Mini pro.bootloader.lock_bits = 0x0C and uploaded the standard bootloader. I am unable to read the flash properly using AVRDUDESS. When I try to upload another file from the IDE, that works without a problem. When I recheck the lock bits are in place still. Simple enough.

Thank you for the follow-up.