GD32F20x User Manual
188
chapter), so that the quality of the
generated random number depends on TRNG_CLK exclusively, no matter what HCLK
frequency was set or not.
The 32-bit value of LFSR will transfer into TRNG_DATA register after a sufficient number of
seeds have been sent to the LFSR.
At the same time, the analog seed and TRNG_CLK clock are monitored. When an analog
seed error or a clock error occurs, the corresponding status bit in TRNG_STAT will be set
and an interrupt is generated if the IE bit in TRNG_CTL is set.
9.3.1.
Operation flow
The following steps are recommended for using TRNG block:
1). Enable the interrupt as necessary, so that when a random number or an error occurs, an
interrupt will be generated.
2). Enable the TRNGEN bit.
3). When an interrupt occurs, check the status register TRGN_STAT, if SEIF=0, CEIF=0 and
DRDY=1, then the random value in the data register could be read.
As required by the FIPS PUB 140-2, the first random data in data register should be saved
but not be used. Every subsequent new random data should be compared to the previously
random data. The data can only be used if it is not equal to the previously one.
9.3.2.
Error flags
(1) Clock Error
When the TRNG_CLK frequency is lower than the 1/16 of HCLK, the CECS and CEIF bit will
be set. In this case, the application should check TRNG_CLK and HCLK frequency
configurations and then clear CEIF bit. Clock error will not impact the previous random data.
(2) Seed Error
When the analog seed is not changed or always changing during 64 TRNG_CLK periods, the
SECS and SEIF bit will be set. In this case, the random data in data register should not be
used. The application needs to clear the SEIF bit, then clear and set TRNGEN bit for restarting
the TRNG.
Содержание GD32F20 Series
Страница 1: ...GigaDevice Semiconductor Inc GD32F20x ARM Cortex M3 32 bit MCU User Manual Revision 2 2 Oct 2019 ...
Страница 191: ...GD32F20x User Manual 191 Bits Fields Descriptions 31 0 TRNDATA 31 0 32 Bit Random data ...
Страница 290: ...GD32F20x User Manual 290 conversion is ongoing ...
Страница 325: ...GD32F20x User Manual 325 15 0 ALRM 15 0 RTC alarm value low ...
Страница 385: ...GD32F20x User Manual 385 ...
Страница 523: ...GD32F20x User Manual 523 clears AERR bit by writing 0 to it ...