Saturday, February 22, 2020

2. Using Random Number Generator (RNG)


  • Cortex-M4 features 32 bit RNG
    Steps:
  1. Activating clock for RNG:                                RCC_AHB2PeriphClockCmd(RCC_AHB2Periph_RNG, ENABLE);
  2. Activating the RNG itself:                                                                          RNG_Cmd(ENABLE);
  3. Before calling for random number from RNG, we have to check whether the Data is ready with RNG Flag:                                                                  RNG_GetFlagStatus(RNG_FLAG_DRDY)
  4. Getting generated numbers:                                                                RNG_GetRandomNumber()

    Example:
Random Number Generator | stm32f4xx

No comments:

Post a Comment