Use Nucleo STM32L4R5ZI-P as STM32L4R5ZI?

Hi to everybody, I’m new to PlatformIO.
I would like to use the Nucleo STM32L4R5ZI-P, but I noticed that only the Nucleo STM32L4R5ZI model (without -P) is supported.
Looking at the boards/nucleo_l4r5zi.json file, I noticed that the supported variants are “STM32L4xx/L4R5Z(G-I)T_L4R7ZIT_L4S5ZIT_L4S7ZIT,” where the “-P” model does not seem to be present.

How can I solve this?

TIA,
CP

  1. Create a new PlatformIO with any board (e.g., “Arduino Uno” and Framework “Arduino”)
  2. Create a new folder boards in the root of the project
  3. Create a new file boards/nucleo_l4r5zi_p.json with content
{
  "build": {
    "core": "stm32",
    "cpu": "cortex-m4",
    "extra_flags": "-DSTM32L4 -DSTM32L4R5xx",
    "f_cpu": "120000000L",
    "mcu": "stm32l4r5zit6p",
    "product_line": "STM32L4R5xx",
    "variant": "STM32L4xx/L4R5ZITxP"
  },
  "connectivity": [
    "can"
  ],
  "debug": {
    "default_tools": [
      "stlink"
    ],
    "jlink_device": "STM32L4R5ZI",
    "onboard_tools": [
      "stlink"
    ],
    "openocd_board": "st_nucleo_l4",
    "openocd_target": "stm32l4x",
    "svd_path": "STM32L4R5.svd"
  },
  "frameworks": [
    "arduino",
    "cmsis",
    "mbed",
    "stm32cube",
    "zephyr"
  ],
  "name": "ST Nucleo L4R5ZI-P",
  "upload": {
    "maximum_ram_size": 655360,
    "maximum_size": 2097152,
    "protocol": "stlink",
    "protocols": [
      "jlink",
      "cmsis-dap",
      "stlink",
      "blackmagic",
      "mbed"
    ]
  },
  "url": "https://www.st.com/en/evaluation-tools/nucleo-l4r5zi-p.html",
  "vendor": "ST"
}
  1. Set the platformio.ini as
[env:nucleo_l4r5zi_p]
platform = ststm32
board = nucleo_l4r5zi_p
framework = arduino
  1. Set src/main.cpp as
#include <Arduino.h>
#define LED LED_BLUE /* or LED_GREEN or LED_RED */

void setup() {
  pinMode(LED, OUTPUT);
  Serial.begin(9600);
}

void loop(){
  Serial.println("LED toggling");
  digitalWrite(LED, HIGH);
  delay(1000);
  digitalWrite(LED, LOW);
  delay(1000);
}

And try to upload it.See if the LED blinks. If yes, it should be equivalent to the Arduino IDE setup to “Nucleo L4R5ZI-P”.

1 Like

Thanks, it works!

Now I’ll try to adapt the previous project for the Nucleo F401RE (using the “stm32” framework)…

C.