RM0440
Note:
The clock error has no impact on generated random numbers, i.e. application can still read
RNG_DR register.
CEIS is set only when CECS is set to "1" by RNG.
Noise source error detection
When a noise source (or seed) error occurs, the RNG stops generating random numbers
and sets to "1" both SEIS and SECS bits to indicate that a seed error occurred. If a value is
available in the RNG_DR register, it must not be used as it may not have enough entropy. If
the error was detected during the initialization phase the whole initialization sequence will
be automatically restarted by the RNG.
The following sequence shall be used to fully recover from a seed error after the RNG
initialization:
1.
Clear the SEIS bit by writing it to "0".
2.
Read out 12 words from the RNG_DR register, and discard each of them in order to
clean the pipeline.
3.
Confirm that SEIS is still cleared. Random number generation is back to normal.
25.3.8
RNG low-power usage
If power consumption is a concern, the RNG can be disabled as soon as the DRDY bit is set
to "1" by setting the RNGEN bit to "0" in the RNG_CR register. As the post-processing logic
and the output buffer remain operational while RNGEN='0' following features are available
to software:
•
If there are valid words in the output buffer four random numbers can still be read from
the RNG_DR register.
•
If there are valid bits in the conditioning output internal register four additional random
numbers can be still be read from the RNG_DR register. If it is not the case the RNG
must be re-enabled by the application until at least 32 new bits have been collected
from the noise source and a complete conditioning round has been done. It
corresponds to 16 RNG clock cycles to sample new bits, and 216 AHB clock cycles to
run a conditioning round.
When disabling the RNG the user deactivates all the analog seed generators, whose power
consumption is given in the datasheet electrical characteristics section. The user also gates
all the logic clocked by the RNG clock. Note that this strategy is adding latency before a
random sample is available on the RNG_DR register, because of the RNG initialization time.
If the RNG block is disabled during initialization (i.e. well before the DRDY bit rises for the
first time), the initialization sequence will resume from where it was stopped when RNGEN
bit is set to "1".
25.4
RNG interrupts
In the RNG an interrupt can be produced on the following events:
•
Data ready flag
•
Seed error, see
•
Clock error, see
Dedicated interrupt enable control bits are available as shown in
Section 25.3.7: Error management
Section 25.3.7: Error management
RM0440 Rev 1
True random number generator (RNG)
Table
198.
795/2083
800
Need help?
Do you have a question about the STM32G4 Series and is the answer not in the manual?