From 692202165373d8e95fb432d3e5c9e8e23542847e Mon Sep 17 00:00:00 2001 From: Ralf Doering Date: Sat, 31 Oct 2026 12:17:48 +0100 Subject: [PATCH] Add an HSI clock option for NUCLEO-F030R8 Allow boards without ST-LINK MCO, including MB1136 C-01 in its factory-default wiring, to use HSI / 2 * 12 at 48 MHz. These boards cannot start sketches with the existing HSE bypass configuration. Keep the existing HSE selection unchanged and share the board macro, variant, pins, linker script and tools between both options. Add the new selection to the existing part-number menu and document its use. --- boards.txt | 16 ++++++++++++++++ docs/customization/Custom-definitions.md | 8 ++++++++ docs/supported-boards/index.md | 1 + .../STM32F0xx/F030R8T/variant_NUCLEO_F030R8.cpp | 11 +++++++++++ 4 files changed, 36 insertions(+) diff --git a/boards.txt b/boards.txt index 47a452a2c9..8f0141a3e6 100644 --- a/boards.txt +++ b/boards.txt @@ -633,6 +633,22 @@ Nucleo_64.menu.pnum.NUCLEO_F030R8.build.variant=STM32F0xx/F030R8T Nucleo_64.menu.pnum.NUCLEO_F030R8.openocd.target=stm32f0x Nucleo_64.menu.pnum.NUCLEO_F030R8.debug.svd_file={runtime.tools.STM32_SVD.path}/svd/STM32F0xx/STM32F0x0.svd +# NUCLEO_F030R8 with internal HSI clock (including MB1136 C-01) +# Docs: url=https://www.st.com/en/evaluation-tools/nucleo-f030r8.html +# Docs: notes=Internal HSI / 2 x 12 = 48 MHz; suitable for MB1136 C-01 without ST-LINK MCO. +Nucleo_64.menu.pnum.NUCLEO_F030R8_HSI=Nucleo F030R8 (HSI, 48 MHz) +Nucleo_64.menu.pnum.NUCLEO_F030R8_HSI.node="NODE_F030R8,NUCLEO" +Nucleo_64.menu.pnum.NUCLEO_F030R8_HSI.upload.maximum_size=65536 +Nucleo_64.menu.pnum.NUCLEO_F030R8_HSI.upload.maximum_data_size=8192 +Nucleo_64.menu.pnum.NUCLEO_F030R8_HSI.build.mcu=cortex-m0 +Nucleo_64.menu.pnum.NUCLEO_F030R8_HSI.build.board=NUCLEO_F030R8 +Nucleo_64.menu.pnum.NUCLEO_F030R8_HSI.build.series=STM32F0xx +Nucleo_64.menu.pnum.NUCLEO_F030R8_HSI.build.product_line=STM32F030x8 +Nucleo_64.menu.pnum.NUCLEO_F030R8_HSI.build.variant=STM32F0xx/F030R8T +Nucleo_64.menu.pnum.NUCLEO_F030R8_HSI.openocd.target=stm32f0x +Nucleo_64.menu.pnum.NUCLEO_F030R8_HSI.debug.svd_file={runtime.tools.STM32_SVD.path}/svd/STM32F0xx/STM32F0x0.svd +Nucleo_64.menu.pnum.NUCLEO_F030R8_HSI.build.st_extra_flags=-D{build.product_line} {build.enable_usb} {build.xSerial} -DNUCLEO_F030R8_USE_HSI + # NUCLEO_F070RB board # Docs: release=2.0.0 # Docs: url=http://www.st.com/en/evaluation-tools/nucleo-f070rb.html diff --git a/docs/customization/Custom-definitions.md b/docs/customization/Custom-definitions.md index 318ea964a3..c64672250e 100644 --- a/docs/customization/Custom-definitions.md +++ b/docs/customization/Custom-definitions.md @@ -278,6 +278,14 @@ extern "C" void SystemClock_Config() { } ``` +### NUCLEO-F030R8 clock source + +For a NUCLEO-F030R8 without an external HSE clock, select **Nucleo F030R8 (HSI, 48 MHz)** under **Tools > Board part number**. This uses the internal 8 MHz HSI oscillator divided by 2 and multiplied by 12, giving a nominal 48 MHz system clock. No sketch changes are required. + +The existing **Nucleo F030R8** option continues to use an 8 MHz external clock in HSE bypass mode, normally provided by ST-LINK MCO, multiplied by 6 to reach 48 MHz. Both options share the same pin mapping, memory layout, upload methods and debugger configuration. + +[UM1724, section 7.9.1](https://www.st.com/resource/en/user_manual/dm00105823.pdf) documents MB1136 C-01 as configured with HSE not used, and C-02 or higher as configured with ST-LINK MCO connected. Choose the option that matches the actual clock wiring, which can differ after solder-bridge modifications. The internal HSI oscillator has lower frequency accuracy than a suitable external clock source; consider this for applications with strict timing requirements. + ## Enable UCPD dead battery behavior > [!NOTE] diff --git a/docs/supported-boards/index.md b/docs/supported-boards/index.md index 606b734b9c..e2c74c8ef2 100644 --- a/docs/supported-boards/index.md +++ b/docs/supported-boards/index.md @@ -47,6 +47,7 @@ | [Nucleo C092RC](https://www.st.com/en/evaluation-tools/nucleo-c092rc.html) | [STM32C092RC](https://www.st.com/en/microcontrollers-microprocessors/stm32c092rc.html) | `NUCLEO_C092RC` | 2.11.0 | | | [Nucleo C562RE](https://www.st.com/en/evaluation-tools/stm32-nucleo-boards.html) | [STM32C562RE](https://www.st.com/en/microcontrollers-microprocessors/stm32c562re.html) | `NUCLEO_C562RE` | 3.0.0 | | | [Nucleo F030R8](http://www.st.com/en/evaluation-tools/nucleo-f030r8.html) | [STM32F030R8](https://www.st.com/en/microcontrollers-microprocessors/stm32f030r8.html) | `NUCLEO_F030R8` | 0.2.0 | | +| [Nucleo F030R8 (HSI, 48 MHz)](https://www.st.com/en/evaluation-tools/nucleo-f030r8.html) | [STM32F030R8](https://www.st.com/en/microcontrollers-microprocessors/stm32f030r8.html) | `NUCLEO_F030R8` | Next release | Internal HSI / 2 x 12 = 48 MHz; suitable for MB1136 C-01 without ST-LINK MCO. | | [Nucleo F070RB](http://www.st.com/en/evaluation-tools/nucleo-f070rb.html) | [STM32F070RB](https://www.st.com/en/microcontrollers-microprocessors/stm32f070rb.html) | `NUCLEO_F070RB` | 2.0.0 | | | [Nucleo F072RB](http://www.st.com/en/evaluation-tools/nucleo-f072rb.html) | [STM32F072RB](https://www.st.com/en/microcontrollers-microprocessors/stm32f072rb.html) | `NUCLEO_F072RB` | 1.9.0 | | | [Nucleo F091RC](http://www.st.com/en/evaluation-tools/nucleo-f091rc.html) | [STM32F091RC](https://www.st.com/en/microcontrollers-microprocessors/stm32f091rc.html) | `NUCLEO_F091RC` | 0.1.0 | | diff --git a/variants/STM32F0xx/F030R8T/variant_NUCLEO_F030R8.cpp b/variants/STM32F0xx/F030R8T/variant_NUCLEO_F030R8.cpp index e8aa39d827..97caaede1f 100644 --- a/variants/STM32F0xx/F030R8T/variant_NUCLEO_F030R8.cpp +++ b/variants/STM32F0xx/F030R8T/variant_NUCLEO_F030R8.cpp @@ -117,11 +117,22 @@ WEAK void SystemClock_Config(void) * Initializes the RCC Oscillators according to the specified parameters * in the RCC_OscInitTypeDef structure. */ +#if defined(NUCLEO_F030R8_USE_HSI) + /* Use HSI when no external clock is connected, e.g. MB1136 C-01. */ + /* HSI 8 MHz / 2 * 12 = 48 MHz. */ + RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI; + RCC_OscInitStruct.HSIState = RCC_HSI_ON; + RCC_OscInitStruct.HSICalibrationValue = RCC_HSICALIBRATION_DEFAULT; + RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON; + RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSI; + RCC_OscInitStruct.PLL.PLLMUL = RCC_PLL_MUL12; +#else RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE; RCC_OscInitStruct.HSEState = RCC_HSE_BYPASS; RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON; RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE; RCC_OscInitStruct.PLL.PLLMUL = RCC_PLL_MUL6; +#endif RCC_OscInitStruct.PLL.PREDIV = RCC_PREDIV_DIV1; if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) { Error_Handler();