Something Wrong with Simulink C code generation in CAN bus communication

2 views (last 30 days)
While I was doing the MBD(Model Based Design) using SImulink,Keil,stm cubemx and stm32_mat_target. I build a simple model in the Simulink then it goes well when I just click the run button.
This is the simple model, CAN1 read the data and CAN2 send it.
But when I press Build Model and generate the C code for stm32, the compiler in Keil tell me that ‘cannot open source input file “can_message.h”:No such file or dictionary’
the compiler tell me the code which Simulink generated is wrong and the can_message.h is missing.
  3 Comments
Nail
Nail on 11 Jan 2020
Edited: Nail on 11 Jan 2020
You can copy the can_message.h in the path
C:\Program Files\MATLAB\R2018a\toolbox\shared\can\src\scanutil\can_message.h
under
C:\Program Files (x86)\MATLAB\STM32-MAT\STM32\addSrc\inc\
(adjust paths for yourself). Then, go to Configuration Parameters under Simulink, STM32 Project Files -> Select include files -> choose can_message.h
If compiling fails, you might need to edit can_messages.h so that
#include "tmwtypes.h"
becomes
#include "rtwtypes.h"

Sign in to comment.

Answers (0)

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!