cancel
Showing results for 
Search instead for 
Did you mean: 

Blinking LED model from Simulink and STM32-Mat/Target not working.

RG.12
Associate II

Matlab - 2019a

STMCube MX - 5.4.0

Board - STM32F4 Discovery

Desired Operation - Blinking of 3 user LEDs on board and 4th LED to glow when user button is pressed.

0690X00000BvfaNQAR.png

Scope result -

0690X00000BvfbLQAR.png

Simulation results confirms that the model is perfectly fine.

GPIO Pin Configuration - PA0 is set to GPIO_input and all other pins are in its default option.

0690X00000BvfcTQAR.png

Saving the .ioc file and importing it in the MCU_config blockset .

Upon clicking the Build, Deploy and Star. Matlab throws an error.

0690X00000BvfeoQAB.png

Aren't the .hal files generated by cube MX and found in my workspace?

I have attached all the required folders.

Kindly help me with rectify this issue.

6 REPLIES 6
dbgarasiya
Senior II

I think your ide is not properly updated

because when you create any project in ide , all files are automatically added to your project

you don't have to add manually

so my advice is to recheck or to reinstall ide and try again

best of luck

Cyril FENARD
ST Employee

Hi @RG.1​ ,

The build log you provided shows that you are using ert.tlc.

Please see STM32_MAT-TARGET_HandsOn.pdf which is part of the installation files for STM32-MAT/TARGET tool.

For the ST solution, it is mandatory to use stm32.tlc as the System Target File.

Just try to take a look to the Blinking examples that are furnished under /STM32demos/Test/ subfolders.

All examples should work on STM32 targets using STM32-MAT/TARGET V5.4.0 with STM32CubeMX 5.4.0 and R2018B of M%ATLAB/Simulink.

Regards.

Cyril

Hi @Cyril FENARD​ 

I had intentionally used ert.tlc because only when I select a hardware in the settings, I am able to get the option of Build, deploy and start.

But could you tell me how to deploy the code when I have stm32.tlc as my option setting, because when I select stm32.tlc I am able to get only run option - which is for the PC Matlab Simulation.

0690X00000Bvt7UQAR.png0690X00000Bvt7PQAR.png

Choosing both hardware and stm32.tlc is not possible. I have to choose stm32.tlc and the hardware for code generation is chosen by default, through which I am able to only simulate and not deploy.

But, in the STM32_MAT-TARGET_HandsOn.pdf, on this page

0690X00000Bvt7eQAB.png

Will uploading the stm32f4xx_hal.h here, help me clear the above error?

Cyril FENARD
ST Employee

​Hi @RG.1​ ,

First, you use R2019a of MATLAB/Simulink; this does not correspond to the delivery of STM32-MAT/TARGET 5.4.0.

With the R2019b of MATLAB/Simulink, you can also create and run a stand-alone application, that is result of ST building process.

Just follow the STM32_MAT-TARGET_HandsOn.pdf for a standalone application and ready-to-use test examples in the installation file of the STM32-MAT/TARGET tool.

Note that it is the STM32_Config block for Simulink that selects the hardware defined in the ioc file which corresponds to the STM32CubeMX project.

With toolstrip concept introduced with R2019x of MATLAB/Simulink, just select the Embedded Coder perspective. Build from this Simulink perspective.

Once the project has been generated by the STM32CubeMx tool, just open this project with the corresponding IDE, build and run on STM32 device.

I understand you know how Mathworks solution deploys a standalone application on the target but ST solution is different, relying on STM32CubeMX and IDE tools (Activate Verbose build in Code Generation to follow more details about what is being done).

For the next release, we plan to use R2019b of MATLAB/Simulink.

Regards.

Cyril

Hi @Cyril FENARD​ ,

So you mean to say, STM32 MAT/TARGET 5.4.0 is not compatible for MATLAB 2019b?

If so , when I can expect the newer version of STM32- MAT/TARGET ?

Thanks

Cyril FENARD
ST Employee

Hi @RG.1​ ,

There are known issues with R2019b, especially with the use of External Mode.

You can start with R2019b for other use-cases; but it is recommended to start with some examples validated with STM32-MAT/TARGET 5.4.0, STM32CubeMX 5.4.0, and MATLAB/Simulink R2018b, as indicated in the delivery note.

We plan to deliver STM32-MAT/TARGET not before the end of Q1 of 2020.

Regards.

Cyril