@@ -90,6 +90,15 @@ bool isBootloader() {
90
90
return ((uint32_t )& _keep < 0x8040000 );
91
91
}
92
92
93
+ bool isBetaBoard () {
94
+ uint8_t * bootloader_data = (uint8_t * )(0x801F000 );
95
+ if (bootloader_data [0 ] != 0xA0 || bootloader_data [1 ] < 14 ) {
96
+ return true;
97
+ } else {
98
+ return (bootloader_data [10 ] == 27 );
99
+ }
100
+ }
101
+
93
102
#if ( ((CLOCK_SOURCE ) & USE_PLL_HSE_XTAL ) || ((CLOCK_SOURCE ) & USE_PLL_HSE_EXTC ) )
94
103
/******************************************************************************/
95
104
/* PLL (clocked by HSE) used as System clock source */
@@ -112,7 +121,11 @@ uint8_t SetSysClock_PLL_HSE(uint8_t bypass)
112
121
HAL_GPIO_WritePin (GPIOH , GPIO_PIN_1 , 1 );
113
122
114
123
/* Supply configuration update enable */
115
- HAL_PWREx_ConfigSupply (PWR_SMPS_1V8_SUPPLIES_LDO );
124
+ if (isBetaBoard ()) {
125
+ HAL_PWREx_ConfigSupply (PWR_SMPS_1V8_SUPPLIES_EXT );
126
+ } else {
127
+ HAL_PWREx_ConfigSupply (PWR_SMPS_1V8_SUPPLIES_LDO );
128
+ }
116
129
/* Configure the main internal regulator output voltage */
117
130
118
131
if (isBootloader ()) {
@@ -139,6 +152,15 @@ uint8_t SetSysClock_PLL_HSE(uint8_t bypass)
139
152
} else {
140
153
RCC_OscInitStruct .PLL .PLLN = 160 ;
141
154
}
155
+ if (isBetaBoard ()) {
156
+ RCC_OscInitStruct .PLL .PLLM = 9 ;
157
+ if (isBootloader ()) {
158
+ RCC_OscInitStruct .PLL .PLLN = 80 ;
159
+ } else {
160
+ RCC_OscInitStruct .PLL .PLLN = 300 ;
161
+ }
162
+ }
163
+
142
164
RCC_OscInitStruct .PLL .PLLFRACN = 0 ;
143
165
RCC_OscInitStruct .PLL .PLLP = 2 ;
144
166
RCC_OscInitStruct .PLL .PLLR = 2 ;
@@ -195,8 +217,13 @@ uint8_t SetSysClock_PLL_HSI(void)
195
217
RCC_ClkInitTypeDef RCC_ClkInitStruct ;
196
218
RCC_OscInitTypeDef RCC_OscInitStruct ;
197
219
198
- /*!< Supply configuration update enable */
199
- HAL_PWREx_ConfigSupply (PWR_LDO_SUPPLY );
220
+ /* Supply configuration update enable */
221
+ if (isBetaBoard ()) {
222
+ HAL_PWREx_ConfigSupply (PWR_SMPS_1V8_SUPPLIES_EXT );
223
+ } else {
224
+ HAL_PWREx_ConfigSupply (PWR_SMPS_1V8_SUPPLIES_LDO );
225
+ }
226
+
200
227
/* The voltage scaling allows optimizing the power consumption when the device is
201
228
clocked below the maximum system frequency, to update the voltage scaling value
202
229
regarding system frequency refer to product datasheet. */
@@ -211,7 +238,7 @@ uint8_t SetSysClock_PLL_HSI(void)
211
238
RCC_OscInitStruct .PLL .PLLState = RCC_PLL_ON ;
212
239
RCC_OscInitStruct .PLL .PLLSource = RCC_PLLSOURCE_HSI ;
213
240
RCC_OscInitStruct .PLL .PLLM = 8 ;
214
- RCC_OscInitStruct .PLL .PLLN = 113 ;
241
+ RCC_OscInitStruct .PLL .PLLN = 100 ;
215
242
RCC_OscInitStruct .PLL .PLLP = 2 ;
216
243
RCC_OscInitStruct .PLL .PLLQ = 10 ;
217
244
RCC_OscInitStruct .PLL .PLLR = 2 ;
0 commit comments