LPC80X | looking for Ture random function

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

LPC80X | looking for Ture random function

614 Views
shai_b
Senior Contributor II

Dear team,

I am working on LPC802 and I was looking for secure random function (should provide unique random number each MCU).

I know on the LPC was an RNG driver which provide with true random function, but I did not found such a driver into the lpc802 SDK.

Can you please advise back how do I perform such true random function (with unique seed) with lpc802?

Waiting for your kind feedback, thanks in advance.

Best regards,

Shai Berman

Labels (1)
Tags (1)
0 Kudos
5 Replies

481 Views
sanders7284
Contributor III

Could you possibly use the Unique_ID which each IC has? 

u32 NXP_Unique_ID;

NXP_Unique_ID = Chip_IAP_ReadUID(); //32 bit UID

Byte_ID_3 = NXP_Unique_ID >> 24; //3
Byte_ID_2 = NXP_Unique_ID >> 16; //2
Byte_ID_1 = NXP_Unique_ID >> 8; //1
Byte_ID_0 = NXP_Unique_ID; //0

Regards Sanders7284

474 Views
shai_b
Senior Contributor II

@sanders7284 ,

This sounds like a good option to get a kinda random number so I could seed my rand() function with different seed numbers for each MCU.

Once I will implement that I will let you know if it works.

Thanks a lot.

Kind regards,

Shai

0 Kudos

602 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi, Shai,

Regarding the Random Number Generation, there are two methods to generate the RND number, one is to use RNG hardware module, another is to use pure firmware. But the LPC8xx neither have the RNG module from hardware perspective,  nor have the source code or library in SDK.

I have checked the mbedtls library which is only for Cortex-M4, it has implemented the rand() function.

I attach the example of mbedtls based on LPC54628 which uses Cortex-M4 core.

 

xiangjun_rong_0-1664340753636.png

BR

XiangJun Rong

 

0 Kudos

546 Views
shai_b
Senior Contributor II

@xiangjun_rong ,

Thanks for your comments but using rand(); function will not produce a real true random number.

It's a kind of hash technique that generates a new number (with wrapping) based on the given seed number but it will produce the same "random" number each time.

it's not good for my use case. thanks again for your input.

KR,

Shai

0 Kudos

537 Views
frank_m
Senior Contributor III

A really random value is difficult to achieve, especially on a MCU with relatively little resources.

One of my former companies used noisy input of an ADC for this purpose. This was a 8-bit architecture, though.

Here an article from another vendor as example, for a Cortex M : https://siliconlabs.force.com/community/s/article/generating-an-8-bit-random-number-using-adc?langua...