mirror of https://github.com/ARMmbed/mbed-os.git
STM32F7: allow multiple SetSysClock call
parent
aa6fd58804
commit
0871db277b
|
@ -150,6 +150,11 @@ uint8_t SetSysClock_PLL_HSE(uint8_t bypass)
|
||||||
__PWR_CLK_ENABLE();
|
__PWR_CLK_ENABLE();
|
||||||
__HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1);
|
__HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1);
|
||||||
|
|
||||||
|
// Select HSI as system clock source to allow modification of the PLL configuration
|
||||||
|
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_SYSCLK;
|
||||||
|
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_HSI;
|
||||||
|
HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_0);
|
||||||
|
|
||||||
// Enable HSE oscillator and activate PLL with HSE as source
|
// Enable HSE oscillator and activate PLL with HSE as source
|
||||||
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;
|
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;
|
||||||
if (bypass == 0) {
|
if (bypass == 0) {
|
||||||
|
@ -208,6 +213,11 @@ uint8_t SetSysClock_PLL_HSI(void)
|
||||||
// Enable power clock
|
// Enable power clock
|
||||||
__PWR_CLK_ENABLE();
|
__PWR_CLK_ENABLE();
|
||||||
|
|
||||||
|
// Select HSI as system clock source to allow modification of the PLL configuration
|
||||||
|
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_SYSCLK;
|
||||||
|
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_HSI;
|
||||||
|
HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_0);
|
||||||
|
|
||||||
// Enable HSI oscillator and activate PLL with HSI as source
|
// Enable HSI oscillator and activate PLL with HSI as source
|
||||||
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI;
|
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI;
|
||||||
RCC_OscInitStruct.HSIState = RCC_HSI_ON;
|
RCC_OscInitStruct.HSIState = RCC_HSI_ON;
|
||||||
|
|
|
@ -150,6 +150,11 @@ uint8_t SetSysClock_PLL_HSE(uint8_t bypass)
|
||||||
__PWR_CLK_ENABLE();
|
__PWR_CLK_ENABLE();
|
||||||
__HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1);
|
__HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1);
|
||||||
|
|
||||||
|
// Select HSI as system clock source to allow modification of the PLL configuration
|
||||||
|
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_SYSCLK;
|
||||||
|
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_HSI;
|
||||||
|
HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_0);
|
||||||
|
|
||||||
// Enable HSE oscillator and activate PLL with HSE as source
|
// Enable HSE oscillator and activate PLL with HSE as source
|
||||||
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;
|
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;
|
||||||
if (bypass == 0) {
|
if (bypass == 0) {
|
||||||
|
@ -208,6 +213,11 @@ uint8_t SetSysClock_PLL_HSI(void)
|
||||||
// Enable power clock
|
// Enable power clock
|
||||||
__PWR_CLK_ENABLE();
|
__PWR_CLK_ENABLE();
|
||||||
|
|
||||||
|
// Select HSI as system clock source to allow modification of the PLL configuration
|
||||||
|
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_SYSCLK;
|
||||||
|
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_HSI;
|
||||||
|
HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_0);
|
||||||
|
|
||||||
// Enable HSI oscillator and activate PLL with HSI as source
|
// Enable HSI oscillator and activate PLL with HSI as source
|
||||||
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI;
|
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI;
|
||||||
RCC_OscInitStruct.HSIState = RCC_HSI_ON;
|
RCC_OscInitStruct.HSIState = RCC_HSI_ON;
|
||||||
|
|
|
@ -150,6 +150,11 @@ uint8_t SetSysClock_PLL_HSE(uint8_t bypass)
|
||||||
__PWR_CLK_ENABLE();
|
__PWR_CLK_ENABLE();
|
||||||
__HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1);
|
__HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1);
|
||||||
|
|
||||||
|
// Select HSI as system clock source to allow modification of the PLL configuration
|
||||||
|
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_SYSCLK;
|
||||||
|
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_HSI;
|
||||||
|
HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_0);
|
||||||
|
|
||||||
// Enable HSE oscillator and activate PLL with HSE as source
|
// Enable HSE oscillator and activate PLL with HSE as source
|
||||||
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;
|
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;
|
||||||
if (bypass == 0) {
|
if (bypass == 0) {
|
||||||
|
@ -208,6 +213,11 @@ uint8_t SetSysClock_PLL_HSI(void)
|
||||||
// Enable power clock
|
// Enable power clock
|
||||||
__PWR_CLK_ENABLE();
|
__PWR_CLK_ENABLE();
|
||||||
|
|
||||||
|
// Select HSI as system clock source to allow modification of the PLL configuration
|
||||||
|
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_SYSCLK;
|
||||||
|
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_HSI;
|
||||||
|
HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_0);
|
||||||
|
|
||||||
// Enable HSI oscillator and activate PLL with HSI as source
|
// Enable HSI oscillator and activate PLL with HSI as source
|
||||||
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI;
|
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI;
|
||||||
RCC_OscInitStruct.HSIState = RCC_HSI_ON;
|
RCC_OscInitStruct.HSIState = RCC_HSI_ON;
|
||||||
|
|
|
@ -150,6 +150,11 @@ uint8_t SetSysClock_PLL_HSE(uint8_t bypass)
|
||||||
__PWR_CLK_ENABLE();
|
__PWR_CLK_ENABLE();
|
||||||
__HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1);
|
__HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1);
|
||||||
|
|
||||||
|
// Select HSI as system clock source to allow modification of the PLL configuration
|
||||||
|
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_SYSCLK;
|
||||||
|
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_HSI;
|
||||||
|
HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_0);
|
||||||
|
|
||||||
// Enable HSE oscillator and activate PLL with HSE as source
|
// Enable HSE oscillator and activate PLL with HSE as source
|
||||||
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;
|
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;
|
||||||
if (bypass == 0) {
|
if (bypass == 0) {
|
||||||
|
@ -209,6 +214,11 @@ uint8_t SetSysClock_PLL_HSI(void)
|
||||||
// Enable power clock
|
// Enable power clock
|
||||||
__PWR_CLK_ENABLE();
|
__PWR_CLK_ENABLE();
|
||||||
|
|
||||||
|
// Select HSI as system clock source to allow modification of the PLL configuration
|
||||||
|
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_SYSCLK;
|
||||||
|
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_HSI;
|
||||||
|
HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_0);
|
||||||
|
|
||||||
// Enable HSI oscillator and activate PLL with HSI as source
|
// Enable HSI oscillator and activate PLL with HSI as source
|
||||||
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI;
|
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI;
|
||||||
RCC_OscInitStruct.HSIState = RCC_HSI_ON;
|
RCC_OscInitStruct.HSIState = RCC_HSI_ON;
|
||||||
|
|
|
@ -150,6 +150,11 @@ uint8_t SetSysClock_PLL_HSE(uint8_t bypass)
|
||||||
__PWR_CLK_ENABLE();
|
__PWR_CLK_ENABLE();
|
||||||
__HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1);
|
__HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1);
|
||||||
|
|
||||||
|
// Select HSI as system clock source to allow modification of the PLL configuration
|
||||||
|
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_SYSCLK;
|
||||||
|
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_HSI;
|
||||||
|
HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_0);
|
||||||
|
|
||||||
// Enable HSE oscillator and activate PLL with HSE as source
|
// Enable HSE oscillator and activate PLL with HSE as source
|
||||||
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;
|
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;
|
||||||
if (bypass == 0) {
|
if (bypass == 0) {
|
||||||
|
@ -212,6 +217,11 @@ uint8_t SetSysClock_PLL_HSI(void)
|
||||||
// Enable power clock
|
// Enable power clock
|
||||||
__PWR_CLK_ENABLE();
|
__PWR_CLK_ENABLE();
|
||||||
|
|
||||||
|
// Select HSI as system clock source to allow modification of the PLL configuration
|
||||||
|
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_SYSCLK;
|
||||||
|
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_HSI;
|
||||||
|
HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_0);
|
||||||
|
|
||||||
// Enable HSI oscillator and activate PLL with HSI as source
|
// Enable HSI oscillator and activate PLL with HSI as source
|
||||||
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI;
|
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI;
|
||||||
RCC_OscInitStruct.HSIState = RCC_HSI_ON;
|
RCC_OscInitStruct.HSIState = RCC_HSI_ON;
|
||||||
|
|
Loading…
Reference in New Issue