The code generated by the MBD toolbox does not seem to work

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

The code generated by the MBD toolbox does not seem to work

跳至解决方案
2,003 次查看
mhsjmm
Contributor I

Hello constantinrazvan.chivudumitru-daniel.popa

   I modified an official example of flexcan to apply to my own development board.The MCU on the development board is S32K146. My tools are matlab 2019a, MBD toolbox s32k v4.1.0 , S32 Design Studio for ARM Version 2018.R1 and J-link.The model is 

 shown in the figure below

模型.PNG

Build the Simulink model as normal. Open S32DS and select Import/S32 Design Studio/ProjectInfo.xml Importer.

                            导入.PNG

Then select the ProjectInfo.xml from the location used to generated the C code for the Simulink model. Also, select the ARM32  Executable option.

                                 import.PNG

Open the debug configuration interface by default.Because I use J-link, I closed the interface first and build the project:

build错误.PNG

I found a configuration from How to export Generated Code to S32 Design Studio IDE (applicable for MBDT for MPC5744P v2.0)”.

pastedImage_169.png

But there's only one similar, I choose the following:

1.png

Because my development board uses an external 16MHz crystal oscillator,so I modified the clock profile  as shown in the figure below:

                    时钟配置.png

                   时钟配置1.PNG

Now the project builded successfully:

                   2.PNG

Next, I configure debug as follows:

3.PNG

4.PNG

5.PNG

6.PNG

         11.PNG

I started to debug the project.It seems to work,but I can't get the data.I'm not familiar with hardware,who can tell me what's wrong?

debug2.pngdebug1.png

I exported the project.

导出工程.PNG

Thanks for the help,

Lance

标签 (1)
标记 (1)
1 解答
1,788 次查看
mhsjmm
Contributor I

My mistake,there is no problem with the configuration.I forgot to give the STB pin of TJA1042 low level.You can also remove the peripheral configuration in the clock configuration file,it doesn't matter.            

                                                                     时钟配置.png

在原帖中查看解决方案

2 回复数
1,789 次查看
mhsjmm
Contributor I

My mistake,there is no problem with the configuration.I forgot to give the STB pin of TJA1042 low level.You can also remove the peripheral configuration in the clock configuration file,it doesn't matter.            

                                                                     时钟配置.png

1,788 次查看
mariuslucianand
NXP Employee
NXP Employee

Hello mhsjmm@126.com‌,

Thank you for your contribution!

Best Regards,

Marius

0 项奖励
回复