Uniq ID and lock opeartion for OCOTP

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

Uniq ID and lock opeartion for OCOTP

Jump to solution
2,920 Views
emdev
Contributor III

Dear experts,

I have two questions.

1. Someone recommended to use CFG0(0x01), CFG1(0x02) as uniq ID.

    (https://community.nxp.com/t5/i-MX-RT/Read-UID-Unique-ID-on-i-MXRT-RT1050/m-p/1202637)

    There are 4 x 32 bits in TESTERs.

    So I wonder that only 2 x 32 bits can guarantee uniq ID or not.

2.I want to lock some fields(MAC0 and/or MAC1) in OCOTP with lock register, but it can't be done.

  After write MAC0 and/or MAC1, it must be protected from overwriting.

  For this, MAC_ADDR field in HW_OCOTP_LOCK(0x400) must be set.

  2.1 When I write MAC_ADDR field, it can't be written with below code,

  OCOTP->LOCK = OCOTP->LOCK | 0x00000100;

  2.2 There is error and can't be written with below code.

  OCOTP_WriteFuseShadowRegister(OCOTP, 0x00, OCOTP->LOCK | 0x00000100);

  I want to know how I can change Lock register in OCOTP.

  Can Lock register in OCOTP only be changed with "NXP MCU Boot Utility"?

Labels (1)
0 Kudos
Reply
1 Solution
2,808 Views
jingpan
NXP TechSupport
NXP TechSupport

Hi,

When you write mac address lock value, you should only write the value itself, don't write other bit again. Here you should write 0x100, not 0x40128103. 

 

Regards,

Jing

View solution in original post

0 Kudos
Reply
8 Replies
2,901 Views
jingpan
NXP TechSupport
NXP TechSupport

Hi emdev,

1. I'm afraid you can't only use one 32bit register. The unique ID is not meaningless random number. Please see table 22-4 in page 776.

2. You can't write OCOTP->LOCK. It is read only register. The lock bit should be write same as other bit in ocotp. 

 

Regards,

Jing

0 Kudos
Reply
2,896 Views
emdev
Contributor III

Dear Jingpan,

Thanks for your reply.

About answer #1, I can understand what you mean with table 22-4 in page 776.

But I can not understand answer about #2.

I can see below table in page 796.

emdev_0-1611039009622.png

You said OCOTP->LOCK is read only register, but above table tell me that this register is RW.

Anyway, would you let me know how I can lock OCOTP->MAC0, OCOTP->MAC1, OCOTP->GP3?

emdev_1-1611039171130.png

Thanks.

0 Kudos
Reply
2,894 Views
jingpan
NXP TechSupport
NXP TechSupport

Hi,

But if you look into this register, you'll find almost none of its bit can be written.

jingpan_0-1611123409593.png

You can use OCOTP_WriteFuseShadowRegister(...) to program these bits. Please note there is a mapping relationship between shadow register address and efuse address.

 

Regards,

Jing

0 Kudos
Reply
2,873 Views
emdev
Contributor III

Dear Jing,

I used below codes.

regAddr = 0x0;

Lock_value = OCOTP_ReadFuseShadowRegister(OCOTP, regAddr);
PRINTF("Lock value : 0x%2X : 0x%08X\n", regAddr, Lock_value);

Lock_value = Lock_value | 0x00000100;

if (kStatus_Success == OCOTP_WriteFuseShadowRegister(OCOTP, regAddr, Lock_value))
{
PRINTF("OCOTP Write operation success!\r\n");
PRINTF("The new value is 0x%08X\r\n", OCOTP_ReadFuseShadowRegister(OCOTP, regAddr));
}
else
{
PRINTF("OCOTP write operation failed. Access deny!\r\n");
}

I used register address 0x00 for LOCK and I used OCOTP_WriteFuseShadowRegister() to change register value.

But I can see "OCOTP write operation failed. Access deny!".

I checked that OCTP->CTRL value is 0x3E770200.

Would you tell me full example codes to change OCTP->LOCK?

Thanks.

 

 

 

0 Kudos
Reply
2,868 Views
jingpan
NXP TechSupport
NXP TechSupport

Hi,

You code seems fine. What's the read back value of Lock register? The write function report fail is because CTRL[ERROR] bit is 1.  This is the condition of ERROR bit become 1

jingpan_0-1611650004757.png

If you modify the OCOTP example from writing MAC to writing MAC_ADDR lock, can it work?

Can you use MCUBootUtility to read out all fuse map?

Regards,

Jing

 

0 Kudos
Reply
2,860 Views
emdev
Contributor III

Dear Jing,

Below message is output from above test codes.

OCOTP controller version: 0x06000000

Lock value : 0x22 : 0x87654321
Lock value : 0x23 : 0x12345678
Lock value : 0x 0 : 0x40128003
OCOTP write operation failed. Access deny!
Lock value : 0x 0 : 0x40128003

About MCUBootUtility, I can use it.

Would you tell me what I should check with MCUBootUtility?

I'll check it.

Thanks.

 

0 Kudos
Reply
2,809 Views
jingpan
NXP TechSupport
NXP TechSupport

Hi,

When you write mac address lock value, you should only write the value itself, don't write other bit again. Here you should write 0x100, not 0x40128103. 

 

Regards,

Jing

0 Kudos
Reply
2,802 Views
emdev
Contributor III

Dear Jing,

With your guide, I can set Lock controls register.

Thanks.

0 Kudos
Reply