Random number generation takes too long.

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

Random number generation takes too long.

跳至解决方案
478 次查看
liyongfeng
Contributor III

The first execution of random number generation takes 92 ms, whereas the execution time is reduced to dozens of microseconds in all subsequent generations. What causes this difference in execution time?

0 项奖励
回复
1 解答
461 次查看
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi @liyongfeng 

 

This is expected behavior and it is described in HSE Firmware reference manual v2.7, section:

“14.6.12 Delay in processing of first heavy operation after boot”

It’s caused by generation of seed value by true random generator and it cannot be avoided.

Next generations of random number use pseudo random generator which is using that seed. Depending on the RNG class, the reseeding is done periodically as shown in “Table 86. RNG Classes” in the mentioned reference manual.

 

In case of S32K344/324/314, the execution time for seeding depends on HSE clock. It’s about 92ms for 80MHz and about 61ms for 120MHz.

 

In case of other devices, you should see about 40ms mentioned in the manual.

 

Regards,

Lukas

在原帖中查看解决方案

0 项奖励
回复
1 回复
462 次查看
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi @liyongfeng 

 

This is expected behavior and it is described in HSE Firmware reference manual v2.7, section:

“14.6.12 Delay in processing of first heavy operation after boot”

It’s caused by generation of seed value by true random generator and it cannot be avoided.

Next generations of random number use pseudo random generator which is using that seed. Depending on the RNG class, the reseeding is done periodically as shown in “Table 86. RNG Classes” in the mentioned reference manual.

 

In case of S32K344/324/314, the execution time for seeding depends on HSE clock. It’s about 92ms for 80MHz and about 61ms for 120MHz.

 

In case of other devices, you should see about 40ms mentioned in the manual.

 

Regards,

Lukas

0 项奖励
回复
%3CLINGO-SUB%20id%3D%22lingo-sub-2342732%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%E9%9A%8F%E6%9C%BA%E6%95%B0%E7%94%9F%E6%88%90%E6%97%B6%E9%97%B4%E5%A4%AA%E9%95%BF%E3%80%82%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2342732%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3E%E7%AC%AC%E4%B8%80%E6%AC%A1%E6%89%A7%E8%A1%8C%E9%9A%8F%E6%9C%BA%E6%95%B0%E7%94%9F%E6%88%90%E9%9C%80%E8%A6%81%2092%20ms%EF%BC%8C%E8%80%8C%E5%9C%A8%E6%89%80%E6%9C%89%E5%90%8E%E7%BB%AD%E5%87%A0%E4%BB%A3%E4%B8%AD%EF%BC%8C%E6%89%A7%E8%A1%8C%E6%97%B6%E9%97%B4%E7%BC%A9%E7%9F%AD%E5%88%B0%E5%87%A0%E5%8D%81%E5%BE%AE%E7%A7%92%E3%80%82%E6%98%AF%E4%BB%80%E4%B9%88%E9%80%A0%E6%88%90%E4%BA%86%E6%89%A7%E8%A1%8C%E6%97%B6%E9%97%B4%E4%B8%8A%E7%9A%84%E5%B7%AE%E5%BC%82%EF%BC%9F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2343094%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20Random%20number%20generation%20takes%20too%20long.%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2343094%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3E%E4%BD%A0%E5%A5%BD%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F184101%22%20target%3D%22_blank%22%3E%40%E6%A2%81%E5%8B%87%E5%B3%B0%3C%2FA%3E%3C%2FP%3E%0A%3CBR%20%2F%3E%0A%3CP%3E%E8%BF%99%E6%98%AF%E9%A2%84%E6%9C%9F%E7%9A%84%E8%A1%8C%E4%B8%BA%EF%BC%8CHSE%20%E5%9B%BA%E4%BB%B6%E5%8F%82%E8%80%83%E6%89%8B%E5%86%8C%20v2.7%20%E9%83%A8%E5%88%86%E5%AF%B9%E6%AD%A4%E8%BF%9B%E8%A1%8C%E4%BA%86%E6%8F%8F%E8%BF%B0%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