Skip to content

Commit bec0296

Browse files
committed
chore: configure the clock recovery system for STM32H723ZGT
Signed-off-by: Frederic Pillon <frederic.pillon@st.com>
1 parent dd2385f commit bec0296

File tree

2 files changed

+45
-0
lines changed

2 files changed

+45
-0
lines changed

variants/STM32H7xx/H723Z(E-G)T_H730ZBT_H733ZGT/generic_clock.c

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ WEAK void SystemClock_Config(void)
2424
RCC_OscInitTypeDef RCC_OscInitStruct = {};
2525
RCC_ClkInitTypeDef RCC_ClkInitStruct = {};
2626
RCC_PeriphCLKInitTypeDef PeriphClkInitStruct = {};
27+
RCC_CRSInitTypeDef RCC_CRSInitStruct = {};
2728

2829
/** Supply configuration update enable
2930
*/
@@ -89,5 +90,27 @@ WEAK void SystemClock_Config(void)
8990
if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct) != HAL_OK) {
9091
Error_Handler();
9192
}
93+
94+
/*Configure the clock recovery system (CRS)**********************************/
95+
96+
/*Enable CRS Clock*/
97+
__HAL_RCC_CRS_CLK_ENABLE();
98+
99+
/* Default Synchro Signal division factor (not divided) */
100+
RCC_CRSInitStruct.Prescaler = RCC_CRS_SYNC_DIV1;
101+
102+
/* Set the SYNCSRC[1:0] bits according to CRS_Source value */
103+
RCC_CRSInitStruct.Source = RCC_CRS_SYNC_SOURCE_USB1;
104+
105+
/* HSI48 is synchronized with USB SOF at 1KHz rate */
106+
RCC_CRSInitStruct.ReloadValue = RCC_CRS_RELOADVALUE_DEFAULT;
107+
RCC_CRSInitStruct.ErrorLimitValue = RCC_CRS_ERRORLIMIT_DEFAULT;
108+
RCC_CRSInitStruct.Polarity = RCC_CRS_SYNC_POLARITY_RISING;
109+
110+
/* Set the TRIM[5:0] to the default value */
111+
RCC_CRSInitStruct.HSI48CalibrationValue = RCC_CRS_HSI48CALIBRATION_DEFAULT;
112+
113+
/* Start automatic synchronization */
114+
HAL_RCCEx_CRSConfig(&RCC_CRSInitStruct);
92115
}
93116
#endif /* ARDUINO_GENERIC_* */

variants/STM32H7xx/H723Z(E-G)T_H730ZBT_H733ZGT/variant_NUCLEO_H723ZG.cpp

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,7 @@ WEAK void SystemClock_Config(void)
184184
RCC_OscInitTypeDef RCC_OscInitStruct = {};
185185
RCC_ClkInitTypeDef RCC_ClkInitStruct = {};
186186
RCC_PeriphCLKInitTypeDef PeriphClkInitStruct = {};
187+
RCC_CRSInitTypeDef RCC_CRSInitStruct = {};
187188

188189
/** Supply configuration update enable
189190
*/
@@ -249,6 +250,27 @@ WEAK void SystemClock_Config(void)
249250
Error_Handler();
250251
}
251252

253+
/*Configure the clock recovery system (CRS)**********************************/
254+
255+
/*Enable CRS Clock*/
256+
__HAL_RCC_CRS_CLK_ENABLE();
257+
258+
/* Default Synchro Signal division factor (not divided) */
259+
RCC_CRSInitStruct.Prescaler = RCC_CRS_SYNC_DIV1;
260+
261+
/* Set the SYNCSRC[1:0] bits according to CRS_Source value */
262+
RCC_CRSInitStruct.Source = RCC_CRS_SYNC_SOURCE_USB1;
263+
264+
/* HSI48 is synchronized with USB SOF at 1KHz rate */
265+
RCC_CRSInitStruct.ReloadValue = RCC_CRS_RELOADVALUE_DEFAULT;
266+
RCC_CRSInitStruct.ErrorLimitValue = RCC_CRS_ERRORLIMIT_DEFAULT;
267+
RCC_CRSInitStruct.Polarity = RCC_CRS_SYNC_POLARITY_RISING;
268+
269+
/* Set the TRIM[5:0] to the default value */
270+
RCC_CRSInitStruct.HSI48CalibrationValue = RCC_CRS_HSI48CALIBRATION_DEFAULT;
271+
272+
/* Start automatic synchronization */
273+
HAL_RCCEx_CRSConfig(&RCC_CRSInitStruct);
252274
}
253275

254276
#ifdef __cplusplus

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy