Give Them No Quarter: Preventing PIC Microcontroller Code from Being Duplicated

Created: December 12, 2017
Updated: December 8, 2020

Copy paste words with keyboard buttons

Copying, from all understandings, seems like a disingenuous and sub-par strategy for any solution you need; from taking a test in school, to catching up with your friends, it is rare to find a moment where you would be rewarded for simply copying a message or answer. Imitating, on the other hand, is an encouraged practice in most professional industries - follow the guidelines and roadwork laid out before you so as to avoid the tedious work of reinventing the wheel for any given task. If copying is punished, and imitating is rewarded, then what’s the difference between the two and how do you protect yourself from incurring future punishments?

From my understanding, imitating is a practice which is there to help you get to a point where you can develop your own strategies, habits, and ideas - not to keep you within certain parameters forever, but to give you an easier understanding of the professional world that you are working in.

But while you are concerned over the debate between copying and imitating and the ethics of each, there are others who may be less concerned about this problem. Take pirates for example. A pirate’s life may not be the life for you, but that won’t stop one from stealing treasured code from your electronics. If you have an electronics product that is strong or selling well, code copying is a hard reality that you need to address with your product. Especially within electronics industries, code piracy from an unscrupulous competitor will hurt your business. Give no quarter to your competitors, and learn how to protect your code with a microchip pic. 

Don't Ignore the Parrot: Use PIC Microcontroller Code Protection

A great part of my engineering career involved designing with PIC microcontrollers. Protecting my code from being copied had not been a priority until I started a design business; there’s simply too much that goes into the process of PCB design and manufacturing for me to have been concerned over one part of this process being compromised. But, after I listened to horror stories of how some electronics businesses suffered huge losses due to piracy issues, I said scupper that and began taking preventative measures in protecting my products.

Reading an unprotected firmware from a PIC microcontroller project is relatively simple. The PIC programmer just needs to ensure the pic micro is connected to the programming header and the raw code can be extracted to a computer via the programming adapter. The resulting file is a hex file that can be easily injected into duplicated hardware. But there are many ways to which you can add protection to this code which will heave any would-be pirate.

Security lock on circuit board
No reason for not turning on the code protection bit

Want to Protect Your Code? Install More Cannons!

PIC code protection should be one of the compiler design priorities from the start. There are various ways to protect your code in your final products and varying accompanying degrees of difficulty to break. Here are a few:

Enable Code Protection Bit: In the PIC microcontroller, there is a pic code protection configuration bit that will prevent read operation on the program flash memory when it is asserted. Turning on this code protection feature is as simple as including a directive in the program before it is being compiled and downloaded to the microcontroller. This is the easiest way of code protection but there are suggestions that there are illegitimate methods that may bypass the security features.

Unique ID Authentication: Instead of preventing the code from being read, this method requires the application to verify itself against a unique ID before launching the main program. It usually requires manual insertion of a secret identification number during the first startup before storing the unique ID from an external pic device to a secured storage. In the case of the code being copied to another hardware, the firmware will not be able to function without the stored unique ID and the secret identification number.

Epoxy Coated: In products where there is no need to update the firmware of the microcontroller, the epoxy coating can be used to physically prevent access to the microcontroller. This is an effective way to not only prevent code piracy but also any attempt to copy and re-engineer the hardware itself. The downside is that the product has limited serviceability if it experienced failure after a period of time.

Self-Destructing : Just like in certain movies where the characters turn kamikaze mode to protect secrets being tortured out of them, self-destructing circuitry can be used in sensitive applications. I’ve worked in a highly sensitive industry changing design where the client insists on a self-destructing microcontroller circuit to prevent any attempt of piracy at all. It uses sensors to detect any illegal attempt to access the hardware and connect the microcontroller to a high voltage source. This is a drastic measure to take and the system may accidentally activate the self-destruct mode if the sensor malfunctions.

A red button with the words self-destruct on it
Last resort for highly sensitive applications

Take the protection of your code seriously, and you'll be sure to keep your treasure from coast to coast. If any of these methods feel inadequate to you, you can also try the tried-and-true method of keying serial-number chips directly, too. Don’t try to pilot your ship across rocky waters, and worry about pirates—make your protection guaranteed. When you need to access an easy-to-use PCB layout tool that includes everything needed to build high-quality manufacturable circuit boards, look no further than CircuitMaker. In addition to easy-to-use PCB design software, all CircuitMaker users have access to a personal workspace on the Altium 365 platform. You can upload and store your design data in the cloud, and you can easily view your projects via your web browser in a secure platform.

Start using CircuitMaker today and stay tuned for the new CircuitMaker Pro from Altium.

Recent Articles

Back to Home