EmbeddedRelated.com
Forums

Do both 0x87654321 or 0x43218765 enable CRP?

Started by jayasooriah March 2, 2007
Hello,

According to the page 520 of LPC23XX User Manual UM10211 dated 6
October 2006:

"Code read protection is enabled by programming the Flash address
location 0x1FC (User flash sector 0) with value 0x87654321 (2271560481
Decimal)."

However the code segment (below) in the boot loader for LPC2378
appears to also allow 0x43218765 (1126270821 Decimal) to do this.

> @ address of CSP reg
> ldr r2, cspLoc @ =CPSR
>
> @ address of CRP loc
> ldr r3, crpLoc @ =0x01fc
>
> @ fetch CRP word
> @ if (crpWord == 0x43218765)
> @ crpWord = 0x87654321;
> ldr r5, crpAlt @ =0x43218765
> ldr r4, [r3]
> cmp r4, r5
> bne 1f
> ldr r4, crpVal @ =0x87654321
>1:
> @ write to CSP reg
> str r4, [r2]

Can someone LPC2378 verify this?

Regards,

Jaya

An Engineer's Guide to the LPC2100 Series

--- In l..., "jayasooriah" wrote:
>
> Hello,
>
> According to the page 520 of LPC23XX User Manual UM10211 dated 6
> October 2006:
>
> "Code read protection is enabled by programming the Flash address
> location 0x1FC (User flash sector 0) with value 0x87654321 (2271560481
> Decimal)."
>
> However the code segment (below) in the boot loader for LPC2378
> appears to also allow 0x43218765 (1126270821 Decimal) to do this.
>
> > @ address of CSP reg
> > ldr r2, cspLoc @ =CPSR
> >
> > @ address of CRP loc
> > ldr r3, crpLoc @ =0x01fc
> >
> > @ fetch CRP word
> > @ if (crpWord == 0x43218765)
> > @ crpWord = 0x87654321;
> > ldr r5, crpAlt @ =0x43218765
> > ldr r4, [r3]
> > cmp r4, r5
> > bne 1f
> > ldr r4, crpVal @ =0x87654321
> >1:
> > @ write to CSP reg
> > str r4, [r2]
>
> Can someone LPC2378 verify this?
>
> Regards,
>
> Jaya
>
Hi Jaya,

see the Users Manual of the LPC2468 page 567 for the future
implementation which will allow 3 levels of CRP.
With CRP 3 (the value you found is related to CRP3) you or other
customers have the option to disable automatic ISP start. This gives
you much more control but could also render the device unuseable.

NXP APPS
--- In l..., "nxp_apps" wrote:

> Hi Jaya,
>
> see the Users Manual of the LPC2468 page 567 for the future
> implementation which will allow 3 levels of CRP.
> With CRP 3 (the value you found is related to CRP3) you or other
> customers have the option to disable automatic ISP start. This gives
> you much more control but could also render the device unuseable.
>
> NXP APPS

Hi NXP,

Thanks for the quick response.

What happens after users accidentally programmed CRP3 value while
experimenting?

If, for example, this happens with evaluation boards, what can the
users do to recover their boards?

Send it back to the supplier or to NXP perhaps to have it restored?

Regards

Jaya
--- In l..., "jayasooriah" wrote:
>
> --- In l..., "nxp_apps" wrote:
>
> > Hi Jaya,
> >
> > see the Users Manual of the LPC2468 page 567 for the future
> > implementation which will allow 3 levels of CRP.
> > With CRP 3 (the value you found is related to CRP3) you or other
> > customers have the option to disable automatic ISP start. This gives
> > you much more control but could also render the device unuseable.
> >
> > NXP APPS
>
> Hi NXP,
>
> Thanks for the quick response.
>
> What happens after users accidentally programmed CRP3 value while
> experimenting?
>
> If, for example, this happens with evaluation boards, what can the
> users do to recover their boards?
>
> Send it back to the supplier or to NXP perhaps to have it restored?
>
> Regards
>
> Jaya
>

Jaya,

In that case the part becomes useless unless the user code implements
a self erase mechanism and some means to invoke it i.e. pattern on
gpio pins or command via a communication peripheral. Another option is
to use reinvoke_isp (IAP command) instead of self erase mechanism. If
reinvoke_isp is used then the part can be recovered by ISP utility
(erase all sectors). If crp3 is enabled while experimenting there is a
very good chance that the above mentioned mechanism is not implemented
or not functional. Board supplier or NXP can't restore crp3 enabled parts.

The board can be recovered by replacing the crp3 enabled part.

NXP APPS
jayasooriah wrote:
> --- In l..., "nxp_apps" wrote:
>
>
>> Hi Jaya,
>>
>> see the Users Manual of the LPC2468 page 567 for the future
>> implementation which will allow 3 levels of CRP.
>> With CRP 3 (the value you found is related to CRP3) you or other
>> customers have the option to disable automatic ISP start. This gives
>> you much more control but could also render the device unuseable.
>>
>> NXP APPS
>>
>
> Hi NXP,
>
> Thanks for the quick response.
>
> What happens after users accidentally programmed CRP3 value while
> experimenting?
>
> If, for example, this happens with evaluation boards, what can the
> users do to recover their boards?
>
> Send it back to the supplier or to NXP perhaps to have it restored?
>
> Regards
>
> Jaya
>
>

I guess the only way to recover is if the user program has the option to
erase itself (by calling the right IAP routine). That way the bootloader
will start again and you can upload the new software to your board.
Regards,

Richard.
nxp_apps schreef:
> Hi Jaya,
>
> see the Users Manual of the LPC2468 page 567 for the future
> implementation which will allow 3 levels of CRP.
> With CRP 3 (the value you found is related to CRP3) you or other
> customers have the option to disable automatic ISP start. This gives
> you much more control but could also render the device unuseable.
>
> NXP APPS
>
>
Hello NXP Apps,

Will this option be implemented in the firmware for the LPC21xx and
LPC22xx (I'm using the LPC2119 and LPC2292)?

Regards,

Richard.
--- In l..., Richard Duits wrote:
>
> nxp_apps schreef:
> > Hi Jaya,
> >
> > see the Users Manual of the LPC2468 page 567 for the future
> > implementation which will allow 3 levels of CRP.
> > With CRP 3 (the value you found is related to CRP3) you or other
> > customers have the option to disable automatic ISP start. This gives
> > you much more control but could also render the device unuseable.
> >
> > NXP APPS
> >
> >
> Hello NXP Apps,
>
> Will this option be implemented in the firmware for the LPC21xx and
> LPC22xx (I'm using the LPC2119 and LPC2292)?
>
> Regards,
>
> Richard.
>

Hi Richard,

I am hoping not (because of potential problems) but I think NXP's
response "future implementation" suggests it will.

NXP Apps: when will you able confirm one way or another?

Regards,

Jaya