Skip to content

Commit c137a16

Browse files
committed
Remove Meowbit LSE flag, harsher failure for LSE issues
1 parent 5771be9 commit c137a16

File tree

4 files changed

+10
-44
lines changed

4 files changed

+10
-44
lines changed

ports/stm/boards/meowbit_v121/mpconfigboard.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,7 @@
3636
#define BOARD_FLASH_SIZE (FLASH_SIZE - 0x4000)
3737

3838
#define HSE_VALUE ((uint32_t)12000000U)
39-
#define LSE_VALUE ((uint32_t)32000U)
40-
#define BOARD_HAS_LOW_SPEED_CRYSTAL (1)
39+
#define BOARD_HAS_LOW_SPEED_CRYSTAL (0)
4140

4241
#define BOARD_NO_VBUS_SENSE (1)
4342
#define BOARD_VTOR_DEFER (1) //Leave VTOR relocation to bootloader

ports/stm/peripherals/stm32f4/clocks.c

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ void stm32_peripherals_clocks_init(void) {
4949
RCC_ClkInitTypeDef RCC_ClkInitStruct;
5050
RCC_OscInitTypeDef RCC_OscInitStruct;
5151
RCC_PeriphCLKInitTypeDef PeriphClkInitStruct;
52-
bool lse_failure = false;
5352

5453
// Set voltage scaling in accordance with system clock speed
5554
__HAL_RCC_PWR_CLK_ENABLE();
@@ -76,15 +75,9 @@ void stm32_peripherals_clocks_init(void) {
7675
#endif
7776

7877
if(HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) {
79-
// Failure likely means a LSE issue - attempt to swap to LSI, and set to crash
80-
RCC_OscInitStruct.LSEState = RCC_LSE_OFF;
81-
RCC_OscInitStruct.OscillatorType |= RCC_OSCILLATORTYPE_LSI;
82-
RCC_OscInitStruct.LSIState = RCC_LSI_ON;
83-
if(HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) {
84-
// No HSE means no USB, so just fail forever
85-
while(1);
86-
}
87-
lse_failure = true;
78+
// Clock issues are too problematic to even attempt recovery.
79+
// If you end up here, check whether your LSE settings match your board.
80+
while(1);
8881
}
8982

9083
// Configure bus clock sources and divisors
@@ -113,8 +106,4 @@ void stm32_peripherals_clocks_init(void) {
113106
#endif
114107

115108
HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct);
116-
117-
if (lse_failure) {
118-
reset_into_safe_mode(HARD_CRASH); //TODO: make safe mode category CLOCK_FAULT?
119-
}
120109
}

ports/stm/peripherals/stm32f7/clocks.c

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ void stm32_peripherals_clocks_init(void) {
4040
RCC_ClkInitTypeDef RCC_ClkInitStruct;
4141
RCC_OscInitTypeDef RCC_OscInitStruct;
4242
RCC_PeriphCLKInitTypeDef PeriphClkInitStruct;
43-
bool lse_failure = false;
4443

4544
// Configure LSE Drive
4645
HAL_PWR_EnableBkUpAccess();
@@ -68,15 +67,9 @@ void stm32_peripherals_clocks_init(void) {
6867
RCC_OscInitStruct.PLL.PLLQ = CPY_CLK_PLLQ;
6968

7069
if(HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) {
71-
// Failure likely means a LSE issue - attempt to swap to LSI, and set to crash
72-
RCC_OscInitStruct.LSEState = RCC_LSE_OFF;
73-
RCC_OscInitStruct.OscillatorType |= RCC_OSCILLATORTYPE_LSI;
74-
RCC_OscInitStruct.LSIState = RCC_LSI_ON;
75-
if(HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) {
76-
// No HSE means no USB, so just fail forever
77-
while(1);
78-
}
79-
lse_failure = true;
70+
// Clock issues are too problematic to even attempt recovery.
71+
// If you end up here, check whether your LSE settings match your board.
72+
while(1);
8073
}
8174

8275
/* Activate the OverDrive to reach the 216 MHz Frequency */
@@ -111,8 +104,4 @@ void stm32_peripherals_clocks_init(void) {
111104
#endif
112105

113106
HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct);
114-
115-
if (lse_failure) {
116-
reset_into_safe_mode(HARD_CRASH); //TODO: make safe mode category CLOCK_FAULT?
117-
}
118107
}

ports/stm/peripherals/stm32h7/clocks.c

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ void stm32_peripherals_clocks_init(void) {
3737
RCC_OscInitTypeDef RCC_OscInitStruct = {0};
3838
RCC_ClkInitTypeDef RCC_ClkInitStruct = {0};
3939
RCC_PeriphCLKInitTypeDef PeriphClkInitStruct = {0};
40-
bool lse_failure = false;
4140

4241
// Set voltage scaling in accordance with system clock speed
4342
HAL_PWREx_ConfigSupply(PWR_LDO_SUPPLY);
@@ -73,15 +72,9 @@ void stm32_peripherals_clocks_init(void) {
7372
RCC_OscInitStruct.PLL.PLLVCOSEL = RCC_PLL1VCOWIDE;
7473
RCC_OscInitStruct.PLL.PLLFRACN = 0;
7574
if(HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) {
76-
// Failure likely means a LSE issue - attempt to swap to LSI, and set to crash
77-
RCC_OscInitStruct.LSEState = RCC_LSE_OFF;
78-
RCC_OscInitStruct.OscillatorType |= RCC_OSCILLATORTYPE_LSI;
79-
RCC_OscInitStruct.LSIState = RCC_LSI_ON;
80-
if(HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) {
81-
// No HSE means no USB, so just fail forever
82-
while(1);
83-
}
84-
lse_failure = true;
75+
// Clock issues are too problematic to even attempt recovery.
76+
// If you end up here, check whether your LSE settings match your board.
77+
while(1);
8578
}
8679

8780
// Configure bus clock sources and divisors
@@ -116,8 +109,4 @@ void stm32_peripherals_clocks_init(void) {
116109

117110
// Enable USB Voltage detector
118111
HAL_PWREx_EnableUSBVoltageDetector();
119-
120-
if (lse_failure) {
121-
reset_into_safe_mode(HARD_CRASH); //TODO: make safe mode category CLOCK_FAULT?
122-
}
123112
}

0 commit comments

Comments
 (0)