Embedded coder code generation for STM32 devics
Mostrar comentarios más antiguos
I have prepared a SVPWM module in simulink. I want to generate code via embedded coder and use it in keil IDE to generate svpwm in stm32 device. I want to make the code independent from HW. So i do not use any stm32 block.
So this module takes rpm and generates dutycycle counter.
My idea is to integrate generated code in keil ide and run it inside a timer interrupt of stm32 and generate svpwm. Could you please help me the necessary srtting in embedded coder to generate c code which is compatible to build the project in keil IDE for stm32?
2 comentarios
sourav
el 22 de En. de 2026
Respuestas (1)
Samhitha
el 29 de En. de 2026
0 votos
To generate hardware-independent C code from your SVPWM Simulink model and use it safely inside Keil for STM32, configure Embedded Coder to act only as an algorithm generator. Use the ert.tlc system target file, set Hardware Implementation to None, disable any STM32 or hardware support packages, and enable “Generate code only” . In Code Generation → Interface, select Reusable function so you get clean functions. Turn off the example main file and scheduler, use fixed-step discrete solver, and keep SingleTasking mode. Then, copy the generated .c/.h files into Keil, call the generated function once in main(), and another funcion inside a timer interrupt. Use the outputs to update STM32 timer CCR registers to generate SVPWM.
For more details you can look into the following File-Exchange documentation:
Hope this helps!
Categorías
Más información sobre STMicroelectronics Discovery Boards en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


