ST Nucleo L476RG as a base for generic mcu

Hello, I have STM32L476RC Generic MCU and i want to use PlatformIO, but in create new project menu only available L476 series is ST Nucleo L476RG. So now question arsises is there any possibility to use Nucleo L476RG as a base for my generic MCU? The only difference between RG and RC is memory size…Thanks for any help :wink:

If that is truely the only difference, and no other difference in peripherals etcs., then you can use as documented a platformio.ini instruction to modify this base paremeter.

; limit flash to 256kB
board_upload.maximum_size = 262144

(implies an otherwise normal platformio.ini with board = nucleo_l476rg)

If using Arduino, you can additional tell the Arduino core that you’re not using the Nucleo variant but the ARDUINO_NUCLEO_L476RC variant, there are macros for that, see here.

; deselect old Nucleo macro
build_unflags = -DARDUINO_NUCLEO_L476RG
; inject correct one
build_flags = -DARDUINO_GENERIC_L476RCTX

When you look at the clock_generic.c and variant_NUCLEO_L476RG.cpp the referenced link, you’ll see that the clock is MSI+PLL, so it should all work without a crystal. .

You can also create a new board definition per docs based on the existing one and modifying the crucial values, this would be usually called genericSTM32L476RC.json. That would give you a cleaner way of saying board = genericSTM32L476RC without all these other modifications, because now they’re all applied in the board manifest directly.

1 Like