View previous topic :: View next topic |
Author |
Message |
CCS-Festina
Joined: 21 Feb 2012 Posts: 11
|
protect microcontroller against reading |
Posted: Tue Mar 20, 2012 2:21 pm |
|
|
hallow
With what method, I protect my program against reading ? ie I want to transfer a program to microcontroller, and in the program, which statement I make, so that will protect against miocrocontroller reading ? |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Tue Mar 20, 2012 3:44 pm |
|
|
Use the PROTECT fuse. |
|
|
CCS-Festina
Joined: 21 Feb 2012 Posts: 11
|
protect |
Posted: Wed Mar 21, 2012 3:04 pm |
|
|
PCM programmer wrote: | Use the PROTECT fuse. |
ie I will write this code
. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19513
|
|
Posted: Wed Mar 21, 2012 3:59 pm |
|
|
Depending on the exact PIC model, there may be other options (to change the memory areas protected etc.).
Verifying the chip once 'protected', needs to be done a special way:
Program the chip _without_this fuse set.
Verify it.
Then set just this fuse with your programmer.
Read the chip back. You will now get a data file that bears no resemblance at all to your code.
Store this.
Now program the chip _with your original code, with the protect fuse set_. Then verify the chip against the file you read back.
The scrambled return file, will always be the same for a correctly programmed chip, but will not work if programmed into a chip.
Remember that with protect on, you can't use a bootloader, and you can't use low voltage programming (only a high voltage 'erase', clears the fuse to allow the chip to be re-written).
Best Wishes |
|
|
CCS-Festina
Joined: 21 Feb 2012 Posts: 11
|
is this formula is just |
Posted: Thu Mar 22, 2012 9:31 am |
|
|
I repeat the question, is this formula is just to protect the microcontroller against reading
|
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19513
|
|
Posted: Thu Mar 22, 2012 9:53 am |
|
|
As I said before:
"Depending on the exact PIC model, there may be other options (to change the memory areas protected etc.). ".
You have not told us what PIC....
On most of the simpler PIC's, 'yes'.
Remember certain things though - if you are using 'DEBUG', or compiling in MPLAB under DEBUG mode, this fuse will be automatically turned _off_, since otherwise debugging cannot be done. You need to be compiling a run time version.
Best Wishes |
|
|
CCS-Festina
Joined: 21 Feb 2012 Posts: 11
|
16f877A |
Posted: Thu Mar 22, 2012 1:33 pm |
|
|
Ttelmah wrote: |
You have not told us what PIC....
|
my PIC is : 16f877A |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9226 Location: Greensville,Ontario
|
|
Posted: Thu Mar 22, 2012 3:20 pm |
|
|
You can see all the valid FUSES as well as predefined defines in the 'header' file located in the devices folder.
16f877a.h
//////// Fuses: LP,XT,HS,RC,NOWDT,WDT,NOPUT,PUT,PROTECT,DEBUG,NODEBUG
//////// Fuses: NOPROTECT,NOBROWNOUT,BROWNOUT,LVP,NOLVP,CPD,NOCPD,WRT_50%
//////// Fuses: NOWRT,WRT_5%,WRT_25%
9th item in the 1st row....PROTECT.... !
hth
jay |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19513
|
|
Posted: Thu Mar 22, 2012 4:27 pm |
|
|
I wonder if the poster is misunderstanding what happens?.
You do realise the chip will still 'read', but what comes back is unuseable. It can't be disassembled to see what code is in the chip, and can't be programmed into another chip.
It's like looking at a book of text after it has been fed through a shredder, and then blended in a mixer. It is still paper, and still has printing on it, but putting it back together, would involve years of work.
Best Wishes |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9226 Location: Greensville,Ontario
|
|
Posted: Thu Mar 22, 2012 5:02 pm |
|
|
Actually if Microchip haven't altered their 'protection' algorithm from the 16C84 days, it's kinda easy to 'reconstruct' the data read back from the PIC into the actual code that was originally stored. |
|
|
bkamen
Joined: 07 Jan 2004 Posts: 1615 Location: Central Illinois, USA
|
|
Posted: Fri Mar 23, 2012 11:08 am |
|
|
I thought they did... I think it comes back all zeros or some such, doesn't it?
-Ben _________________ Dazed and confused? I don't think so. Just "plain lost" will do. :D |
|
|
|