Using CP (code protection) in PIC and EEPROM

Discuss PIC and electronic related things

Moderators: David Barker, Jerry Messina

Post Reply
liak
Registered User
Registered User
Posts: 195
Joined: Fri Oct 05, 2007 12:26 am

Using CP (code protection) in PIC and EEPROM

Post by liak » Fri Mar 28, 2008 3:58 am

Dear all,

I would like to ask regarding CP feature of both PIC and EEPROM.
I understand that we are able to protect our code from being read by a programmer (presumably some copycat). Both EEPROM and PIC from microchip allow us to do so, right? Can anyone give some outline on how to enable this feature in SF? I am not sure which FUSE option to use.
Is the procedure same for EEPROM? If not, how to enable this feature on EEPROM?
And I am of the impression that once CP is enabled, you cannot reprogram the PIC / EEPROM again is it right --> burned permanently (that's why I haven't monkeying around with it yet.)?

Please clear my doubts.
Thanks again. :o

User avatar
octal
Registered User
Registered User
Posts: 586
Joined: Thu Jan 11, 2007 12:49 pm
Location: Paris IDF
Contact:

Re: Using CP (code protection) in PIC and EEPROM

Post by octal » Fri Mar 28, 2008 7:07 am

liak wrote:
Both EEPROM and PIC from microchip allow us to do so, right?
Depends on the PIC chip you are using. Some of them does not permit EEprom protection, ... Most of them let you protect ALL or SOME blocs from CODE memory. For EEProm, I did not checked all 18F serie, but if I remember, on some chips you can not protect ALL blocs. (on 16F series, on most chips you can protect ONLY CODE memory and not the EEProm).

liak wrote:Dear all,

Can anyone give some outline on how to enable this feature in SF? I am not sure which FUSE option to use.
Is the procedure same for EEPROM? If not, how to enable this feature on EEPROM?
The technique is almost the same for CODE and EEProm, as code protection is activated by setting some fuses in the CONFIG register.
As for a general procedure, as usuaally with Microchip, you should and MUST check each time the datasheet of your chip.
For the 18F425 for example, download the datasheet from Microchip site and see page 199 on the PDF, it describes the CONFIGH/CONFIGL registers bits and associated blocs that can be protected.

liak wrote: And I am of the impression that once CP is enabled, you cannot reprogram the PIC / EEPROM again is it right --> burned permanently (that's why I haven't monkeying around with it yet.)?
No, if CP is activated, you simply can not READ the content of protected blocs (it reads always "$00"). This has the consequence of that if you always use PROGRAM AND VERIFY on your programmer, this latter will program correctly but state that verifying failed because with CP it always reads 0 (this was the case with ICProg for example). Some more intelligent softwares writes and verifies programed chip, and delay writing protection fuses (config word) at final stage ;)

As for BURNED PERMANENTLY, this can not happen on FLASH series of PIC. Flash serie is always erasable. You can not read write protected ones (reads always 0), but you can still erase full chip. Note that you can not change only the config word (to disable CP fuses for example :o ), modifiying CONFIG word erases full chip if code protection fuses are activated.

Regards
octal

liak
Registered User
Registered User
Posts: 195
Joined: Fri Oct 05, 2007 12:26 am

Post by liak » Sat Mar 29, 2008 5:27 am

Thanks for all the info. I will study it and come back to you if I have further doubts. Thanks. :)

Post Reply