This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

In which cases does NRF_ERROR_SOC_RAND_NOT_ENOUGH_VALUES happen?

Hi there!

The documentation defines two possible return values for sd_rand_application_vector_get NRF_SUCCESS and NRF_ERROR_SOC_RAND_NOT_ENOUGH_VALUES. I am wondering in which cases the latter is returned. The docs themselves are not very specific unfortunately: 

"No bytes were written to the buffer, because there were not enough bytes available."

So I have two questions:

  1. At which rate are new random bytes (roughly) generated?
  2. Does the chip need code control to generate new bytes? In other words could I do something like this:

int err = -1;
uint8_t randomValue;

while(err != NRF_SUCCESS){
    err = sd_rand_application_vector_get(&randomNumber, 1);
}

//Do something with randomValue

or would the chip be stuck inside the loop forever?

Thanks!

Jakob

Related