Hi,
I am using the CC1350 7x7 package and are trying to get the TRNG from driverlib/trng.h to work as it should.
Right now it do work, but it takes aproximately 345 ms to get the random number. I have tried on another chip (CC1350 EM module from TI) where almost all of the code is similar and my trng code works there.
The code shall generate a random reconnect timeout, thus I want speed over entropy.
void TRNG_Init(void)
{
PRCMPowerDomainOn(PRCM_DOMAIN_PERIPH);
while ((PRCMPowerDomainStatus(PRCM_DOMAIN_PERIPH) != PRCM_DOMAIN_POWER_ON));
PRCMPeripheralRunEnable(PRCM_PERIPH_TRNG);
PRCMLoadSet();
while( ! PRCMLoadGet() );
TRNGConfigure(0, 2^8, 0);
TRNGEnable();
}
void TRNG_Deinit(void)
{
TRNGDisable();
PRCMPeripheralRunDisable(PRCM_PERIPH_TRNG);
PRCMLoadSet();
while( ! PRCMLoadGet() );
}
uint32_t TRNG_GetRandomNumber(void)
{
while (!(TRNGStatusGet() & TRNG_NUMBER_READY))
{
WATCHDOG_Kick();
}
return TRNGNumberGet(DTTRNG_HI_OR_LOW_WORD);
}
From application:
TRNG_Init(); uint32_t reconnect = TRNG_GetRandomNumber(); // This call takes 345 ms
All help appreciated
Best regard Kai André