41
41
(+) Configure the AHB and APB buses pre-scalers
42
42
(+) Enable the clock for the peripheral(s) to be used
43
43
(+) Configure the clock kernel source(s) for peripherals which clocks are not
44
- derived from the System clock through :RCC_D1CCIPR,RCC_D2CCIP1R,RCC_D2CCIP2R
45
- and RCC_D3CCIPR registers
44
+ derived from the System clock.
46
45
47
46
##### RCC Limitations #####
48
47
==============================================================================
@@ -193,15 +192,10 @@ static HAL_StatusTypeDef RCC_PLL_Config(uint32_t PLLnumber, const RCC_PLLInitTyp
193
192
HSE and PLL.
194
193
The AHB clock (HCLK) is derived from System core clock through configurable
195
194
pre-scaler and used to clock the CPU, memory and peripherals mapped
196
- on AHB and APB bus of the 3 Domains (D1, D2, D3)* through configurable pre-scalers
195
+ on AHB and APB bus through configurable pre-scalers
197
196
and used to clock the peripherals mapped on these buses. You can use
198
197
"HAL_RCC_GetSysClockFreq()" function to retrieve system clock frequency.
199
198
200
- -@- All the peripheral clocks are derived from the System clock (SYSCLK) except those
201
- with dual clock domain where kernel source clock could be selected through
202
- RCC_D1CCIPR,RCC_D2CCIP1R,RCC_D2CCIP2R and RCC_D3CCIPR registers.
203
-
204
- (*) : 2 Domains (CD and SRD) for stm32h7a3xx and stm32h7b3xx family lines.
205
199
@endverbatim
206
200
* @{
207
201
*/
@@ -248,7 +242,7 @@ HAL_StatusTypeDef HAL_RCC_DeInit(void)
248
242
/* Reset CFGR register (HSI is selected as system clock source) */
249
243
CLEAR_REG (RCC -> CFGR );
250
244
251
- /* Update the SystemCoreClock and SystemD2Clock global variables */
245
+ /* Update the SystemCoreClock global variables */
252
246
SystemCoreClock = HSI_VALUE ;
253
247
254
248
/* Adapt Systick interrupt period */
@@ -874,8 +868,6 @@ HAL_StatusTypeDef HAL_RCC_OscConfig(RCC_OscInitTypeDef *RCC_OscInitStruct)
874
868
* occur when the clock source will be ready.
875
869
* You can use HAL_RCC_GetClockConfig() function to know which clock is
876
870
* currently used as system clock source.
877
- * @note Depending on the device voltage range, the software has to set correctly
878
- * D1CPRE[3:0] bits to ensure that Domain1 core clock not exceed the maximum allowed frequency
879
871
* (for more details refer to section above "Initialization/de-initialization functions")
880
872
* @retval None
881
873
*/
@@ -1255,9 +1247,15 @@ void HAL_RCC_DisableCSS(void)
1255
1247
*/
1256
1248
uint32_t HAL_RCC_GetSysClockFreq (void )
1257
1249
{
1258
- uint32_t pllp , pllsource , pllm , pllfracen , hsivalue ;
1259
- float_t fracn1 , pllvco ;
1260
- uint32_t sysclockfreq , prescaler ;
1250
+ uint32_t pllp ;
1251
+ uint32_t pllsource ;
1252
+ uint32_t pllm ;
1253
+ uint32_t pllfracen ;
1254
+ uint32_t hsivalue ;
1255
+ float_t fracn1 ;
1256
+ float_t pllvco ;
1257
+ uint32_t sysclockfreq ;
1258
+ uint32_t prescaler ;
1261
1259
1262
1260
/* Get SYSCLK source -------------------------------------------------------*/
1263
1261
@@ -1355,7 +1353,8 @@ uint32_t HAL_RCC_GetSysClockFreq(void)
1355
1353
*/
1356
1354
uint32_t HAL_RCC_GetHCLKFreq (void )
1357
1355
{
1358
- uint32_t clock , prescaler ;
1356
+ uint32_t clock ;
1357
+ uint32_t prescaler ;
1359
1358
const uint8_t AHBPrescTable [8 ] = {1U , 2U , 3U , 4U , 6U , 7U , 8U , 9U };
1360
1359
1361
1360
/* SysClk */
@@ -1377,7 +1376,8 @@ uint32_t HAL_RCC_GetHCLKFreq(void)
1377
1376
*/
1378
1377
uint32_t HAL_RCC_GetPCLK1Freq (void )
1379
1378
{
1380
- uint32_t clock , prescaler ;
1379
+ uint32_t clock ;
1380
+ uint32_t prescaler ;
1381
1381
/* Get HCLK source and compute PCLK1 frequency ---------------------------*/
1382
1382
clock = HAL_RCC_GetHCLKFreq ();
1383
1383
/* APB1 prescaler */
@@ -1397,7 +1397,8 @@ uint32_t HAL_RCC_GetPCLK1Freq(void)
1397
1397
*/
1398
1398
uint32_t HAL_RCC_GetPCLK2Freq (void )
1399
1399
{
1400
- uint32_t clock , prescaler ;
1400
+ uint32_t clock ;
1401
+ uint32_t prescaler ;
1401
1402
/* Get HCLK source and compute PCLK2 frequency ---------------------------*/
1402
1403
clock = HAL_RCC_GetHCLKFreq ();
1403
1404
/* APB2 prescaler */
@@ -1417,7 +1418,8 @@ uint32_t HAL_RCC_GetPCLK2Freq(void)
1417
1418
*/
1418
1419
uint32_t HAL_RCC_GetPCLK4Freq (void )
1419
1420
{
1420
- uint32_t clock , prescaler ;
1421
+ uint32_t clock ;
1422
+ uint32_t prescaler ;
1421
1423
/* Get HCLK source and compute PCLK4 frequency ---------------------------*/
1422
1424
clock = HAL_RCC_GetHCLKFreq ();
1423
1425
/* APB4 prescaler */
@@ -1437,7 +1439,8 @@ uint32_t HAL_RCC_GetPCLK4Freq(void)
1437
1439
*/
1438
1440
uint32_t HAL_RCC_GetPCLK5Freq (void )
1439
1441
{
1440
- uint32_t clock , prescaler ;
1442
+ uint32_t clock ;
1443
+ uint32_t prescaler ;
1441
1444
/* Get HCLK source and compute PCLK5 frequency ---------------------------*/
1442
1445
clock = HAL_RCC_GetHCLKFreq ();
1443
1446
/* APB5 prescaler */
@@ -2100,7 +2103,7 @@ static uint32_t RCC_PLL1_GetVCOOutputFreq(void)
2100
2103
uint32_t pllfracn ;
2101
2104
float_t frequency ;
2102
2105
2103
- /* Get PLL1 CFGR and DIVR register values */
2106
+ /* Get PLL1 CKSELR and DIVR register values */
2104
2107
tmpreg1 = RCC -> PLLCKSELR ;
2105
2108
tmpreg2 = RCC -> PLL1DIVR1 ;
2106
2109
@@ -2115,7 +2118,7 @@ static uint32_t RCC_PLL1_GetVCOOutputFreq(void)
2115
2118
}
2116
2119
2117
2120
/* Check if fractional part is enable */
2118
- if ((tmpreg1 & RCC_PLLCFGR_PLL1FRACEN ) != 0U )
2121
+ if ((RCC -> PLLCFGR & RCC_PLLCFGR_PLL1FRACEN ) != 0U )
2119
2122
{
2120
2123
pllfracn = (RCC -> PLL1FRACR & RCC_PLL1FRACR_FRACN ) >> RCC_PLL1FRACR_FRACN_Pos ;
2121
2124
}
@@ -2154,10 +2157,10 @@ static uint32_t RCC_PLL1_GetVCOOutputFreq(void)
2154
2157
pllsrc = 0U ;
2155
2158
break ;
2156
2159
}
2157
-
2160
+
2158
2161
/* Compute VCO output frequency */
2159
2162
frequency = ((float_t )pllsrc / (float_t )pllm ) * ((float_t )plln + ((float_t )pllfracn / (float_t )0x2000U ));
2160
-
2163
+
2161
2164
return (uint32_t )frequency ;
2162
2165
}
2163
2166
@@ -2175,7 +2178,7 @@ static uint32_t RCC_PLL2_GetVCOOutputFreq(void)
2175
2178
uint32_t pllfracn ;
2176
2179
float_t frequency ;
2177
2180
2178
- /* Get PLL2 CFGR and DIVR register values */
2181
+ /* Get PLL2 CKSELR and DIVR register values */
2179
2182
tmpreg1 = RCC -> PLLCKSELR ;
2180
2183
tmpreg2 = RCC -> PLL2DIVR1 ;
2181
2184
@@ -2190,7 +2193,7 @@ static uint32_t RCC_PLL2_GetVCOOutputFreq(void)
2190
2193
}
2191
2194
2192
2195
/* Check if fractional part is enable */
2193
- if ((tmpreg1 & RCC_PLLCFGR_PLL2FRACEN ) != 0U )
2196
+ if ((RCC -> PLLCFGR & RCC_PLLCFGR_PLL2FRACEN ) != 0U )
2194
2197
{
2195
2198
pllfracn = (RCC -> PLL2FRACR & RCC_PLL2FRACR_FRACN ) >> RCC_PLL2FRACR_FRACN_Pos ;
2196
2199
}
@@ -2232,7 +2235,7 @@ static uint32_t RCC_PLL2_GetVCOOutputFreq(void)
2232
2235
2233
2236
/* Compute VCO output frequency */
2234
2237
frequency = ((float_t )pllsrc / (float_t )pllm ) * ((float_t )plln + ((float_t )pllfracn / (float_t )0x2000U ));
2235
-
2238
+
2236
2239
return (uint32_t )frequency ;
2237
2240
}
2238
2241
@@ -2250,7 +2253,7 @@ static uint32_t RCC_PLL3_GetVCOOutputFreq(void)
2250
2253
uint32_t pllfracn ;
2251
2254
float_t frequency ;
2252
2255
2253
- /* Get PLL3 CFGR and DIVR register values */
2256
+ /* Get PLL3 CKSELR and DIVR register values */
2254
2257
tmpreg1 = RCC -> PLLCKSELR ;
2255
2258
tmpreg2 = RCC -> PLL3DIVR1 ;
2256
2259
@@ -2265,7 +2268,7 @@ static uint32_t RCC_PLL3_GetVCOOutputFreq(void)
2265
2268
}
2266
2269
2267
2270
/* Check if fractional part is enable */
2268
- if ((tmpreg1 & RCC_PLLCFGR_PLL3FRACEN ) != 0U )
2271
+ if ((RCC -> PLLCFGR & RCC_PLLCFGR_PLL3FRACEN ) != 0U )
2269
2272
{
2270
2273
pllfracn = (RCC -> PLL3FRACR & RCC_PLL3FRACR_FRACN ) >> RCC_PLL3FRACR_FRACN_Pos ;
2271
2274
}
@@ -2307,7 +2310,7 @@ static uint32_t RCC_PLL3_GetVCOOutputFreq(void)
2307
2310
2308
2311
/* Compute VCO output frequency */
2309
2312
frequency = ((float_t )pllsrc / (float_t )pllm ) * ((float_t )plln + ((float_t )pllfracn / (float_t )0x2000U ));
2310
-
2313
+
2311
2314
return (uint32_t )frequency ;
2312
2315
}
2313
2316
0 commit comments