2015-07-03 07:14 AM
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, Kai2015-07-06 03:00 AM
I also followed this video, but it is not working:
https://www.youtube.com/watch?v=U8jT2lqU0bU Simulink does not recognize the ''compiler'', which should be STM32CubeMX. The problem is also discussed at mathworks. https://www.mathworks.com/matlabcentral/answers/222773-unable-to-generate-code-for- stm32#comment_295551 The difference between the setup in the video and my setup is the MATLAB version. Is STM32-MAT/TARGET compatible with MATLAB R.2015a?2015-07-06 04:28 AM
Hello smrtkai,
Can you debug your application? Is it stopping execution at some level?We need t understand how exactly it is not working.-Mayla-To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2015-07-06 04:39 AM
Thanks for the quick response. Sorry, I forgot to post the error message. Matlab/Simulink is unable to start STM32CubeMX, when I try to build the model. The only difference between the setup in the video and my setup is the Matlab version. I have Matlab R2015a installed.
Matlab returns the following error: An installed compiler was not detected. Certain simulation modes, as well as host-based coder builds require that a compiler be installed. Please install one of the supported compilers for this release as listed at:http://www.mathworks.com/support/compilers/R2015a/win64.html
MATLAB must be restarted after the compiler is installed. Component: Simulink | Category: Model error I followed another approach, but that is not related to your STM32-MAT/TARGET. Its with the hardware support package downloadable directly within Matlab. With this approach the compiler works fine but nothing is executed on the device itself.2015-07-06 06:06 AM
I figured out, that the error occurs in ''setup_for_lcc''. LCC stands Local C Compiler. But
there is no LCC shipped with Matlab 64bit. Changing line 67 in setup_for_lcc.m to ''args.mexOpts = rtwprivate('getMexCompilerInfo');'' fixed the problem. The question is: Why is ''setup_for_lcc'' invoked, when there are alternate and more advanced compilers installed and setup? >> cc = mex.getCompilerConfigurations; >> cc(1) ans = CompilerConfiguration with properties: Name: 'Microsoft Visual C++ 2013 Professional' Manufacturer: 'Microsoft' Language: 'C++' Version: '12.0' Location: 'C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\..\' ShortName: 'MSVCPP120' Priority: 'B' Details: [1x1 mex.CompilerConfigurationDetails] LinkerName: 'link' LinkerVersion: '' MexOpt: 'C:\Users\Kai\AppData\Roaming\MathWorks\MATLAB\R2015a\mex_C++_win64.xml' >> cc(2) ans = CompilerConfiguration with properties: Name: 'Microsoft Visual C++ 2013 Professional (C)' Manufacturer: 'Microsoft' Language: 'C' Version: '12.0' Location: 'C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\..\' ShortName: 'MSVC120' Priority: 'B' Details: [1x1 mex.CompilerConfigurationDetails] LinkerName: 'link' LinkerVersion: '' MexOpt: 'C:\Users\xxx\AppData\Roaming\MathWorks\MATLAB\R2015a\mex_C_win64.xml'2015-07-06 06:53 AM
And if you follow the instructions provided in the error message, what do you get?
-Mayla-To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2015-07-07 12:46 AM
I followed the instructions by installing ''Windows SDK 7.1'' and ''Visual Studio 2013 Professional''. As you can see in my previous post, the compilers are configured correctly. I configured the compilers using ''mex -setup''.
2015-07-15 05:21 AM
Hello,
this pb will be resolved for next STM32-MAT/Target version. Please, edit \STM32\rtw\stm32.tmf Line 68 Please add ''COMPILER_TOOL_CHAIN = default'' in order to have: SYS_TARGET_FILE = stm32.tlc COMPILER_TOOL_CHAIN = default MAKEFILE_FILESEP = / Save file. It should be ok. Best regards Pascal2015-11-17 06:43 AM
Finally, I have gotten the Matlab licenses to program STM32 microcontrollers with Matlab.
I want to report another issue with the Matlab target. If you create the STM32CubeMX project from within Matlab, you cannot generate the code. You have to create the STM32CubeMX -project on its own and select it within Matlab. And you need to generate the code at least once from STM32CubeMX. If not Matlab will generate an output file (*.out) with the content ''Dumy File'' [no typo ;-)].I would really appreciate an official guide on how to use the Matlab target. Maybe there exists one, that I haven't found yet.2015-11-17 08:52 AM
I have encountered another problem. When using MATLAB R2015a it is possible to generate code through STM32CubeMX but there is no Matlab-generated code within the Keil-project.
When I click on ''Build Model'' in MATLAB, STM32CubeMX asks for a project name and location. After setting the configuration the code is generated, but it is simply the code generated from STM32CubeMX. Matlab-Code is completely missing. Although I did set the configuration in advance, Matlab asks for the project configuration. :( Is anyone using Matlab to generate code for STM32 at all? Seems like there are a lot of issues to be solved, to get it working properly. Thanks for your help in advance.