LPC824 - CRP Doesn't Appear to be Working

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

LPC824 - CRP Doesn't Appear to be Working

Jump to solution
656 Views
kwagner
Contributor II

Hello!

I have an LPC824 microcontroller (LPC824M201JDH20J) and I'm attempting to implement Code Read Protection (CRP). Looking at the microcontroller datasheet, I see that CRP1 can be implemented by writing 0x12345678 to 0x2FC and CRP2 can be implemented by writing 0x87654321 to 0x2FC.

My software release is an .s19 file and I modified memory location 0x2FC of the .s19 file to 0x12345678 and updated the associated checksum in the .s19 file. I programmed the .s19 file to my microcontroller using a Multilink-FX programmer and PROGACMP. After programming, I was able to read back memory location 0x2FC and confirm that it indeed contained 0x12345678. I then power cycled the microcontroller and reconnected using PROGACMP and was able to dump the contents of the microcontroller with no restrictions. I did not expect this to be case with CRP1.

I repeated the same procedure but implemented CRP2 by writing 0x87654321 to 0x2FC. Again, after power cycling, I was able to connect to the microcontroller and dump the contents.

I imagine there is something simple that I'm missing. Any ideas? Any help is appreciated!

Thank you!

0 Kudos
Reply
1 Solution
578 Views
kwagner
Contributor II

Actually, I believe I've figured it out. I went ahead and implemented CRP2 via source to see how it looked in the compiled binary. It looks like it was an issue of endianness.The binary compiled with CRP2 in source looks as follows:

 

kwagner_0-1715706913562.png

View solution in original post

0 Kudos
Reply
4 Replies
583 Views
kwagner
Contributor II

Hi Alex,

Thanks for your reply! For some reason, I'm still running into some issues. After setting the bytes to '87654321' (CRP2) and power cycling the microcontroller, I'm still able to debug through MCUXpresso and I'm still able to read the full memory through PROGACMP.

Looking at the memory, I can see that it is set to '87654321'. Does this look correct to you?

kwagner_0-1715695657199.png

 

Anything else that I could be missing?

Thanks again for your help!

 

0 Kudos
Reply
567 Views
Alex_Wang
NXP Employee
NXP Employee

Hi, @kwagner 

Did you manually change the value of 0x000002FC? It seems to be okay. You can try it by setting CRP in the following ways:

Set it in starup_lpc824.c as follows:

Alex_Wang_0-1715739788495.png

Then download to the development board.

Best regards, Alex

0 Kudos
Reply
579 Views
kwagner
Contributor II

Actually, I believe I've figured it out. I went ahead and implemented CRP2 via source to see how it looked in the compiled binary. It looks like it was an issue of endianness.The binary compiled with CRP2 in source looks as follows:

 

kwagner_0-1715706913562.png

0 Kudos
Reply
614 Views
Alex_Wang
NXP Employee
NXP Employee

Hi, @kwagner 

I used the LPC824 development board to set CRP1 and CRP2. After the setting, I could not burn programs and debug through the IDE, nor could I read any values, and I could erase the whole film through ISP mode. As follows:

Alex_Wang_0-1715162834778.pngAlex_Wang_1-1715162871090.png

The following operations can be performed at different levels:

Alex_Wang_2-1715162940145.png

Best regards, Alex

 

0 Kudos
Reply