We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 45215c2 + 503777d commit 7cd0126Copy full SHA for 7cd0126
targets/TARGET_STM/trng_api.c
@@ -37,6 +37,21 @@ void trng_init(trng_t *obj)
37
error("Only 1 RNG instance supported\r\n");
38
}
39
40
+#if defined(RCC_PERIPHCLK_RNG)
41
+ RCC_PeriphCLKInitTypeDef PeriphClkInitStruct;
42
+
43
+ /*Select PLLQ output as RNG clock source */
44
+ PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_RNG;
45
+#if ((CLOCK_SOURCE) & USE_PLL_MSI)
46
+ PeriphClkInitStruct.RngClockSelection = RCC_RNGCLKSOURCE_MSI;
47
+#else
48
+ PeriphClkInitStruct.RngClockSelection = RCC_RNGCLKSOURCE_PLL;
49
+#endif
50
+ if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct) != HAL_OK) {
51
+ error("RNG clock configuration error\n");
52
+ }
53
54
55
/* RNG Peripheral clock enable */
56
__HAL_RCC_RNG_CLK_ENABLE();
57
0 commit comments