Nucleo-WB15CC Upload Issues

Ahoy!

I’m struggling to get up and running with my NUCLEO WB15CC. The WB15CC isn’t available in PlatformIO, but I believe the pinout is the same as the NUCLEO WB55RG, which is available. I’m getting an OpenOCD upload error which I will post below.

Could it be this issue? I can’t figure out how to access the board configuration .json file on Mac to check if it is the updated file described here or the old version. I did set up platformIO recently so would think it would be the most updated version.

Just trying to run the blinky example.

Thanks in advance!

Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/ststm32/nucleo_wb55rg_p.html
PLATFORM: ST STM32 (15.4.1+sha.76958b4) > P-Nucleo WB55RG
HARDWARE: STM32WB55RG 64MHz, 192KB RAM, 512KB Flash
DEBUG: Current (stlink) On-board (stlink) External (blackmagic, cmsis-dap, jlink)
PACKAGES: 
 - framework-arduinoststm32 @ 4.20200.220530 (2.2.0) 
 - framework-cmsis @ 2.50700.210515 (5.7.0) 
 - tool-dfuutil @ 1.11.0 
 - tool-openocd @ 2.1100.211028 (11.0) 
 - tool-stm32duino @ 1.0.1 
 - toolchain-gccarmnoneeabi @ 1.90201.191206 (9.2.1)
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 12 compatible libraries
Scanning dependencies...
No dependencies
Building in release mode
Checking size .pio/build/nucleo_wb55rg_p/firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [          ]   0.5% (used 908 bytes from 196608 bytes)
Flash: [          ]   2.9% (used 15088 bytes from 524288 bytes)
Configuring upload protocol...
AVAILABLE: blackmagic, cmsis-dap, jlink, stlink
CURRENT: upload_protocol = stlink
Uploading .pio/build/nucleo_wb55rg_p/firmware.elf
xPack OpenOCD x86_64 Open On-Chip Debugger 0.11.0+dev (2021-10-17-00:18)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
debug_level: 1

srst_only separate srst_nogate srst_open_drain connect_deassert_srst

target halted due to debug-request, current mode: Thread 
xPSR: 0x01000000 pc: 0x080044d8 msp: 0x20030000
** Programming Started **
Warn : Adding extra erase range, 0x08003c48 .. 0x08003fff
Error: block write failed
Error: error writing to flash at address 0x08000000 at offset 0x00000000
embedded:startup.tcl:1070: Error: ** Programming Failed **
in procedure 'program' 
in procedure 'program_error' called at file "embedded:startup.tcl", line 1135
at file "embedded:startup.tcl", line 1070
*** [upload] Error 1

Are you able to connect to your board using the official STM32CubeProg - STM32CubeProgrammer software for all STM32 - STMicroelectronics tool and erase the flash? Maybe there’s a write-protect on.

Hey Max,

I just connected to CubeProg and did a mass flash erase that was successful. It recognizes my board without issue, same thing in STM32CubeIDE with no upload issues.

Read Protection and Write Protection are both disabled in the Option Bytes section.

Any other thoughts?

Well first of all, this fix is not needed anymore because it was already fixed upstream.

As a quick sanity check, can you set

upload_protocol = mbed

in the platformio.ini and upload again? That should go through.

Hey Max,

You’re right, the upload was successful when using the mbed protocol.

The code still does not seem to be running. The pin names for WB15CC and WB55RG seem to be identical for both boards, ruling out pin mapping issues?

Here is my Arduino code I’m trying to run, just in case I’m missing something painfully obvious. Appreciate the help!

#include <Arduino.h>


#ifndef LED_BUILTIN
  #define LED1     PB_5
#endif

void setup()
{
  // initialize LED digital pin as an output.
  pinMode(LED1, OUTPUT);
}

void loop()
{
  // turn the LED on (HIGH is the voltage level)
  digitalWrite(LED1, HIGH);
  // wait for a second
  delay(1000);
  // turn the LED off by making the voltage LOW
  digitalWrite(LED1, LOW);
   // wait for a second
  delay(1000);
}

According to the user manual, PB_5 is correct for LED1 (blue).

However, lookking at the datasheet for a WB15CC, you only have 48 kByte of SRAM, even worse, they are not continuous in memory per reference manual:

Due to linkerscript internals, you can try to set the RAM amount to 12K by adding

board_upload.maximum_ram_size = 12288

in the platformio.ini.

There may be more differences in the WB15CC compared to WB55RG so that this modifciation is not enough. I’ll look into actually generating the right board JSON for it.

Hm, the Arudino STM32 core seems buggy with regards to WB15xx support. THere are compiler errors in the timer.c and analog.cpp files referencing interrupts and struct subfields that this series does not have. Furthermore it doesn’t have the right linkerscript for it. I’ll have to do some digging.

Currently I have a board/genericSTM32WB15CC.json file of

{
    "build": {
      "core": "stm32",
      "cpu": "cortex-m4",
      "extra_flags": "-DSTM32WB15xx",
      "f_cpu": "64000000L",
      "mcu": "stm32wb15cc",
      "product_line": "STM32WB15xx",
      "variant": "STM32WBxx/WB15CCU"
    },
    "connectivity": [
      "bluetooth"
    ],
    "debug": {
      "default_tools": [
        "stlink"
      ],
      "openocd_board": "st_nucleo_wb55",
      "jlink_device": "STM32WB15xx",
      "onboard_tools": [
        "stlink"
      ]
    },
    "frameworks": [
      "arduino"
    ],
    "name": "Nucleo WB15CC",
    "upload": {
      "maximum_ram_size": 49152,
      "maximum_size": 327680,
      "protocol": "stlink",
      "protocols": [
        "jlink",
        "cmsis-dap",
        "stlink",
        "blackmagic"
      ]
    },
    "url": "https://www.st.com/en/evaluation-tools/nucleo-wb15cc.html",
    "vendor": "ST"
  }

and a platformio.ini of

[env:nucleo_wb15cc]
platform = ststm32
board = genericSTM32WB15CC
framework = arduino
platform_packages = 
   framework-arduinoststm32@https://github.com/stm32duino/Arduino_Core_STM32/archive/refs/heads/main.zip

but as said, not working yet.

C:\Users\XXXX.platformio\packages\framework-arduinoststm32\cores\arduino\stm32/timer.h:51:19: error: ‘TIM1_UP_TIM16_IRQn’ undeclared (first use in this function); did you mean ‘TIM1_UP_IRQn’?
51 | #define TIM1_IRQn TIM1_UP_TIM16_IRQn
C:\Users\XXXX.platformio\packages\framework-arduinoststm32\libraries\SrcWrapper\src\stm32\analog.cpp:878:18: error: ‘struct ADC_InitTypeDef’ has no member named ‘NbrOfDiscConversion’; did you mean ‘NbrOfConversion’?

Finally Solved after figuring this problem 2 days. I decide to paste it here.
Building, uploading and debugging of a simple blink example was tested.

  1. Here I got a board/genericSTM32WB15CC.json file nearly the same with maxgerhardt
    But modified maximum_ram_size and maximum_size to match framework-arduinoststm32/boards.txt
{
  "build": {
    "core": "arduino",
    "cpu": "cortex-m4",
    "extra_flags": "-DSTM32WB15xx",
    "f_cpu": "64000000L",
    "mcu": "stm32wb15cc",
    "product_line": "STM32WB15xx",
    "variant": "STM32WBxx/WB15CCU"
  },
  "connectivity": [
    "bluetooth"
  ],
  "debug": {
    "default_tools": [
      "stlink"
    ],
    "openocd_board": "st_nucleo_wb55",
    "jlink_device": "STM32WB15xx",
    "onboard_tools": [
      "stlink"
    ]
  },
  "frameworks": [
    "arduino"
  ],
  "name": "Nucleo WB15CC",
  "upload": {
    "maximum_ram_size": 12288,
    "maximum_size": 131072,
    "protocol": "stlink",
    "protocols": [
      "jlink",
      "cmsis-dap",
      "stlink",
      "blackmagic"
    ]
  },
  "url": "https://www.st.com/en/evaluation-tools/nucleo-wb15cc.html",
  "vendor": "ST"
}

Besides, here is platformio.ini

[env:genericSTM32WB15CC]
platform = ststm32
board = genericSTM32WB15CC
framework = arduino
  1. Add “genericSTM32WB15CC”: “NUCLEO_WB15CC” to framework-arduinoststm32\tools\platformio\boards_remap.json

This is to make some macro declaration take effect in board variants files.

  1. For tool-openocd\openocd\scripts\target\stm32wbx.cfg
    change the line: set _WORKAREASIZE 0x10000 to set _WORKAREASIZE 0x2000

We only got 12KB of SRAM size. 0x10000 surpassed it.

All above is what I did to make Nucleo-WB15CC worked on platformIO.
Happy Vscode + Arduino