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
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).
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.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;
RCC_OscInitStruct.PLL.PREDIV = RCC_PREDIV_DIV1;
if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) {
Error_Handler();
}
/** Initializes the CPU, AHB and APB buses clocks
*/
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_SYSCLK
| RCC_CLOCKTYPE_PCLK1;
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV1;
if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_1) != HAL_OK) {
Error_Handler();
}
}
(from here) in your src/main.cpp. That’s the best you can do with the internal clock source avaiable to you.