
DocID024597 Rev 5
811/1830
RM0351
True Random Number Generator (RNG)
816
27.3.4 RNG
initialization
When a hardware reset occurs the following chain of events occurs:
1.
The analog noise source is enabled, and logic starts sampling the analog output after
four RNG clock cycles, filling LFSR shift register and associated 16-bit post-processing
shift register.
2. The output buffer is refilled automatically according to the RNG usage.
The associated initialization time can be found in
Section 27.6: RNG processing time
27.3.5 RNG
operation
Normal operations
To run the RNG using interrupts the following steps are recommended:
1.
Enable the interrupts by setting the IE bit in the RNG_CR register. At the same time
enable the RNG by setting the bit RNGEN=1.
2. An interrupt is now generated when a random number is ready or when an error
occurs. Therefore at each interrupt, check that:
–
No error occurred. The SEIS and CEIS bits should be set to ‘0’ in the RNG_SR
register.
–
A random number is ready. The DRDY bit must be set to ‘1’ in the RNG_SR
register.
–
If above two conditions are true the content of the RNG_DR register can be read.
To run the RNG in polling mode following steps are recommended:
1.
Enable the random number generation by setting the RNGEN bit to “1” in the RNG_CR
register.
2. Read the RNG_SR register and check that:
–
No error occurred (the SEIS and CEIS bits should be set to ‘0’)
–
A random number is ready (the DRDY bit should be set to ‘1’)
3. If above conditions are true read the content of the RNG_DR register.
Note:
When data is not ready (DRDY=”0”) RNG_DR returns zero.
Low-power operations
If the power consumption is a concern to the application, low-power strategies can be used,
as described in
Section 27.4: RNG low-power usage on page 812
Software post-processing
If a NIST approved DRBG with 128 bits of security strength is required an approved random
generator software must be built around the RNG true random number generator.
27.3.6 RNG
clocking
The RNG runs on two different clocks: the AHB bus clock and a dedicated RNG clock.
The AHB clock is used to clock the AHB banked registers and the post-processing
component. The RNG clock is used for noise source sampling. Recommended clock
configurations are detailed in