cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F29I + MATLAB

smrtkai
Senior
Posted on July 03, 2015 at 16:14

Hi,

I am trying to program the discovery board using MATLAB+Simulink. Unfortunately the examples are not working on my board.

I followed the simple example on Mathworks. I changed the pin to PG13, because on my board the LED is connected to this port.

http://de.mathworks.com/help/supportpkg/stmicroelectronicsstm32f4discovery/examples/getting-started-with-embedded-coder-support-package-for-stmicroelectronics-stm32f4-discovery-board.html

Everything compiles without an error. The program is downloaded to the board, but nothing happens.

This is my board:

http://www.st.com/web/catalog/tools/FM116/SC959/SS1532/PF259090

Can anyone help me to get it working?

Best Regards,

Kai
12 REPLIES 12
smrtkai
Senior
Posted on November 20, 2015 at 14:19

Anyone, who is interested in the official ST guide on ''Usage of STM32-MAT target'', there exist an Readme file.

It is hidden at file:///C:/MATLAB/STM32-MAT/STM32/Readme.html

smrtkai
Senior
Posted on December 03, 2015 at 09:31

Is an update for the MATLAB-Target on the development roadmap?

''STM32 Embedded Target has been developped for MATLAB® R2014a version''

 

(file:///C:/MATLAB/STM32-MAT/STM32/Readme.html)

 

smrtkai
Senior
Posted on December 03, 2015 at 13:23

Hi,

I wrote a step by step guide for myself on ''How to setup STM32-MAT/TARGET with MATLAB R2015a''.

#

# Software

#

  - Windows 10

  - MATLAB R2015a

  - Keil uVision V5.16.0

  - STM32CubeMX V4.11.0

  - STM32-MAT/TARGET 4.2.0

  - git version 1.9.5.msysgit.1

#

# Preparation

#

STM32 Embedded Target (STM32-MAT/TARGET) has been developped for MATLAB® R2014a

version. There are some issues that have to be solved to get the STM32-MAT/TARGET

working with MATLAB R2015a.

0.  Install STM32-MAT/Target

    http://www.st.com/web/en/catalog/tools/FM147/CL1794/SC961/SS1533/PF258513

    file:///C:/MATLAB/STM32-MAT/STM32/Readme.html

    see also file:///C:/MATLAB/STM32-MAT/STM32/html

1a. Local C Compiler Issue

    ''Changing line 67 in setup_for_lcc.m to the following line fixed the problem.''

       args.mexOpts = rtwprivate('getMexCompilerInfo');

    C:\Program Files\MATLAB\R2015a\toolbox\rtw\rtw\setup_for_lcc.m

    NOTE: You need to have administrative rights, when editing this file.

1b. Compiler Tool Chain

    Official answer from ST to fix this issue.

    See https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=%2fpublic%2fSTe2ecommunities%2fmcu%2fLists%2fcortex%5fmx%5fstm32%2fSTM32F29I%20%2b%20MATLAB&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B

    Edit C:\MATLAB\STM32-MAT\STM32\rtw\stm32.tmf

    In Line 68 add ''COMPILER_TOOL_CHAIN = default''

2.  Create STM32CubeMX project

    The STM32CubeMX project (*.ioc) needs to be generated separately. It is not

    possible to create a new project from within MATLAB. Additionally the code

    neeeds to be generated once before using it with the STM32-MAT/TARGET.

    Just select ''Project > Generate Code''.

3.  Configure Simulink Model

    There are two places where the preferences for the STM32-MAT/TARGET can be

    set.

    In Simulink:

    File > Simulink Preferences > Configuration Defaults > Code Generation

    Simulation > Model Configuration Parameters (Strg + E) > Code Generation

4.  Create Simulink Model and Build Model

    Create a new Simulink Model, select ''STM32_Config'' from ''Target Support

    Package - STM32 Adapter/MCU_CONFIG'' and select the created STM32CubeMX

    from step 2. Clicking on ''Build Model'' will generate a Keil project, that

    can be ''build and run'' on the stm32 mircocontroller.