RM0432 True random number generator (RNG) applied to STM32L4Rxxx and STM32L4Sxxx only
The associated initialization time can be found in
RNGEN=0, then
RNGEN=1
32.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:
–
–
–
Figure 248. RNG initialization overview
1
Noise source
2
Conditioning
hardware init
3
Generate samples
4
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
up to four consecutive times. If valid data is available in the conditioning output
buffer, four additional words can be read by the application (in this case the DRDY
bit is still high). If one or both of above conditions are false, the RNG_DR register
must not be read. If an error occurred error recovery sequence described in
Section 32.3.7
shall be used.
Section 32.5: RNG processing
enable
Drop samples then
Continuous test(s)
not OK
RM0432 Rev 6
check again
Error state
time.
MSv44203V3
1069/2301
1077
Need help?
Do you have a question about the STM32L4+ Series and is the answer not in the manual?