- Cortex-M4 features 32 bit RNG
Steps:
- Activating clock for RNG: RCC_AHB2PeriphClockCmd(RCC_AHB2Periph_RNG, ENABLE);
- Activating the RNG itself: RNG_Cmd(ENABLE);
- Before calling for random number from RNG, we have to check whether the Data is ready with RNG Flag: RNG_GetFlagStatus(RNG_FLAG_DRDY)
- Getting generated numbers: RNG_GetRandomNumber()
Example:
No comments:
Post a Comment