Stateflow implementation on Arduino very slow

7 views (last 30 days)
Hendrik2k1
Hendrik2k1 on 1 Dec 2025 at 15:02
Edited: Hendrik2k1 on 1 Dec 2025 at 15:06
I have always assumed with Simulink's Arduino support that if I have a Simulink model and declare it as “Run On Board,” all content will be transferred to the board as C code and my computer will not execute any of it itself. In other words, the computing load is completely implemented in hardware.
Now, when I want to implement a simple StateFlow implementation (PWM with Dead Time Insertion) in it and then transfer the whole thing to the Arduino board via “Build Start and Deploy,” I unfortunately find that I basically have no control over a KNOB with which I can set the properties of the PWM on the fly, so to speak. Only when I press "Monitor and Tune" can I change the knob. But then I realize that my StateFlow chart seems to be running within Simulink? At least I can follow the sequence of states (when opening the StateFlow-Chart), and the output on the hardware board (LEDs) is very slow. It is far away from a kHz range. Have I misunderstood something? I've also tried setting the SampleTime of the StateFlow to a very low value, but then I get problems with the XCP protocol (overload).
Any idea how to get this to work? Perhaps Arduino is not the best choice for it? Im using Ardunio DUE, one of the more speedy Arduinos. Of course communication is working over COM.

Answers (0)

Products


Release

R2025b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!