38 HAL RNG Generic Driver
38.1 RNG Firmware driver registers structures
38.1.1 RNG_HandleTypeDef
Data Fields
RNG_TypeDef * Instance
HAL_LockTypeDef Lock
__IO HAL_RNG_StateTypeDef State
uint32_t RandomNumber
Field Documentation
RNG_TypeDef* RNG_HandleTypeDef::Instance
Register base address
HAL_LockTypeDef RNG_HandleTypeDef::Lock
RNG locking object
__IO HAL_RNG_StateTypeDef RNG_HandleTypeDef::State
RNG communication state
uint32_t RNG_HandleTypeDef::RandomNumber
Last Generated RNG Data
38.2 RNG Firmware driver API description
38.2.1 How to use this driver
The RNG HAL driver can be used as follows:
1. Enable the RNG controller clock using __HAL_RCC_RNG_CLK_ENABLE() macro in
HAL_RNG_MspInit().
2. Activate the RNG peripheral using HAL_RNG_Init() function.
3. Wait until the 32 bit Random Number Generator contains a valid random data using
(polling/interrupt) mode.
4. Get the 32 bit random number using HAL_RNG_GenerateRandomNumber() function.
38.2.2 Initialization and de-initialization functions
This section provides functions allowing to:
Initialize the RNG according to the specified parameters in the RNG_InitTypeDef and
create the associated handle
DeInitialize the RNG peripheral
Initialize the RNG MSP
DeInitialize RNG MSP
This section contains the following APIs:
HAL_RNG_Init()
HAL_RNG_DeInit()
HAL_RNG_MspInit()
HAL_RNG_MspDeInit()