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

sd_rand_application_vector_get

Hi!

I'm using the RNG to encrypt data that I must send via SPI to another module. I'm using the function "sd_rand_application_vector_get", because I'm working with Soft Device 132.

In my first steps, I used the functions of the RNG without SD, and all was working ok, but, when I include SD and I use this function, my application returns to the first line of the code.

To get a 32 bytes random vector, I make this:

for(ii=0; ii<32; ii++){
	length = random_vector_generate(&clave_compartida[ii], RANDOM_BUFF_SIZE);
	dat[ii+1] = clave_compartida[ii];
}

and the function that gets one random byte from the pool:

uint8_t random_vector_generate(uint8_t * p_buff, uint8_t size){
do{
	err_code = sd_rand_application_vector_get(p_buff, size);
}while(err_code != NRF_ERROR_SOC_RAND_NOT_ENOUGH_VALUES);
return size;}

The code returns to the first line when

err_code = sd_rand_application_vector_get(p_buff, size);

is executed. The error code returned, "err_code", is 0x00, but the code breaks anyway.

Do I need to consider something else? Do I skip something in my code, variables, functions...?

Thank you all! Bye!

Parents
  • I don't really understand this. Does the chip reset while inside sd_rand_application_vector_get() or after it has returned? Or is it after your random_vector_generate() function has returned? Why do you not check err_codewith aAPP_ERROR_CHECK()`? (You should always turn off optimization (set it to 0) when debugging, particularly when stepping through the code, if not, you will get nonsense.)

Reply
  • I don't really understand this. Does the chip reset while inside sd_rand_application_vector_get() or after it has returned? Or is it after your random_vector_generate() function has returned? Why do you not check err_codewith aAPP_ERROR_CHECK()`? (You should always turn off optimization (set it to 0) when debugging, particularly when stepping through the code, if not, you will get nonsense.)

Children
No Data
Related