How to set the lock bits for code protection on the Atmega328PU

Hello,

I want to lock my program in the Atmega328PU microcontroller to prevent reading the code either from ISP and with programmers. Please help me how to lock the microcontroller to download/read the uploaded program.

@LarryD Any idea on this?

Google:

Arduino lock bits.

1 Like

Sure will do that and get back to you.

Note that the lock bits will not prevent reading the code via the bootloader.
(But you can omit the bootloader if you use "upload using programmer.")

There may be licensing issues. There was a recent LONG discussion here:

1 Like

I dont remember now the set of fuses, nice memory i have, i readed some times and now cant remember how i need to set the fuses, i think (if i remember good) that If i set the Hfuse bit to 0x00 and LB to C0 the only way to access chip is erasing it, is possible execute the program but cant read the code in any way, and also is locked against reset, and reading via serial or ICSP, just can erase the chip via paralel programmer and high voltage.

Hi @miguelyx,

you seem to have not understood.

Whenever you use any kind of library that is delivered with the Arduino-IDE or any library that you have installed through the librar-manager or that you have downloaded as a ZIP-library you agreed to the terms of the GPL-licence that this library is published.

It is not just free in the sense of "everybody can use it under any conditions."

The licencense terms say: You are only allowed to use these libraries of you do mimimum two things:

  1. make the license of your own work exactly the same as in the used libraries by adding the GPL-licence to your source code

  2. following ALL terms of the license which means
    free access to the source-code

Do you uderstand:
free access to

your source-code.

To say it in other words new:
protecting a code that makes use of any GPL-licensed library is
violating the libraries license

An unethical lawyer could take you to court for licensing violations because you there would be a license-violation

And there is another moralic aspect:

You have taken advantage of the community and its knowledge if you use these libraries.
Now you refuse to "give back" to the community by not making your work accessible to he public.

You should overthink your buissenes-model to find a way that you get payed for work that does not violate the license-terms.

Read this other thread:

best regards Stefan

3 Likes

Whoever seems to not understand anything seems to be not me, read a little before publishing everything that goes through your obtuse mind about wat i need to make.
Ok?

But what about commercial products?

If someone has the ability to decipher machine code that someone has the ability to write the code anew.

1 Like

Even with commercial products you have to follow the licence of software you include. Or you have to program everything from scratch by yourself.

And how @LarryD already wrote - no one can see your sourcecode by reading the machinecode from the flash.

People who could interpret and reverse engineer the machine code could also more easily reprogramme the functionality themselves.

1 Like

Yes but with the hex code we can produce similar products right?

Like what was said, a software person can write the code anew, probably much better and with more features than you or I can write.

1 Like

Yes but this is simple right just burn the hex code and make a new product. Writing code is easy for you but if anyone wants to use direct hex code without any struggles this is the shortcut. What do you say?

Nowadays there are no struggles, suggest it is more of a struggle to pull out the machine code than to rewrite the code from scratch.

Nobody is forcing you to use open source in your products. You can program everything by yourself or buy commercial softwarecomponents from other programmers to include in your software. Then you will get an appropriate licence - but usually not for free ....

[EDIT] And be aware - even if you do not lock the machine code, you must observe the licence of the software you are including. Especially with a commercial product, you need to study all these licences thoroughly. 'Open source' does not mean 'totally free'. There are different licence models for open source.

3 Likes

Its simple, if you are unable to write your own code for your product, than you pay someone else to do it for you.

You are perfectly free to use the lock bits to prevent reading the code off the chip, but the software license requires you to make the source code itself available.

Yeah, the licence stuff is completely independent from setting lockbits or not. And there are obviously people who think they can ignore this ...

Are you saying that setting the lockbits isn't any kind of license violation?