Skip to content

Commit be78084

Browse files
committed
NUCLEO_H743ZI and NUCLEO_H743ZI2: clock configuration cleanup
1 parent 3e45927 commit be78084

File tree

2 files changed

+8
-62
lines changed

2 files changed

+8
-62
lines changed

targets/TARGET_STM/TARGET_STM32H7/TARGET_STM32H743xI/TARGET_NUCLEO_H743ZI/system_clock.c

Lines changed: 4 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -96,28 +96,14 @@ uint8_t SetSysClock_PLL_HSE(uint8_t bypass)
9696
RCC_OscInitTypeDef RCC_OscInitStruct = {0};
9797
RCC_PeriphCLKInitTypeDef PeriphClkInitStruct = {0};
9898

99-
__HAL_RCC_SYSCFG_CLK_ENABLE(); // Mandatory for I/O Compensation Cell
100-
MODIFY_REG(PWR->CR3, PWR_CR3_SCUEN, 0);
101-
102-
103-
/*!< Supply configuration update enable */
104-
// HAL_PWREx_ConfigSupply(PWR_LDO_SUPPLY);
105-
/* The voltage scaling allows optimizing the power consumption when the device is
106-
clocked below the maximum system frequency, to update the voltage scaling value
107-
regarding system frequency refer to product datasheet. */
99+
/* Supply configuration update enable */
100+
HAL_PWREx_ConfigSupply(PWR_LDO_SUPPLY);
101+
/* Configure the main internal regulator output voltage */
108102
__HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1);
109-
while (!__HAL_PWR_GET_FLAG(PWR_FLAG_VOSRDY)) {}
110103

111-
// NEEDED ???
112-
/* Select CSI as system clock source to allow modification of the PLL configuration */
113-
//RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_SYSCLK;
114-
//RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_CSI;
115-
//if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_1) != HAL_OK) {
116-
// return 0; // FAIL
117-
//}
104+
while(!__HAL_PWR_GET_FLAG(PWR_FLAG_VOSRDY)) {}
118105

119106
/* Enable HSE Oscillator and activate PLL with HSE as source */
120-
//RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE | RCC_OSCILLATORTYPE_HSI48;
121107
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE | RCC_OSCILLATORTYPE_HSI48;
122108
if (bypass) {
123109
RCC_OscInitStruct.HSEState = RCC_HSE_BYPASS;
@@ -161,19 +147,6 @@ uint8_t SetSysClock_PLL_HSE(uint8_t bypass)
161147
return 0; // FAIL
162148
}
163149

164-
/* Disable CSI Oscillator */
165-
//RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_CSI;
166-
//RCC_OscInitStruct.CSIState = RCC_CSI_OFF;
167-
//RCC_OscInitStruct.PLL.PLLState = RCC_PLL_NONE;
168-
//if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) {
169-
// return 0;
170-
//}
171-
172-
// NEEDED ???
173-
/* Enables the I/O Compensation Cell */
174-
// __HAL_RCC_CSI_ENABLE(); // Mandatory for I/O Compensation Cell
175-
// HAL_EnableCompensationCell();
176-
177150
return 1; // OK
178151
}
179152
#endif /* ((CLOCK_SOURCE) & USE_PLL_HSE_XTAL) || ((CLOCK_SOURCE) & USE_PLL_HSE_EXTC) */

targets/TARGET_STM/TARGET_STM32H7/TARGET_STM32H743xI/TARGET_NUCLEO_H743ZI2/system_clock.c

Lines changed: 4 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -96,28 +96,14 @@ uint8_t SetSysClock_PLL_HSE(uint8_t bypass)
9696
RCC_OscInitTypeDef RCC_OscInitStruct = {0};
9797
RCC_PeriphCLKInitTypeDef PeriphClkInitStruct = {0};
9898

99-
__HAL_RCC_SYSCFG_CLK_ENABLE(); // Mandatory for I/O Compensation Cell
100-
MODIFY_REG(PWR->CR3, PWR_CR3_SCUEN, 0);
101-
102-
103-
/*!< Supply configuration update enable */
104-
// HAL_PWREx_ConfigSupply(PWR_LDO_SUPPLY);
105-
/* The voltage scaling allows optimizing the power consumption when the device is
106-
clocked below the maximum system frequency, to update the voltage scaling value
107-
regarding system frequency refer to product datasheet. */
99+
/* Supply configuration update enable */
100+
HAL_PWREx_ConfigSupply(PWR_LDO_SUPPLY);
101+
/* Configure the main internal regulator output voltage */
108102
__HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1);
109-
while (!__HAL_PWR_GET_FLAG(PWR_FLAG_VOSRDY)) {}
110103

111-
// NEEDED ???
112-
/* Select CSI as system clock source to allow modification of the PLL configuration */
113-
//RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_SYSCLK;
114-
//RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_CSI;
115-
//if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_1) != HAL_OK) {
116-
// return 0; // FAIL
117-
//}
104+
while(!__HAL_PWR_GET_FLAG(PWR_FLAG_VOSRDY)) {}
118105

119106
/* Enable HSE Oscillator and activate PLL with HSE as source */
120-
//RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE | RCC_OSCILLATORTYPE_HSI48;
121107
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE | RCC_OSCILLATORTYPE_HSI48;
122108
if (bypass) {
123109
RCC_OscInitStruct.HSEState = RCC_HSE_BYPASS;
@@ -161,19 +147,6 @@ uint8_t SetSysClock_PLL_HSE(uint8_t bypass)
161147
return 0; // FAIL
162148
}
163149

164-
/* Disable CSI Oscillator */
165-
//RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_CSI;
166-
//RCC_OscInitStruct.CSIState = RCC_CSI_OFF;
167-
//RCC_OscInitStruct.PLL.PLLState = RCC_PLL_NONE;
168-
//if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) {
169-
// return 0;
170-
//}
171-
172-
// NEEDED ???
173-
/* Enables the I/O Compensation Cell */
174-
// __HAL_RCC_CSI_ENABLE(); // Mandatory for I/O Compensation Cell
175-
// HAL_EnableCompensationCell();
176-
177150
return 1; // OK
178151
}
179152
#endif /* ((CLOCK_SOURCE) & USE_PLL_HSE_XTAL) || ((CLOCK_SOURCE) & USE_PLL_HSE_EXTC) */

0 commit comments

Comments
 (0)