ECRP Flash value I found in example projects is zero:
__attribute__ ((used, section(".isr_vector")))
void (* const g_pfnVectors[])(void) = {
// Core Level - CM4
&_vStackTop, // The initial stack pointer
ResetISR, // The reset handler
NMI_Handler, // The NMI handler
HardFault_Handler, // The hard fault handler
MemManage_Handler, // The MPU fault handler
BusFault_Handler, // The bus fault handler
UsageFault_Handler, // The usage fault handler
__valid_user_code_checksum, // LPC MCU checksum
0, // ECRP
0, // Reserved
0, // Reserved
From what I understand, zero value allows everything (least restrictive) when CRP_ALLOW_ZERO bit in OTP memory is 0 (factory). It locks everything (most restrictive) when CRP_ALLOW_ZERO bit is set.
Why doesn't NXP use the correct value, indipendently from CRP_ALLOW_ZERO? It should be:
(0x3F << 0) | /* 0 sectors protected */
(0x2 << 10) | /* IAP Sector Erase/Write protection is disabled */
(0x2 << 12) | /* Allow ISP entry via pins */
(0x2 << 14) | /* Allow ISP entry via IAP call */
(0x2 << 16) | /* Enable external access to the chip */
That is 0x0002'A83F.
Hi @giusloq
Please accept my apologies for late response. We are overloaded on the requests these days. I really appreciate your patience.
Regarding your question, it is just to get the lowest restrictive form from factory on the mcu and to get that with more simplicity. But you can tell me what are you trying to do? So I can help you more specifically on your issue.
I will stay tuned to your comments. Please let me know if you have more questions.
Best Regards.
Pablo Avalos.
Regarding your question, it is just to get the lowest restrictive form from factory on the mcu and to get that with more simplicity.
Lowest restrictive if OTP memory is at the factory default, otherwise 0 could be highest restrictive.
But you can tell me what are you trying to do? So I can help you more specifically on your issue.
Nothing special. I was wondering why zero is used for ECRP in examples, considering zero is a "special" value that is considered lowest restrictive only in some cases (factory OTP).