You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
if (has_otp_info && (boardRevision() >= BOARD_REVISION(4,10))) {
292
+
returntrue;
293
+
}
294
+
if (__HAL_RCC_GET_LPTIM4_SOURCE() == RCC_LPTIM4CLKSOURCE_LSI || bootloaderVersion() < 24) {
295
+
// LSE is either not mounted, imprecise or the BL already configures RTC clock with LSI (and we are doomed)
296
+
returnfalse;
297
+
}
298
+
returntrue;
299
+
}
300
+
238
301
extern"C"voidlp_ticker_reconfigure_with_lsi();
239
302
240
303
voidinitVariant() {
@@ -246,18 +309,28 @@ void initVariant() {
246
309
// Disable the FMC bank1 (enabled after reset)
247
310
// See https://github.com/STMicroelectronics/STM32CubeH7/blob/beced99ac090fece04d1e0eb6648b8075e156c6c/Projects/STM32H747I-DISCO/Applications/OpenAMP/OpenAMP_RTOS_PingPong/Common/Src/system_stm32h7xx.c#L215
248
311
FMC_Bank1_R->BTCR[0] = 0x000030D2;
312
+
313
+
getSecureFlashData();
314
+
if (has_otp_info && (boardRevision() >= BOARD_REVISION(4,10))) {
315
+
// LSE works and also keeps counting in VBAT mode
316
+
return;
317
+
}
318
+
249
319
// Check that the selected lsi clock is ok
250
320
if (__HAL_RCC_GET_LPTIM4_SOURCE() == RCC_LPTIM4CLKSOURCE_LSI) {
251
321
// rtc is not mounted, no need to do other actions
252
322
return;
253
323
}
324
+
254
325
// Use micros() to check the lptim precision
255
326
// if the error is > 1% , reconfigure the clock using lsi
256
327
uint32_t start_ms = millis();
257
328
uint32_t start_us = micros();
258
329
while (micros() - start_us < 100000);
259
330
if (millis() - start_ms != 100) {
260
331
lp_ticker_reconfigure_with_lsi();
332
+
// reconfiguring RTC clock would trigger a backup subsystem reset;
0 commit comments