Skip to content

Commit bb824c6

Browse files
committed
mbed-os-tests-mbedtls-selftest issue fixed
1 parent 99bd584 commit bb824c6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

targets/TARGET_ONSEMI/TARGET_NCS36510/ncs36510_trng_api.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
#include "memory_map.h"
3939
#include "ncs36510_trng.h"
4040
#include "clock.h"
41+
#include "wait_api.h"
4142

4243
/*************************************************************************************************
4344
* *
@@ -70,13 +71,12 @@ void trng_free(trng_t *obj)
7071
int trng_get_bytes(trng_t *obj, uint8_t *output, size_t length, size_t *output_length)
7172
{
7273
uint32_t MSLRandom = 0, Index, TempLen, *TempPtr = (uint32_t*)output;
73-
volatile uint32_t delay;
7474

7575
RANDREG->CONTROL.BITS.METASTABLE_LATCH_EN = TRNG_ENABLE; /* ENable MSL TRNG */
7676
RANDREG->CONTROL.BITS.MEATSTABLE_SPEED = TRNG_FAST_MODE; /* Meta-stable Latch TRNG Speed Control */
7777
RANDREG->CONTROL.BITS.MODE = TRNG_ON_READ_EVENT; /* TRNG is only updated on a read event of the TRNG register */
7878

79-
for(uint32_t delay = 0;delay < 0x1F; delay++); /* Wait till generate MSL TRNG after enable for the first time */
79+
wait_us(1); /* Wait till MSL generates random number after enable for the first time */
8080

8181
TempLen = length / 4;
8282

0 commit comments

Comments
 (0)