Skip to content

Commit 5069c73

Browse files
committed
Add Periphclock enable for L476 products
1 parent 24832ca commit 5069c73

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

hal/targets/hal/TARGET_STM/TARGET_STM32L4/entropy_hardware_poll.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,12 @@ int mbedtls_hardware_poll( void *data, unsigned char *output, size_t len, size_t
4848
{
4949
int ret;
5050
((void) data);
51+
RCC_PeriphCLKInitTypeDef PeriphClkInitStruct;
52+
53+
/*Select PLLQ output as RNG clock source */
54+
PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_RNG;
55+
PeriphClkInitStruct.RngClockSelection = RCC_RNGCLKSOURCE_PLL;
56+
HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct);
5157

5258
/* RNG Peripheral clock enable */
5359
__HAL_RCC_RNG_CLK_ENABLE();
@@ -73,7 +79,6 @@ int mbedtls_hardware_poll( void *data, unsigned char *output, size_t len, size_t
7379
/* RNG Peripheral clock disable - assume we're the only users of RNG */
7480
__HAL_RCC_RNG_CLK_DISABLE();
7581

76-
7782
return( ret );
7883
}
7984

0 commit comments

Comments
 (0)