PDA

View Full Version : Code Protection



JoeEvert
- 26th March 2007, 22:16
How do I protect my code from someone reading the device? I am using a PIC16F876A. I want to ensure someone cannot remove the chip to read it. Does doing this impair the ability for microcode studio to program the device?

Thanks,

Joe.

skimask
- 26th March 2007, 22:21
How do I protect my code from someone reading the device? I am using a PIC16F876A. I want to ensure someone cannot remove the chip to read it. Does doing this impair the ability for microcode studio to program the device?

Thanks,

Joe.

Code protection is all in the datasheets.

And no it won't impair Microcode Studio's ability to do anything, 'cause Microcode Studio isn't a PIC programmer. However, no matter what programmer you've got, code protection only affects readback from the PIC. If you try to program over a code protected PIC, generally, the programmer will have to do a complete erasure, thereby erasing any code that was there in the first place.

JoeEvert
- 27th March 2007, 00:21
Yes, I looked at the data sheet, unfortunately it does not discuss the code protection bit in detail. It says it exists but does not discuss what the ramifications are with using it. The datahsheet says this is bit 13 of the configuration word?

Specifically how is this used? If I set the bit to 1 it implies that the code is protected. Is that written at device program time? Is there a directive to indicate this? Specifically I am looking for how to implement this in my code or is this only implemented in the firmware program options.

On the ME programmer there is a code protection option. Does that do the same thing? The application does not remember the setting I choose and appears to default to disabled when it loads.

Thanks,

skimask
- 27th March 2007, 02:15
Yes, I looked at the data sheet, unfortunately it does not discuss the code protection bit in detail. It says it exists but does not discuss what the ramifications are with using it. The datahsheet says this is bit 13 of the configuration word? Specifically how is this used? If I set the bit to 1 it implies that the code is protected. Is that written at device program time? Is there a directive to indicate this? Specifically I am looking for how to implement this in my code or is this only implemented in the firmware program options. On the ME programmer there is a code protection option. Does that do the same thing? The application does not remember the setting I choose and appears to default to disabled when it loads. Thanks,

And the datasheet isn't going to discuss code protection in detail, that's the whole idea. Suffice to say, if you try to read a code protected device the 'normal' way, you'll get garbage.
You set the appropriate config word bit as required. You program the flash, eeprom, id, etc, verify it all, the write the config word. The PIC isn't protected until that config word with that particular config bit is written.
If you're programmer doesn't remember it's settings, either it's not supposed to (hard to believe) or you've got a software problem. Probably something to do with path's or something. I don't have that programmer, I don't know. Generally, I set my bits in the source code, and don't worry about it.

George
- 27th March 2007, 22:10
Just set code protection in your programmer - (blowing fuses) I believe if you want to be very secure you can make a little socket which grounds all the pins except the PGM pin and then apply like 24V to the PGM pin which will render that pin usless.

thetrueman
- 18th May 2008, 02:53
Hi All,

I programmed a 12C508a chip and wrote code in configuration to protect the code. I programmed it with EPIC Programmer Ver2.44 and also set the code protection to all in options menu.

The chip is programmed but not protected. When I Read data in EPIC Programmer, it reads the chip and by menu View code it show the contents of the program in Hex format.

Why it does not protect the chip? Any help in the problem???

Shahzad

skimask
- 18th May 2008, 05:27
I programmed a 12C508a chip and wrote code in configuration to protect the code. I programmed it with EPIC Programmer Ver2.44 and also set the code protection to all in options menu.
Are you sure you didn't set them to ALL OFF?

thetrueman
- 18th May 2008, 09:14
Hi,

Yes while programming at the top of code I confing Code Protect ON and while downloading to chip, in the EPIC programmer software options menu I set Code protection to ALL.

I just read this chip with ALL-100 Universal Programmer and it reads the chip 12C508A. So how to protect the code to be invisible to others???

tenaja
- 18th May 2008, 16:30
Some programmers have a setting to read the config in the hex file or not... maybe your programmer is using default settings.

Acetronics2
- 25th May 2010, 19:55
Hi, Thetrueman

1) could you show us your config settings ( from the program AND read from the chip ).

2) now ... keep cool, but the C series chips are really easy to " crack" ... :o

Alain

Ioannis
- 26th May 2010, 12:18
Hi Alain. I doubt that he still has the code. Its been ... 2 years now!

Were you having any of the fine French wines?

Please do sent me a bottle! :)

Ioannis

Acetronics2
- 26th May 2010, 19:46
Hi, Ioannis,

You're perfectly righ ...

I begin to open the 1989 - 90 vintages ... really nice !!! :D

Alain