B-LO72Z-LRWAN1 HAL_RNG
Hi
I am trying to generate a true random number on the B-LO72Z-LRWAN1 using the HAL_RNG_GenerateRandomNumber function with the code below:
uint32_t rnd_generator (void) {
RNG_HandleTypeDef RngHandle; // RNG handler declaration
uint32_t rv;
RngHandle.Instance = RNG;
if (HAL_RNG_Init(&RngHandle) != HAL_OK) {
printf ("\n Error RNG_Init \n");
}
if (HAL_RNG_GenerateRandomNumber(&RngHandle, &rv) != HAL_OK) {
printf ("\n Error RNG_Generate \n");
}
HAL_RNG_DeInit(&RngHandle);
return rv;
}
The HAL_RNG_GenerateRandomNumber always returns an error and the generated number is always the same.
I believe that I must initialize the clock for the RND module using my own version of the HAL_RNG_MspInit and HAL_RNG_MspDeInit functions.
Can you provide me some help on this?
BR
Gilberto
