cancel
Showing results for 
Search instead for 
Did you mean: 

can_message.h is missing

DCagi.1
Associate II

Hi everyone,

I am trying to build a simple SIMULINK CAN Communication model using an STM32 MCU: STM32-F405RG.

Within STM32CubeMX, I select the right MCU and also enable the CAN1 (Pinout&Configuration\Connectivity\CAN1 -> Tick on "Master Mode") which enables the pins PA11 and PA12, for CAN1_RX and CAN1_TX respectively. I leave everything else as "by default".

I open my simulink model (Matlab 2018a 64bit), and I can build it with no problems.

When opening the generated .project within STM32CubeIDE, and launching the debbug of the application, I get the error:

fatal error: can_message.h: No such file or directory

I have seen another post in the ST-Community, in which it is recommended to look for this file with MATLAB's own toolbox folders. In particular for me:

C:\Program Files\MATLAB\R2018b\toolbox\shared\can\src\scanutil\can_message.h

And I paste it in the STM32-MAT folder:

C:\MATLAB\STM32-MAT\STM32\addSrc\inc

And within the Simulink model "Configuration Parameters\Code Generation\STM32 Project Files\Select include files (.h)" y select the file:

C:\MATLAB\STM32-MAT\STM32\addSrc\inc\can_message.h

Launching the build in Simulink continues to be OK, but again in STM32CubeIDE, a further error can not locate these files:

rtwtypes.h

tmwtypes.h

I could again locate them in the demo example folder:

C:\Program Files\MATLAB\R2018b\toolbox\rtw\rtwdemos\EmbeddedCoderOverview\CodeMetricFiles\PCG_Eval_CodeMetrics_1

Similarly, I pasted them in the STM32-MAT folder:

C:\MATLAB\STM32-MAT\STM32\addSrc\inc

And within the Simulink model "Configuration Parameters\Code Generation\STM32 Project Files\Select include files (.h)" y select the file:

C:\MATLAB\STM32-MAT\STM32\addSrc\inc\can_message.h

I built again the model in Simulink, open the .project within STM32CubeIDE and try to build, the errors are gone.

Is this the correct procedure? Are the files I found within Matlab's toolbox the right ones to be used?

Thanks everyone

1 REPLY 1
TGIRA.1
Associate II

Hello,

for can_message.h, have a look into the exemple with STM32 Mat/target.

In simulink propriety, you should go to code génération/STM32 projects files and complete "Header files added to project" with the can_message.h file