2019-12-17 03:16 AM
2019-12-18 08:04 AM
MathWorks tools generate ANSI / ISO C Code, which you can use in your IDE of choice.
The generic work flow is to use MATLAB & Simulink to design and simulate your algorithm. Next you generate the C code fro your algorithm. And then you import that C code into your existing project in your IDE of choice.
You can also use the STM32 MAT Target - this will help configure the peripherals and works with Atolic / ST IDE, Keil, and Embedded Workbench IDE's.
HTH,
-Brian
2019-12-18 08:20 AM
Thanks for your fast answer. I'm thinking to PIL simulation, and to free tools that support this. As, from your response, I can utilize Atolic / ST ide, i.e. STM32Cube IDE, I think that I can perform PIL simulation with the support of free tool (on the microcontroller part). Is it OK?
Thanks,
Piero
2020-01-08 02:59 AM
Hi @Hicss.2033 ,
Yes you can run PIL on STM32 devices with the STM32-MAT/TARGET tool.
There are known issues with some free IDE projects (just follow some tips in PS)
Regards
Cyril
PS:
$ cat ./STM32/STM32demos/PIL/Filter/Readme.txt
The IIR_Filter_int32_PIL (Model Block PIL with shared configuration) PIL simulation has run with the following configurations:
- F429ZITx @ 180 Mhz, USART1: 673 µs (arm-none-eabi-gcc) ( 518 µs with O2)
- F401RETx @ 84 Mhz, USART2: 861 µs (IAR arm)
- L476RG @ 80 Mhz, USART2: 1241 µs (IAR arm)
- L476RG @ 80 Mhz, USART2: 2116 µs (arm-none-eabi-gcc) (1728 µs with O2)
- G431RBTx @ 170 Mhz, USART2: 909 µs (IAR arm)
- G431RBTx @ 170 Mhz, USART2: 1167 µs (arm-none-eabi-gcc) ( 978 µs with O2)
- F302R8Tx @ 64 Mhz, USART2: 1907 µs (IAR arm)
- F302R8Tx @ 64 Mhz, USART2: 1893 µs (arm-none-eabi-gcc) (1558 µs with O2)
- G474RE @ 170 Mhz, USART2: 938 µs (IAR arm)
There are known issues with project generated for SW4STM32:
- Includes may not be correctly formatted in build settings of IIR_Filter_int32 eclipse project.
for instance
replace "../../"../../../../../Program Files/MATLAB/R2018b/extern/include""
by "../../../../../../../Program Files/MATLAB/R2018b/extern/include"
The Simulink model in details.
- Test_PIL_IIR_Filter.mdl The top model where from the RUN is started.
- IIR_Filter_int32.mdl The model in Normal simulation mode.
- IIR_Filter_int32.mdl The model in PIL simulation mode.
- iir_startup.m Script run in pre-load of the Test_PIL_IIR_Filter model.
- testdata.txt Data computed and loaded in workspace as input for the simulation.
1000 noisy sine wave values for 1 second of simulation.
- Test_PIL_IIR_Filter_config_ref.mat Configuration as reference shared with other models.
(stm32.tlc for the System target file)
- C:\MATLAB\STM32-MAT The current directory in the MATLAB session.
- C:\MATLAB\STM32-MAT\IIR_Filter_int32_PIL The directory that contains
the IIR_Filter_int32.ioc and customized files for STM32cubeMX tool.
These files are generated during the Simulink RUN process.