<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to define ISR for a module which is not contained in the MBDT library in Model-Based Design Toolbox (MBDT)</title>
    <link>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/How-to-define-ISR-for-a-module-which-is-not-contained-in-the/m-p/1393722#M6834</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;SPAN&gt;Marius,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The MCU I use is MPC5744P, and the version of MBDT is 3.0.0.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Best Regards&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Zhang&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 03 Jan 2022 10:07:25 GMT</pubDate>
    <dc:creator>Yunhe</dc:creator>
    <dc:date>2022-01-03T10:07:25Z</dc:date>
    <item>
      <title>How to define ISR for a module which is not contained in the MBDT library</title>
      <link>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/How-to-define-ISR-for-a-module-which-is-not-contained-in-the/m-p/1393513#M6831</link>
      <description>&lt;P&gt;Hi:&lt;/P&gt;&lt;P&gt;Since there is no SWT in the MBDT library, I configure the watchdog through the register r/w module, but what if I configure ISR for SWT because there is no related module in the library?&lt;/P&gt;&lt;P&gt;best wishes;&lt;/P&gt;&lt;P&gt;zhang.&lt;/P&gt;</description>
      <pubDate>Fri, 31 Dec 2021 08:58:41 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/How-to-define-ISR-for-a-module-which-is-not-contained-in-the/m-p/1393513#M6831</guid>
      <dc:creator>Yunhe</dc:creator>
      <dc:date>2021-12-31T08:58:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to define ISR for a module which is not contained in the MBDT library</title>
      <link>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/How-to-define-ISR-for-a-module-which-is-not-contained-in-the/m-p/1393682#M6832</link>
      <description>&lt;P&gt;Hello Zhang,&lt;/P&gt;
&lt;P&gt;Can you tell me please, which MCU are you using?&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Marius&lt;/P&gt;</description>
      <pubDate>Mon, 03 Jan 2022 07:26:00 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/How-to-define-ISR-for-a-module-which-is-not-contained-in-the/m-p/1393682#M6832</guid>
      <dc:creator>mariuslucianand</dc:creator>
      <dc:date>2022-01-03T07:26:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to define ISR for a module which is not contained in the MBDT library</title>
      <link>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/How-to-define-ISR-for-a-module-which-is-not-contained-in-the/m-p/1393722#M6834</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;SPAN&gt;Marius,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The MCU I use is MPC5744P, and the version of MBDT is 3.0.0.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Best Regards&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Zhang&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 03 Jan 2022 10:07:25 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/How-to-define-ISR-for-a-module-which-is-not-contained-in-the/m-p/1393722#M6834</guid>
      <dc:creator>Yunhe</dc:creator>
      <dc:date>2022-01-03T10:07:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to define ISR for a module which is not contained in the MBDT library</title>
      <link>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/How-to-define-ISR-for-a-module-which-is-not-contained-in-the/m-p/1393795#M6836</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/63385"&gt;@Yunhe&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;Well, in this case, you shall implement the interrupt using custom code.&lt;/P&gt;
&lt;P&gt;First of all, you have to create a handler in a C file in which you can include the interrupt custom function. The following article might be a good tutorial on how to do that:&amp;nbsp;&lt;A href="https://community.nxp.com/t5/NXP-Model-Based-Design-Tools/How-to-use-your-own-C-code-in-our-Toolbox-Battery-Management/ta-p/1119004" target="_blank"&gt;https://community.nxp.com/t5/NXP-Model-Based-Design-Tools/How-to-use-your-own-C-code-in-our-Toolbox-Battery-Management/ta-p/1119004&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Now you need to enable and assign a priority for the interrupt and assign a handler. For that you can use some of the functions defined in the interrupt_manager_MPC57xx.c file, which is automatically copied in the final project as default:&lt;/P&gt;
&lt;P&gt;INT_SYS_EnableIRQ(SWT0_IRQn);&lt;/P&gt;
&lt;P&gt;INT_SYS_SetPriority(SWT0_IRQn, priority);&lt;/P&gt;
&lt;P&gt;INT_SYS_InstallHandler(SWT0_IRQn, C_function_handler, NULL);&lt;/P&gt;
&lt;P&gt;One more note: the latest release of the MBDT for the MPC57xx is 3.2.0 so I strongly recommend you to update to the latest version.&lt;/P&gt;
&lt;P&gt;Hope this helps,&lt;/P&gt;
&lt;P&gt;Marius&lt;/P&gt;</description>
      <pubDate>Mon, 03 Jan 2022 14:27:21 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/How-to-define-ISR-for-a-module-which-is-not-contained-in-the/m-p/1393795#M6836</guid>
      <dc:creator>mariuslucianand</dc:creator>
      <dc:date>2022-01-03T14:27:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to define ISR for a module which is not contained in the MBDT library</title>
      <link>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/How-to-define-ISR-for-a-module-which-is-not-contained-in-the/m-p/1395984#M6851</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Hi&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;Marius,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Your answers and articles have benefited me a lot. Based on your article, I not only embed the SWT ISR as C code into Simulink, but also embed the SWT initialization code into Simulink based on the SWT code generated by the S32DS SDK, and It is working. But in this process, I encountered a problem, I hope you can answer it. Since SWT requires swt_hw_access.h, swt_driver.h and swt_driver.c, swt_hw_access.c, I added the corresponding path and file in MATLAB:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Yunhe_0-1641538998735.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/166978iB3AD885BA321B744/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Yunhe_0-1641538998735.png" alt="Yunhe_0-1641538998735.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;(If do not specify the path of the header file, then S32DS will report an error when compiling the code and the corresponding header file cannot be found. e.g. Cpu.h No such file or directory)&lt;/P&gt;&lt;P&gt;Add source file path:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Yunhe_1-1641539220333.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/166980i1591F3FFB6B30E68/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Yunhe_1-1641539220333.png" alt="Yunhe_1-1641539220333.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Then execute the initialization function "init1" , in the function, initialize and configure the SWT ISR.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Yunhe_2-1641539408375.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/166981i708F611C35DB8B0E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Yunhe_2-1641539408375.png" alt="Yunhe_2-1641539408375.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;When I generated the code and compiled it in S32DS, some errors appeared. These errors were resolved when I dragged the corresponding source files (main.c, swt_driver.c, swt_hw_access.c) into the project：&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Yunhe_3-1641539448660.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/166982i79BB79A966B8F98C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Yunhe_3-1641539448660.png" alt="Yunhe_3-1641539448660.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;And worked successfully.&lt;BR /&gt;But I think this is a bit troublesome, so I want to ask if there is a way to automatically add the corresponding source files to the generated code.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;In addition, I want to talk about the C code of SWT initialization and interrupt configuration encapsulated as Simulink modules and added to the Simulink library. I would like to ask you if there are any corresponding posts on the forum.&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Best Regards&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Zhang&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jan 2022 07:12:30 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/How-to-define-ISR-for-a-module-which-is-not-contained-in-the/m-p/1395984#M6851</guid>
      <dc:creator>Yunhe</dc:creator>
      <dc:date>2022-01-07T07:12:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to define ISR for a module which is not contained in the MBDT library</title>
      <link>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/How-to-define-ISR-for-a-module-which-is-not-contained-in-the/m-p/1396079#M6853</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/63385"&gt;@Yunhe&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;In case you want to automatically copy inside the generated code some files, you can use our script&amp;nbsp;mbd_mpc574x_user_copy_required_files. This is an m file that can be modified on your side to automatically copy some files when the code is generated.&lt;/P&gt;&lt;P&gt;You can access the swt driver files from our toolbox using the following line:&amp;nbsp; fullfile(mbd_find_mpc_root, 'MPC_Platform_SDK', 'platform', 'drivers', 'src', 'swt')&lt;/P&gt;&lt;P&gt;Please let me know if the above approach worked on your side.&lt;/P&gt;&lt;P&gt;Hope this helps,&lt;/P&gt;&lt;P&gt;Marius&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jan 2022 09:25:56 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/How-to-define-ISR-for-a-module-which-is-not-contained-in-the/m-p/1396079#M6853</guid>
      <dc:creator>mariuslucianand</dc:creator>
      <dc:date>2022-01-07T09:25:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to define ISR for a module which is not contained in the MBDT library</title>
      <link>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/How-to-define-ISR-for-a-module-which-is-not-contained-in-the/m-p/1396389#M6857</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Hi&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;Marius,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;One problem when I use mbd_mpc574x_user_copy_required_files,That is to generate an error when generating the code:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Yunhe_0-1641641329722.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/167073iD9BAC0036A503D2F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Yunhe_0-1641641329722.png" alt="Yunhe_0-1641641329722.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I declared a function called copy1 directly below the SWT init function：&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Yunhe_1-1641641422468.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/167074iA467AD28FA3D29D8/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Yunhe_1-1641641422468.png" alt="Yunhe_1-1641641422468.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;To pass compilation, I added coder.extrinsic('fullfile');But another error occurred：&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Yunhe_2-1641641779220.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/167075iABBC17B4F9A6957F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Yunhe_2-1641641779220.png" alt="Yunhe_2-1641641779220.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;So again I use the coder.extrinsic function：&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Yunhe_3-1641642125151.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/167076i5B3E52BEAE651D0D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Yunhe_3-1641642125151.png" alt="Yunhe_3-1641642125151.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Finally no error occurred，But there is no "swt_driver.c" I copied in the folder where the code is generated.&lt;/P&gt;&lt;P&gt;I think it may be due to the existence of the coder.extrinsic function in the process of generating the code, and the copy1 function is not run, the help document of MATLAB may explain this problem：&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Yunhe_4-1641642867967.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/167077iEF840CD344D63FF3/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Yunhe_4-1641642867967.png" alt="Yunhe_4-1641642867967.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Actually, I may have misunderstood what you mean, you may mean to make me write a script that copies files by referring to script mbd_mpc574x_user_copy_required_files. Because the script that copies the files doesn't have to generate code, and&amp;nbsp;I did：&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Yunhe_5-1641643227792.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/167078iF21386DF281E92AB/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Yunhe_5-1641643227792.png" alt="Yunhe_5-1641643227792.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;In order to automatically run this script, I use it as a callback function：&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Yunhe_6-1641643387221.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/167079i179B32E2EC09D0E7/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Yunhe_6-1641643387221.png" alt="Yunhe_6-1641643387221.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;According to the CallbackTracing function of Simulink, can see that the copy function does run:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Yunhe_7-1641643567729.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/167080iFFF9D68C1FCBE6A5/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Yunhe_7-1641643567729.png" alt="Yunhe_7-1641643567729.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;But there is still no copied source file in the code generated file：&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Yunhe_8-1641643639513.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/167081i9999317755831338/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Yunhe_8-1641643639513.png" alt="Yunhe_8-1641643639513.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;I think maybe the copy function needs to be executed after the generated code is done, but I don't know how to automate it&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;If I run it manually, copy the source file to the folder where the code is generated, and then import it into S32DS through the XML file, the copied source file cannot actually be imported into the project, so I have to run it manually and copy the source file to Under the directory of the S32DS project.&lt;/P&gt;&lt;P&gt;But I wonder if there is a way to make the script run automatically?&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Best Regards&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Zhang&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 08 Jan 2022 12:27:20 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/How-to-define-ISR-for-a-module-which-is-not-contained-in-the/m-p/1396389#M6857</guid>
      <dc:creator>Yunhe</dc:creator>
      <dc:date>2022-01-08T12:27:20Z</dc:date>
    </item>
  </channel>
</rss>

