mirror of https://github.com/ARMmbed/mbed-os.git
Merge pull request #9035 from jeromecoutant/PR_L4TRNG
STM32L4: correct RNG clock sourcepull/9073/head
commit
7cd01266a9
|
@ -37,6 +37,21 @@ void trng_init(trng_t *obj)
|
|||
error("Only 1 RNG instance supported\r\n");
|
||||
}
|
||||
|
||||
#if defined(RCC_PERIPHCLK_RNG)
|
||||
RCC_PeriphCLKInitTypeDef PeriphClkInitStruct;
|
||||
|
||||
/*Select PLLQ output as RNG clock source */
|
||||
PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_RNG;
|
||||
#if ((CLOCK_SOURCE) & USE_PLL_MSI)
|
||||
PeriphClkInitStruct.RngClockSelection = RCC_RNGCLKSOURCE_MSI;
|
||||
#else
|
||||
PeriphClkInitStruct.RngClockSelection = RCC_RNGCLKSOURCE_PLL;
|
||||
#endif
|
||||
if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct) != HAL_OK) {
|
||||
error("RNG clock configuration error\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
/* RNG Peripheral clock enable */
|
||||
__HAL_RCC_RNG_CLK_ENABLE();
|
||||
|
||||
|
|
Loading…
Reference in New Issue