cancel
Showing results for 
Search instead for 
Did you mean: 

Simulink code generation doesn't work on the MCU. AND WHAT IS ERROR?

IB1
Associate

Dear. All

Hi, everyone.

I am a hardware engineer.

I created a very simple logic to create mcu code through simulink, and I succeeded in creating code-build-download.

By the way, I'm trying to find out why it doesn't work because it doesn't work in the logic on the mcu.

Version : Matlab 2019a / STM32CubeIDE 1.5.1

My Test logic is below.

PC0 - GPIO INPUT set (active_low sw ON) -> PA8 - GPIO OUTPUT set (led on)

PC0 - GPIO INPUT set (active_low sw OFF) -> PA8 - GPIO OUTPUT set (led OFF)

Q1) Logic doesn't seem to generate code, is there any way to know?

0693W000007YzKSQA0.jpgQ2) When I call GPIO_WRITE from the simulation link, I get this error, what kind of error is it? I don't know if this error is affecting in simulink code generation.

0693W000007YzLuQAK.pngQ3) Is it right to create a code in a simulink, run a ".project", build and download it to CUBEIDE? The file created by SIMULINK is "simulink_test1.c", but is it different from MAIN.C?

0693W000007YzMsQAK.png 

Q4) I want to check the variable value in CUBEIDE, but what is the reason why I can't check the value because of this error?

0693W000007YzMJQA0.pngsimulink Code Generation is my first time, so I don't know much about it, so please answer me.

1 REPLY 1
JLaba.1
Associate II

Hello,

I don't really know about the first two questions, but for the rest you should try to right-click on "simulink_test1", open the "properties" window, and in the C/C++ tab untick the box that says "Exclude ressource from build".

Personally I need to do that after every Simulink code generation and it seems that ypou haven't done that given the look of the icon of the "simulink_test1" folder.