cancel
Showing results for 
Search instead for 
Did you mean: 

What is the Problem with my Program? (Using Mat-Target)

Driko
Associate II

@The things i use:

Hardware: Stm32F446RE

Software: CubeMX V.5.4 ; Matlab R2019b ; CubeIDE V.1.1 ; Mat-Target

My Question is: Where is the Mistake in my Programm. I defined the PA5 as a Gpio output because that´s the Output for the LD2 LED on my board which should glow. Should i use a boolean or something else? Did i include the right Folders into the Debugsection?

In Ide I had todeactivate one main.c data, because otherwise the programm had an error, that there would be two main.c datas and that it isnt able to debug. Also i had to deactivate the getbuffptr.c data in the Simulink options because i got an error: no file or directory with that name

Pls write everything that could be a possible Solution why the LED doesnt work/glow up

(I added some Screenshots, hoping they are helpful)

2 REPLIES 2
CMA
Associate II

what are your solver settings and what is generated in the step function in main()?

Cyril FENARD
ST Employee

Hi @Driko​ ,

It seems your are having problems due to the mix of paths with Simulink build area and the area for the final source code for the device.

What you can do is::

>> rmdir slprj s

>> rmdir Led1_stm32

>> rmdir Led2_stm32

delete all files generated by the STM32CubeMX tool (Inc, Src, Core, Drivers, *.ld, .cproject, .project, Debug, Release ...)

choose a working directory

>> cd c:\MATLAB\STM32-MAT\

As a reminder, the STM32-MAT/TARGET tool works mainly in 2 passes:

- code sources are generated by the Simulink coders, based on calls to the STM32 HAL libraries,

- the corresponding files, with part of main.c file corresponding to the calls of the Simulink model (initialize(), step()), are then fed to the STM32CubeMx tool that generates the final project with the IDE selected in the ioc file.

Add verbose build option in the Simulink configuration, restart the whole construction process from the Simulink perspective.

At the end, open the IDE, i.e. CubeIDE, and start the build of the project that has just been generated by the STM32CubeMX tool.

Note there are some known issues with Eclipse based IDEs: check that paths for includes are well formed, add some " " is some spaces in it

In case there are link problems, verify that the source files of the Simulink model are not excluded from the build.

Regards

Cyril