Skip to main content
ChRegBrg
Associate II
October 26, 2023
Question

Run MATLAB/Simulink directly on STM32L4 - Speed Limitations?

  • October 26, 2023
  • 1 reply
  • 1184 views

Hello,

i am currently working with MATLAB/Simulink and followed this tutorial: https://www.youtube.com/watch?v=535gxJa72v0.

When I tried to bring the Pulse Generator to its maximum with Digital Write, surprisingly it already stopped at 25kHz. After some research I found out that this is related to the BaseRateSampleTime and can be set in the solver. After I set this to 1e-7 still no faster frequencies than 25kHz are possible.

Has anyone had the same experience or do I still have a configuration error. Or is it because no faster code can be generated from Simulink?

Greetings,

ChRegBrg

1 reply

acsatue
Associate II
December 15, 2023

Hi Ch,

 

I had a similar issue using ADC sampling Triggered by HRTIM. It was stuck at 50kHz using HAL (even without Embedded Coder).

 

I do also work with Embedded Coder Support Package for STM32 (this is based on LL library instead of HAL, so It is supposed to be faster).

 

If you can not choose the code generation library (not sure if it is allowed in Nucleo Boards Support Package), I would try to set Optimization level with Priority to Maximize Execution Speed:

Hardware Settings >> Code Generation >> Optimization >> Level: Maximum >> Priority: Maximize execution speed

 

acsatue_0-1702635452532.png