something strange happened after I activate the lockbit

I activated the lockbit of a nano using avrdude in the command line mode. Then when I try to upload my new sketch, it seems not connected. I expect the uploading action in the arduino ide will reset every fuse include the lockbits and overwrite the content except for the bootloader, right? Because the lockbit fuse just prevent people from reading the code without eareasing the flash.

If the regular serial port can't reset the lockbit, will the isp do? Or do I have to buy some tool to write to the chip directly?


You should be able to reprogram the Nano using an ISP programmer. Of the many I’ve used, the best one by far is Pololu’s AVR Programmer V2.1, which does double duty as a serial port adapter.

Depending on the lockbits you can even disable bootloader programming. If you don't and keep the bootloader anyone can read your program.

I believe the lock bits are generally cleared thru High Voltage (12V) programming, in which 12V is applied to the Reset pin for some special functionality.

Nick Gammon has a page with hardware needed a sketch to do it

Unless ISP or reset pin is disabled high voltage is not needed for clearing lock bits.

Lockbits and the fuses that disable ISP programming are not the same thing.

The lockbits are cleared by chip erase, which is performed every time an ISP programmer is used to upload code.

The fuses are not, and those are the ones that could require HV programming to reset.

OP: Please post the exact procedure that you are using and the full text of any and all error messages - otherwise we are fumbling around in the dark. As you can see from the responses above, many of the people answering you would be fumbling around even in broad daylight!

The correct procedure, generally speaking, is to upload the code, then set the lockbits; next tie you upload code via ISP, chip erase will be executed, lockbits cleared, and all will be right with the world.