STM32L4S9ZI MCU Support Status

Hi:)

Is the STM32L4S9ZI MCU currently supported in PlatformIO (Arduino Framework)? If not, are there plans to add support in the near future? Apologies if this is not the right forum for such inquiries.

Thanks!

STM32duino supports multiple STM32L4S9ZI (Y, J, T) microcontrollers per https://github.com/stm32duino/Arduino_Core_STM32/tree/main/variants/STM32L4xx. But PlatformIO does not yet have a board definition for it yet.

However, using a custom board definition (e.g. inspired by existing ones), adding support should be possible.

Which microcontroller variant do you have exactly?

1 Like

The exact MCU I will be using is the STM32L4S9ZIJ6.
Are there any guides on how to use custom board definitions like you mentioned?

There is general documentation available at PlatformIO docs and here.

But adding a custom board for an existing platform, like ststm32 is, is pretty easy: You copy one of the existing ones and change all fields that look like they belong to the old chip. The fields themselves (extra_flags, variant, product_line etc, …) are either very self explanatory or documented per above.

I’ve created the genericSTM32L4S9ZIJ6.json board defnition that way. You can check out the project https://github.com/maxgerhardt/pio-stm32l4s9-test for that.

1 Like

This helps a lot, thank you very much!

If I’m understanding correctly, if I instead wanted to use a STM32L432KCU6 e.g., I would simply modify the project you’ve created for the STM32L4S9ZIJ6 by changing the .JSON in the “boards” folder and the “platformio.ini” file with all the naming and specs for the STM32L432KCU6 (source)?

Modified files here

Note that this chip is already supported by the standard “ST Nucleo L432KC” board definition (nucleo_l432kc.json). But yes, in general that’s true.

Just some hints:

  • build.cpu: cortex-m4, cortex-m3, cortex-m33, etc. (-mcpu= value for GCC)
  • build.extra_flags: Extra compiler flags, should at least contain the macro (-D<macro>) that identifies the chip to the STM32HAL in the corresponding stm32YYYxx.h file, see e.g., stm32l4xx.h with STM32L4S9xx
  • build.f_cpu: CPU frequency in Hertz with L (long) suffix
  • build.mcu: MCU name all lowercase
  • build.product_line: Same as identification macro, only used in framework = cmsis or stm32cube, not Arduino, see here
  • build.variant: Path to Arduino variant folder, relative to variants/, e.g., STM32L4xx/L4R9Z(G-I)J_L4S9ZIJ
  • debug.jlink_device: Only used for JLink, must be board or chip name that JLink(GDB) accepts, search on JLink Website
  • debug.openocd_target or debug.openocd_board: OpenOCD target or board file to use, without .cfg suffx. Board file includes preconfigured interface (debug probe) and reset method, target is more generic and can be used with all debug probes. See OpenOCD repo.
  • debug.svd_path: For “Peripheral View” while debugging, should be a file name from misc/svd
  • frameworks: Array of claimed supported frameworks
  • name: displayed board name
  • upload.maximum_ram_size: RAM size in bytes
  • upload.maximum_size: Flash size in bytes
  • upload.protocols supported upload protocols (can also include debug protocols), should be left as same or match platform here and here
  • url: Metadata, link to board or MCU
  • vendor: Metadata, vendor name
1 Like