STM32F4 Standard Peripheral bibliotheek  1.0
ST Microelectronics bibliotheek documentatie voor de STM32F4 Standard Peripheral Library
 All Data Structures Files Functions Variables Enumerations Enumerator Groups
Get 32 bit Random number function

Get 32 bit Random number function. More...

Functions

uint32_t RNG_GetRandomNumber (void)
 Returns a 32-bit random number. More...
 

Detailed Description

Get 32 bit Random number function.

 ===============================================================================
                      Get 32 bit Random number function
 ===============================================================================  
  This section provides a function allowing to get the 32 bit Random number  
  
  @note  Before to call this function you have to wait till DRDY flag is set,
         using RNG_GetFlagStatus(RNG_FLAG_DRDY) function. 

Function Documentation

uint32_t RNG_GetRandomNumber ( void  )

Returns a 32-bit random number.

Note
Before to call this function you have to wait till DRDY (data ready) flag is set, using RNG_GetFlagStatus(RNG_FLAG_DRDY) function.
Each time the the Random number data is read (using RNG_GetRandomNumber() function), the RNG_FLAG_DRDY flag is automatically cleared.
In the case of a seed error, the generation of random numbers is interrupted for as long as the SECS bit is '1'. If a number is available in the RNG_DR register, it must not be used because it may not have enough entropy. In this case, it is recommended to clear the SEIS bit(using RNG_ClearFlag(RNG_FLAG_SECS) function), then disable and enable the RNG peripheral (using RNG_Cmd() function) to reinitialize and restart the RNG.
In the case of a clock error, the RNG is no more able to generate random numbers because the PLL48CLK clock is not correct. User have to check that the clock controller is correctly configured to provide the RNG clock and clear the CEIS bit (using RNG_ClearFlag(RNG_FLAG_CECS) function) . The clock error has no impact on the previously generated random numbers, and the RNG_DR register contents can be used.
Parameters
None
Return values
32-bitrandom number.