NucleoF030R8 not work

I’m trying to run NucleoF030R8.
Simple blink program compiles and loads OK.
But nothing works.
I tested on Nucleo-L053R8, Nucleo-F031 plates and it works on them.
After writing a simple program on the STM32CubeIDE NucleoF030R8 everything works fine.
I work on
Platformio core 6.1.1
ST STM32 15.4.1
My ini file

[env: nucleo_f030r8]
platform = ststm32
board = nucleo_f030r8
framework = arduino
upload_port = COM6
upload_protocol = stlink

Thanks for any help.

If your upload_protocol is stlink, then its using a USB device and you shouldn’t put a upload_port there at all.

And what code are you running where “nothing works”?

My code

#include <Arduino.h>
  #define LED_BUILTIN PA5

void setup()
void loop()
  digitalWrite(LED_BUILTIN, HIGH);
  digitalWrite(LED_BUILTIN, LOW);

Code looks good to me. LED definition is even unnecessary.

100% sure the chip on the board is a STM32F030R8?

When you add

extern "C" void SystemClock_Config(void) {}

to the main.cpp and reupload, does it change anything?

My chip:

When I add

extern "C" void SystemClock_Config(void) {}

Works :slight_smile:
Could you please explain to me why this is so?


Well the code is just a hack to disable default clock code, which tries to use the the expected 8MHz clock signal output by the ST-Link with the PLL (x6 multiplier → 48MHz) in HSE bypass mode (not crystal oscillator mode).

So if that does not work, you may have an older board revision that does not feed the ST-Link clock into the F0 chip. (And likely the crystal directly under the F0 chip is not populated, so the chip has 0 access to a high speed clock crystal or signal).

That was aleady discussed in Nucleo F401RE fails to execute Clock init issue - #13 by vortex314. You should modify the solder bridges (SB…) for the clock to be forwarded correctly to the F0 chip, then remove the

code. You have a hardware problem, in summary.

Now it’s all clear.
I have a broken Nucleo and ST-Link board.
Thank you very much for your help.

If it is an older revision board it is supposed to be that way and wasn’t broken.

Again, make sure the SB16 and SB50 which are located on the back of the board have a 0 ohm resistor or a solder blob accross them, then it should work.

The other workaround is to use a clock init code that uses the internal high speed clock, i.e., write

extern "C" void SystemClock_Config(void) {
  RCC_OscInitTypeDef RCC_OscInitStruct = {};
  RCC_ClkInitTypeDef RCC_ClkInitStruct = {};

  /** Initializes the RCC Oscillators according to the specified parameters
  * in the RCC_OscInitTypeDef structure.
  RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI;
  RCC_OscInitStruct.HSIState = RCC_HSI_ON;
  RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
  if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) {
  /** Initializes the CPU, AHB and APB buses clocks
                                | RCC_CLOCKTYPE_PCLK1;
  RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
  RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV1;

  if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_1) != HAL_OK) {

(from here) in your src/main.cpp. That’s the best you can do with the internal clock source avaiable to you.