I want to completely block the access to an ATmega328. How do I do this?

I have Atmel ICE, AVR studio 7 and Arduino.

Bootloader - optiboot_atmega328 Fuses(without lock) - 0x05, 0xDE, 0xFF

Steps I am executing:

  1. Program fresh ATmega328 with bootloader using Atmel Studio.
  2. Burn the fuses as mentioned above.
  3. Go to Arduino and program the code.
  4. Come back to Atmel Studio >> lock bits >> enable no further programming and verification.>> Fuse bits>> disable reset.

Is the above way OK? Or should I add something to the above?

I have programmed the fuse bit with "Further programming and verification disabled". I read out the hex file and it does not match even I programmed the same hex into a different micro and it didn't work. This seems to be fine. But will high Voltage programmer brick this wall?

Note: When I program the above fuse bit. I am unable to disable the RESET or SPI. It says one or more register differ

I want avoid a readback via high voltage programmer too.

I have too many people to steal my code I want to avoid it. Kindly help


  • Why don't you want to disable SPI? – Nick Gammon Dec 9 '17 at 5:45

Locking out programming prevents writing, and locking out verification prevents reading, via all programming methods.

Note that there is no way to prevent erasing the chip, which will clear both the lock bits and the flash.

  • This is not an answer. But a reply to the abive post. So Further programming and verification disabled. Will this option do the job??? Siddharth – siddharth taunk Dec 9 '17 at 4:55
  • That will prevent writing to and reading from the flash memory, just as it says in the datasheet. – Ignacio Vazquez-Abrams Dec 9 '17 at 5:54

"Locking" the chip only has any effect when using one of the hardware programming interfaces. Yes, it prevents anyone with a programmer from reading the data from the chip (verify disabled).

However, it does not stop software on the chip itself from reading the contents of the chip. And that includes the bootloader.

Since you use a bootloader it is possible (if implemented in your bootloader, I am not familiar with what is implemented in Optiboot) to use the bootloader to read the contents of the chip through USB.

To properly protect your software you will have to either remove the bootloader and only program through a hardware programmer or ensure that the bootloader has no method to read or otherwise access the flash memory of the chip (intentional or otherwise).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.