This STM32 code generation demo model shows how to use STMicroelectronics STM32 microcontrollers (MCUs) with the PLECS Coder and the STM32 Target Support Package. Parallel control subsystem models are included, allowing to program several specific MCUs from STM. Each subsystem can be directly converter into target specific code for the corresponding STM Nucleo hardware, including the G474RE, G431RB, and F303RE devices. The logic can blink an LED on the Nucleo board and generate two sinusoidal waveforms that are measured with a PLECS Scope by connecting a PWM output to a digital input via a jumper wire. This example walks the user through the process of flashing the MCU (either directly from PLECS or via STM32CubeIDE), establishing the hardware connections for the waveform generation-measurement task, and using the External Mode to update Scopes in the PLECS application with real-time waveforms and optionally tune parameter values in the control logic in real-time.
To learn how to get started with the STM32 Target Support Package (TSP), watch this video.