I create my own devices using Arduino Nano, program them via ICSP, clear the bootloader and set the Lock Bits to prevent code readout.
Unfortunately, "fake" Arduino Nano's have appeared on aliexpress. These Nano's cannot be programmed via ICSP but only via USB from Arduino IDE.
My question is, if I upload the code from the Arduino IDE to the Nano, then plug it into the USBASP and set the Lock Bits to lock, will my program be inaccessible for cloning?
I don't need to clear the bootloader then I guess?
I can set all options, than i can write them to the chip, and it's keep this settings.
My only problem is that my programs that worked perfectly fine before do not work on these Nano versions.
As if someone wrote that you can't put programs on them via ICSP.
You talk about not being able to program them over ICSP. Do you see any error messages when you try and program them?
I wonder if the Nano clones you have are using an ATMEGA168 chip instead. That device has a different signature than the ATMEGA328P and you should get an error message indicating that the chip signatures do not match if that's the case.
In the past I have used an DS18B20 which has an unique address as "key" to be checked in the setup().
If the key is not present you can either enter an endless while loop or go into a demo mode or display a warning etc.
The address bytes of the DS18 were "encoded" so an hexdump of the image did not reveal them.
Not 100% tight as there are DS18B20 simulators but it worked well enough.
The unique address also allows you to track every individual device you sold etc.
(and you get the temperature for free
Drawback is that you need to program every device individually.
I have been using nano's for years, with the same code, uploaded on ICSP. So far they have worked perfectly. With the new nano's, I load the same program, but it does nothing. It does not control anything. Externally, the new nano's have USB-C connectors, the old ones have micro USB, but since I don't use those connectors, I didn't bother.
There is no Error message. The program goes to it, but the controller does nothing. If I upload this program to an old nano in the same way, it works perfectly.
The chip has 328P on it, but I guess it doesn't mean anything, they can push whatever they want.
Maybe you paid too little and have junk in front of you.
So other sketches work? How about all the test code that you use to determine if your circuit and external parts like sensors and stuff are wired correctly and functional?