STM32 Code Generation

Target Support Package

The STM32 Target Support Package (TSP) offers automatic code generation for a STMicroelectronic (ST) STM32 microcontroller (MCU) from a PLECS control model. This includes code for the user-defined control algorithm itself built with standard PLECS library components, as well as the configuration of various on-chip peripherals and protocol interfaces necessary for the application.

The TSP includes a dedicated set of library components for accessing the MCUs I/O and other functionalities needed for sensing, actuation and communication. You can directly program the target device from PLECS via Open OCD (or J-Link), or generate embedded C code into a template STM32CubeIDE project. Once the generated code is deployed on the target device, you can connect via the External Mode to inspect real-time signals and adjust controller set points and parameters on the fly.

To generate code for STM32 MCUs, PLECS Standalone or PLECS Blockset, and the PLECS Coder are required. In addition, a TSP must be installed. Download the appropriate package file and follow the installation instructions.

Type Platform File name
TSP Zip Archive Microsoft Windows 64-bit st_stm32_1.4.3_win.zip
TSP Zip Archive Mac / Intel 64-bit st_stm32_1.4.3_mac.zip

The current version of the TSP requires PLECS version 4.7.5 or newer.

Supported Devices

The STM32 TSP supports the STM32G431, STM32G474, STM32F303 and STM32F334 microprocessors.

Release History

Version 1.4: New light-weight task scheduler, enhanced powerstage protection features, HRTIM and PWM block enhancements, identify a target by its serial number, new demo model added, generate a pinmap (requires PLECS 4.7.5 or later).

Version 1.3: Support for HRTIM peripheral, variable frequency PWM generator, edge counter block and new demo model added (requires PLECS 4.6.7 or later).

Version 1.2: CAN/CAN FD, SPI, Pulse Capture and QEP blocks added (requires PLECS 4.6.1 or later).

Version 1.1: Support for F303 and F334 devices added (requires PLECS 4.5.8 or later).

Version 1.0: Initial release (requires PLECS 4.5.6 or later).