diff options
author | iabdalkader <i.abdalkader@gmail.com> | 2018-04-14 00:11:07 +0200 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2018-04-23 16:43:05 +1000 |
commit | 70a6a15f8c5f8fba9b9fd9b57502e2fd815c6e73 (patch) | |
tree | 65f13fba853333f24bf6ded824be0aa1fe2ee7e0 | |
parent | bdff68db9c1f7e35d0600841647cffac4b1d9ef0 (diff) |
stm32/rng: Set RNG clock source for STM32H7.
-rw-r--r-- | ports/stm32/rng.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/ports/stm32/rng.c b/ports/stm32/rng.c index 85dcc1410..e70eafae7 100644 --- a/ports/stm32/rng.c +++ b/ports/stm32/rng.c @@ -33,6 +33,11 @@ uint32_t rng_get(void) { // Enable the RNG peripheral if it's not already enabled if (!(RNG->CR & RNG_CR_RNGEN)) { + #if defined(STM32H7) + // Set RNG Clock source + __HAL_RCC_PLLCLKOUT_ENABLE(RCC_PLL1_DIVQ); + __HAL_RCC_RNG_CONFIG(RCC_RNGCLKSOURCE_PLL); + #endif __HAL_RCC_RNG_CLK_ENABLE(); RNG->CR |= RNG_CR_RNGEN; } |