K81 - TRNG_GetRandomData hanging

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

K81 - TRNG_GetRandomData hanging

696件の閲覧回数
christian_niels
Contributor I

I am trying to get some random data from K81 hardware and I'm using TRNG_GetRandomData from fsl_trng.c.

I'm using it in connection with :

//***********************************************************************************************************

return_code = mbedtls_rsa_rsaes_pkcs1_v15_encrypt(key, trng_ctr_drbg_random, NULL, MBEDTLS_RSA_PUBLIC, sizeof(_pers_kbpk), (const uint8_t*)&_pers_kbpk.data, enc_pers_kbpk_ptr);

static int trng_ctr_drbg_random(void* notused, unsigned char* output, size_t output_len)
{
    return ( TRNG_GetRandomData(TRNG0, output, output_len) );
}

//***********************************************************************************************************

In TRNG_GetRandomData it hangs in the check while loop:

while ((TRNG_RD_MCTL_ENT_VAL(base) == 0) && (TRNG_RD_MCTL_ERR(base) == 0))
{
}

and never gets out.
If I run debug one step at a time it works perfect but if it runs normal it hangs.
Is there a workaround for this issue ?

It is configured with TRNG_Init and default config.

uint32_t trng_enable()
{
   trng_config_t trngConfig;

   TRNG_GetDefaultConfig(&trngConfig);
   trngConfig.sampleMode = kTRNG_SampleModeVonNeumann;

   return (TRNG_Init(TRNG0, &trngConfig));
}

0 件の賞賛
返信
1 返信

656件の閲覧回数
jingpan
NXP TechSupport
NXP TechSupport

Hi Christian,

I can't reproduce you problem at my board. Did you try the trng example in the SDK?

 

Regards,

Jing

0 件の賞賛
返信