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

cancel
Showing results for 
Search instead for 
Did you mean: 

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

Jump to solution
220 Views
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

Labels (1)
Tags (1)
1 Solution
5 Views
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

View solution in original post

2 Replies
6 Views
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

View solution in original post

5 Views
NXP Employee
NXP Employee

Hello mhsjmm@126.com‌,

Thank you for your contribution!

Best Regards,

Marius

0 Kudos