Issues when using STM32 Platform version 15.0 with NUCLEO-F030R8

Hello everyone,

I am currently trying to get the new STM32 Platform version 15.0 (which includes Arduino Core for STM32 2.1.0) environment to work (usually working in version 8.1.0 with Arduino Core for STM32 v1.9.0). However, I am running into a strange issue with my NUCLEO-F030R8 board test setup and the simple HelloWorld function below.

2021-11-03 12_53_40-Window

When compiled on version 8.1.0, the device prints Hello World on init, however when compiled with version 15.0, nothing is happening on device init. Compiling and uploading is succesful in both cases.

Anyone else having the same issue on STM32 version 15.0?

Additionally (but possibly unrelated), I cannot use peek definition ( CTRL-RIGHT CLICK) in the PlatformIO install I am testing the new 15.0 environment in (would not want to overwrite all custom variant files etc, so I am on a different Windows account for that). Serial, for example, is white in my 15.0 test account and blue in my usual 8.1.0 account. Same for imported libraries like STM32RTC and STM32LowPower. I can include, but I do not get the usual peek definition functionality. This also persists after a clean PlatformIO or STM32 15.0 install.

2021-11-03 12_11_00-main.cpp - Untitled (Workspace) - Visual Studio Code

And finally, I get a parse error from the auto-generated c_cpp_properties.json that I have never seen before in 8.1.0. Again, compilation and upload still succesful.

2021-11-03 12_08_17-Window

Unsure if all are related and I should create 3 topics for this, if so, sorry I am asking 3 questions at once.

Setting aside the IntelliSense issue for now and focusing on the board not running at all, I noticed that the Nucleo’s clock-init function went from HSI in 1.9.0 to HSE in bypass mode in 2.x. This means the board is expecting an 8MHz clock-in signal to be present at the OSCIN pin, generated by the ST-Link on the board (which actually has the crystal oscillator connected to it, not the main MCU).

I’ve seen multiple instances where people have older Nucleo board revisions where the solder bridges (marked SB on the upper and lower board side) are not set appropriately so that this signal actually goes through.

Can you test the following: Add the following function at the end of the main.cpp file:

/* override clock init back to fail-safe HSI */
exterh "C" void SystemClock_Config(void)
{
  RCC_ClkInitTypeDef RCC_ClkInitStruct;
  RCC_OscInitTypeDef RCC_OscInitStruct;

  /* No HSE Oscillator on Nucleo, Activate PLL with HSI/2 as source */
  RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI;
  RCC_OscInitStruct.HSIState = RCC_HSI_ON;
  RCC_OscInitStruct.HSICalibrationValue = 15;
  RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
  RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSI;
  RCC_OscInitStruct.PLL.PREDIV = RCC_PREDIV_DIV1;
  RCC_OscInitStruct.PLL.PLLMUL = RCC_PLL_MUL12;
  if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) {
    /* Initialization Error */
    while (1);
  }

  /* Select PLL as system clock source and configure the HCLK, PCLK1 clocks dividers */
  RCC_ClkInitStruct.ClockType = (RCC_CLOCKTYPE_SYSCLK | RCC_CLOCKTYPE_HCLK | 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) {
    /* Initialization Error */
    while (1);
  }
}

Then re-upload the project. Does the board then “magically” work?

Yes, this solution has worked, thank you very much.
Had to change exterh to extern (typo), but these things happen :slight_smile: .

You mention IntelliSense issue, is this with regards to both the peak definitions issue and the parse error?

Okay so that was just a test. The Nucleo board in both the Arduino IDE (if STM32Duino core 2.x is used) and hence PlatformIO which uses that core expect the Nucleo to be able to setup the clock from HSE+Bypass mode. Please look into the thread Nucleo F401RE fails to execute Clock init issue - #17 by vortex314 to check whether or not your solder bridges are set-up correctly (SB16, SB50).

Indeed. For that I would recommend: Ctrl+Shift+P → Rebuild IntelliSense. If that does not work, you might have conflictin C/C++ extensions installed in VSCode and we’d need to see the list of your installed extensions.

No changes after rebuilding Intellisense.

I currently run the following extensions in my 15.0 environment:

C/C++ v0.21.0
PlatformIO IDE v1.10.0

This is weird, because in my other 8.1.0 environment I run on:

C/C++ v1.7.1
PlatformIO IDE v2.3.4

There do not seem to be updates for Visual Studio Code (v1.27.2) even though my 8.1.0 environment runs at v1.61.2. Will perform a reinstall of Visual Studio Code on my 15.0 environment.

Apparently Visual Studio Code version 1.27.2 which was installed was not able to update and kept older versions of both PlatformIO IDE and C/C++ extension.

Reinstalling using the installer from the VSC website (1.16.2) did the trick.