8000 Merge pull request #3009 from hierophect/stm32-LSE-startup-fix · adafruit/circuitpython@004d644 · GitHub 8000
[go: up one dir, main page]

Skip to content

Commit 004d644

Browse files
authored
Merge pull request #3009 from hierophect/stm32-LSE-startup-fix
STM32: Rework LSE clock init, allow clock overrides
2 parents 6ff7e25 + ad0971f commit 004d644

File tree

37 files changed

+955
-668
lines changed

37 files changed

+955
-668
lines changed

ports/stm/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,11 +207,11 @@ SRC_C += \
207207
mphalport.c \
208208
boards/$(BOARD)/board.c \
209209
boards/$(BOARD)/pins.c \
210+
peripherals/stm32$(MCU_SERIES_LOWER)/clocks.c \
210211
peripherals/stm32$(MCU_SERIES_LOWER)/$(MCU_VARIANT_LOWER)/pins.c \
211-
peripherals/stm32$(MCU_SERIES_LOWER)/$(MCU_VARIANT_LOWER)/clocks.c \
212212
peripherals/stm32$(MCU_SERIES_LOWER)/$(MCU_VARIANT_LOWER)/gpio.c \
213213
peripherals/stm32$(MCU_SERIES_LOWER)/$(MCU_VARIANT_LOWER)/periph.c \
214-
packages/$(MCU_PACKAGE).c\
214+
packages/$(MCU_PACKAGE).c \
215215
lib/libc/string0.c \
216216
lib/mp-readline/readline.c \
217217
lib/oofatfs/ff.c \

ports/stm/boards/espruino_pico/mpconfigboard.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,5 +35,6 @@
3535
#define AUTORESET_DELAY_MS (500)
3636
#define BOARD_FLASH_SIZE (FLASH_SIZE - 0x4000)
3737

38-
#define BOARD_OSC_DIV (8)
38+
#define HSE_VALUE ((uint32_t)8000000)
39+
#define LSE_VALUE ((uint32_t)32768)
3940
#define BOARD_HAS_LOW_SPEED_CRYSTAL (1)

ports/stm/boards/espruino_wifi/mpconfigboard.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
#define FLASH_SIZE (0x80000) //512K
3333
#define FLASH_PAGE_SIZE (0x4000) //16K
3434

35-
#define BOARD_OSC_DIV (8)
35+
#define HSE_VALUE ((uint32_t)8000000)
36+
#define LSE_VALUE ((uint32_t)32768)
3637
#define BOARD_HAS_LOW_SPEED_CRYSTAL (1)
3738
#define BOARD_OVERWRITE_SWD (1)

ports/stm/boards/feather_stm32f405_express/mpconfigboard.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@
3434

3535
#define MICROPY_HW_NEOPIXEL (&pin_PC00)
3636

37-
#define BOARD_OSC_DIV (12)
38-
#define HSE_VALUE ((uint32_t)12000000U)
37+
#define HSE_VALUE ((uint32_t)12000000U)
38+
#define LSE_VALUE ((uint32_t)32768)
3939
#define BOARD_HAS_LOW_SPEED_CRYSTAL (1)
4040

4141
// On-board flash

ports/stm/boards/meowbit_v121/mpconfigboard.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,9 @@
3535
#define AUTORESET_DELAY_MS 500
3636
#define BOARD_FLASH_SIZE (FLASH_SIZE - 0x4000)
3737

38-
#define BOARD_OSC_DIV (12)
38+
#define HSE_VALUE ((uint32_t)12000000U)
39+
#define LSE_VALUE ((uint32_t)32000U)
3940
#define BOARD_HAS_LOW_SPEED_CRYSTAL (1)
40-
#define HSE_VALUE ((uint32_t)12000000U)
41-
#define LSE_VALUE ((uint32_t)32000U)
4241

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

ports/stm/boards/nucleo_f746zg/mpconfigboard.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,10 @@
3333
#define FLASH_SIZE (0x100000)
3434
#define FLASH_PAGE_SIZE (0x4000)
3535

36-
#define BOARD_OSC_DIV (8)
37-
#define BOARD_HAS_LOW_SPEED_CRYSTAL (0) // TODO: enable this once LSE is fixed for H7/F7
36+
#define HSE_VALUE ((uint32_t)8000000)
37+
#define LSE_VALUE ((uint32_t)32768)
38+
#define BOARD_HSE_SOURCE (RCC_HSE_BYPASS) // ST boards use the STLink clock signal
39+
#define BOARD_HAS_LOW_SPEED_CRYSTAL (1)
3840

3941
#define DEBUG_UART_TX (&pin_PD08)
4042
#define DEBUG_UART_RX (&pin_PD09)

ports/stm/boards/nucleo_f767zi/mpconfigboard.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,7 @@
3232
#define FLASH_SIZE (0x200000)
3333
#define FLASH_PAGE_SIZE (0x4000)
3434

35-
#define BOARD_OSC_DIV (8)
36-
#define BOARD_HAS_LOW_SPEED_CRYSTAL (0) // TODO: enable this once LSE is fixed for H7/F7
35+
#define HSE_VALUE ((uint32_t)8000000)
36+
#define LSE_VALUE ((uint32_t)32768)
37+
#define BOARD_HSE_SOURCE (RCC_HSE_BYPASS) // ST boards use the STLink clock signal
38+
#define BOARD_HAS_LOW_SPEED_CRYSTAL (1)

ports/stm/boards/nucleo_h743zi_2/mpconfigboard.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,7 @@
3131

3232
#define FLASH_PAGE_SIZE (0x4000)
3333

34-
#define BOARD_OSC_DIV (8)
35-
#define BOARD_HAS_LOW_SPEED_CRYSTAL (0) // TODO: enable this once LSE is fixed for H7/F7
34+
#define HSE_VALUE ((uint32_t)8000000)
35+
#define LSE_VALUE ((uint32_t)32768)
36+
#define BOARD_HSE_SOURCE (RCC_HSE_BYPASS) // ST boards use the STLink clock signal
37+
#define BOARD_HAS_LOW_SPEED_CRYSTAL (1)

ports/stm/boards/openmv_h7/mpconfigboard.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,5 @@
3131

3232
#define FLASH_PAGE_SIZE (0x4000)
3333

34-
#define BOARD_OSC_DIV (12)
35-
#define HSE_VALUE ((uint32_t)12000000)
34+
#define HSE_VALUE ((uint32_t)12000000)
3635
#define BOARD_HAS_LOW_SPEED_CRYSTAL (0)

ports/stm/boards/pyb_nano_v2/mpconfigboard.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@
3232
#define FLASH_SIZE (0x80000)
3333
#define FLASH_PAGE_SIZE (0x4000)
3434

35-
#define BOARD_OSC_DIV (8)
35+
#define HSE_VALUE ((uint32_t)8000000)
36+
#define LSE_VALUE ((uint32_t)32768)
3637
#define BOARD_HAS_LOW_SPEED_CRYSTAL (1)
3738

3839
// On-board flash

0 commit comments

Comments
 (0)
0