Skip to content

Commit 6922021

Browse files
committed
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.
1 parent 6a2cdda commit 6922021

4 files changed

Lines changed: 36 additions & 0 deletions

File tree

‎boards.txt‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -633,6 +633,22 @@ Nucleo_64.menu.pnum.NUCLEO_F030R8.build.variant=STM32F0xx/F030R8T
633633
Nucleo_64.menu.pnum.NUCLEO_F030R8.openocd.target=stm32f0x
634634
Nucleo_64.menu.pnum.NUCLEO_F030R8.debug.svd_file={runtime.tools.STM32_SVD.path}/svd/STM32F0xx/STM32F0x0.svd
635635

636+
# NUCLEO_F030R8 with internal HSI clock (including MB1136 C-01)
637+
# Docs: url=https://www.st.com/en/evaluation-tools/nucleo-f030r8.html
638+
# Docs: notes=Internal HSI / 2 x 12 = 48 MHz; suitable for MB1136 C-01 without ST-LINK MCO.
639+
Nucleo_64.menu.pnum.NUCLEO_F030R8_HSI=Nucleo F030R8 (HSI, 48 MHz)
640+
Nucleo_64.menu.pnum.NUCLEO_F030R8_HSI.node="NODE_F030R8,NUCLEO"
641+
Nucleo_64.menu.pnum.NUCLEO_F030R8_HSI.upload.maximum_size=65536
642+
Nucleo_64.menu.pnum.NUCLEO_F030R8_HSI.upload.maximum_data_size=8192
643+
Nucleo_64.menu.pnum.NUCLEO_F030R8_HSI.build.mcu=cortex-m0
644+
Nucleo_64.menu.pnum.NUCLEO_F030R8_HSI.build.board=NUCLEO_F030R8
645+
Nucleo_64.menu.pnum.NUCLEO_F030R8_HSI.build.series=STM32F0xx
646+
Nucleo_64.menu.pnum.NUCLEO_F030R8_HSI.build.product_line=STM32F030x8
647+
Nucleo_64.menu.pnum.NUCLEO_F030R8_HSI.build.variant=STM32F0xx/F030R8T
648+
Nucleo_64.menu.pnum.NUCLEO_F030R8_HSI.openocd.target=stm32f0x
649+
Nucleo_64.menu.pnum.NUCLEO_F030R8_HSI.debug.svd_file={runtime.tools.STM32_SVD.path}/svd/STM32F0xx/STM32F0x0.svd
650+
Nucleo_64.menu.pnum.NUCLEO_F030R8_HSI.build.st_extra_flags=-D{build.product_line} {build.enable_usb} {build.xSerial} -DNUCLEO_F030R8_USE_HSI
651+
636652
# NUCLEO_F070RB board
637653
# Docs: release=2.0.0
638654
# Docs: url=http://www.st.com/en/evaluation-tools/nucleo-f070rb.html

‎docs/customization/Custom-definitions.md‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,14 @@ extern "C" void SystemClock_Config() {
278278
}
279279
```
280280

281+
### NUCLEO-F030R8 clock source
282+
283+
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.
284+
285+
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.
286+
287+
[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.
288+
281289
## Enable UCPD dead battery behavior
282290

283291
> [!NOTE]

‎docs/supported-boards/index.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
| [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 | |
4848
| [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 | |
4949
| [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 | |
50+
| [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. |
5051
| [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 | |
5152
| [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 | |
5253
| [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 | |

‎variants/STM32F0xx/F030R8T/variant_NUCLEO_F030R8.cpp‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,11 +117,22 @@ WEAK void SystemClock_Config(void)
117117
* Initializes the RCC Oscillators according to the specified parameters
118118
* in the RCC_OscInitTypeDef structure.
119119
*/
120+
#if defined(NUCLEO_F030R8_USE_HSI)
121+
/* Use HSI when no external clock is connected, e.g. MB1136 C-01. */
122+
/* HSI 8 MHz / 2 * 12 = 48 MHz. */
123+
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI;
124+
RCC_OscInitStruct.HSIState = RCC_HSI_ON;
125+
RCC_OscInitStruct.HSICalibrationValue = RCC_HSICALIBRATION_DEFAULT;
126+
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
127+
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSI;
128+
RCC_OscInitStruct.PLL.PLLMUL = RCC_PLL_MUL12;
129+
#else
120130
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;
121131
RCC_OscInitStruct.HSEState = RCC_HSE_BYPASS;
122132
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
123133
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
124134
RCC_OscInitStruct.PLL.PLLMUL = RCC_PLL_MUL6;
135+
#endif
125136
RCC_OscInitStruct.PLL.PREDIV = RCC_PREDIV_DIV1;
126137
if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) {
127138
Error_Handler();

0 commit comments

Comments
 (0)