In this tutorial, I am going to show you how to upload the PID controller block into STM32 F303RE microcontroller by using PLECS software.
Previously, make sure you have installed the STM32 TSP (Target Support Package) based on the installation instructions. Please check the PLEXIM link for more details.
In this tutorial, “Using MATLAB to Design the PID Controller for Buck Converter“, we have designed the PID controller for our Buck Converter circuit and verified its performance by running the Simulink simulation.
Now, we will create the same Buck circuit using the STM32 PLECS library and then generate the code out of it.
1. Create two subsystems, one for the Buck converter circuit and the other one for the PID controller circuit.
2. Enable the code generation option for the PID controller. Right-click on PID_controller subsystem > Subsystem > Execution settings… > tick “√” Enable code generation.
3. Upload the code of the PID controller subsystem.
Below is a picture of the simulation result running on the PLECS standalone 4.7.5
Leave a Reply