<?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 Compilation Error for MBD Toolbox S32K3 [using .mex file] in Model-Based Design Toolbox (MBDT)</title>
    <link>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/Compilation-Error-for-MBD-Toolbox-S32K3-using-mex-file/m-p/1817406#M8875</link>
    <description>&lt;P&gt;Dear All,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am using a .mex (as attached) file (Configuration Template) from an existing project.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to get a simple ADC GroupRead [following the example].&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I try to build. I get an error.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Several Files are missing [or not generated].&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also, in the example of ADC stream read.&lt;/P&gt;&lt;P&gt;A function is used "GetStreamLastPointer".&amp;nbsp;&lt;/P&gt;&lt;P&gt;I do not understand the usage for it. As we setup the buffer already.&amp;nbsp;&lt;/P&gt;&lt;P&gt;When we recieve an inturrupt of Group Notification. The buffer should have been filled.&lt;/P&gt;&lt;P&gt;So ideally we should just read the buffer (in IRQ handler) and no additional function shall be needed.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can you please guide for the correct process?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;Tool Details&lt;/U&gt;&lt;/P&gt;&lt;P&gt;Matlab: 2022b&lt;/P&gt;&lt;P&gt;NxP Toolbox:&amp;nbsp;NXP Model-Based Design Toolbox for S32K3xx Series&lt;/P&gt;&lt;P&gt;GCC Compiler&lt;/P&gt;</description>
    <pubDate>Wed, 28 Feb 2024 10:15:11 GMT</pubDate>
    <dc:creator>abhishekkumarbwi</dc:creator>
    <dc:date>2024-02-28T10:15:11Z</dc:date>
    <item>
      <title>Compilation Error for MBD Toolbox S32K3 [using .mex file]</title>
      <link>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/Compilation-Error-for-MBD-Toolbox-S32K3-using-mex-file/m-p/1817406#M8875</link>
      <description>&lt;P&gt;Dear All,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am using a .mex (as attached) file (Configuration Template) from an existing project.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to get a simple ADC GroupRead [following the example].&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I try to build. I get an error.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Several Files are missing [or not generated].&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also, in the example of ADC stream read.&lt;/P&gt;&lt;P&gt;A function is used "GetStreamLastPointer".&amp;nbsp;&lt;/P&gt;&lt;P&gt;I do not understand the usage for it. As we setup the buffer already.&amp;nbsp;&lt;/P&gt;&lt;P&gt;When we recieve an inturrupt of Group Notification. The buffer should have been filled.&lt;/P&gt;&lt;P&gt;So ideally we should just read the buffer (in IRQ handler) and no additional function shall be needed.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can you please guide for the correct process?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;Tool Details&lt;/U&gt;&lt;/P&gt;&lt;P&gt;Matlab: 2022b&lt;/P&gt;&lt;P&gt;NxP Toolbox:&amp;nbsp;NXP Model-Based Design Toolbox for S32K3xx Series&lt;/P&gt;&lt;P&gt;GCC Compiler&lt;/P&gt;</description>
      <pubDate>Wed, 28 Feb 2024 10:15:11 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/Compilation-Error-for-MBD-Toolbox-S32K3-using-mex-file/m-p/1817406#M8875</guid>
      <dc:creator>abhishekkumarbwi</dc:creator>
      <dc:date>2024-02-28T10:15:11Z</dc:date>
    </item>
    <item>
      <title>Re: Compilation Error for MBD Toolbox S32K3 [using .mex file]</title>
      <link>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/Compilation-Error-for-MBD-Toolbox-S32K3-using-mex-file/m-p/1821816#M8891</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/229655"&gt;@abhishekkumarbwi&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for sharing your project with us. While testing the attached model, together with its associated .mex file, I have encountered multiple issues, for which I would like to provide the following information and guidance:&lt;/P&gt;
&lt;P&gt;1. The first error encountered while building the model was related to a failure in the compilation process, due to the fact that multiple files with the same name are present in the sources list. The cause of this issue is represented by the usage of the &lt;STRONG&gt;Port&lt;/STRONG&gt; component together with the &lt;STRONG&gt;Pins Tool&lt;/STRONG&gt; inside your .mex (they both generate configuration files with the same names). MBDT integrates the RTD (Real-Time Drivers) package for enabling the on-board configuration inside S32 Configuration Tools. The Port component and the Pins Tool &lt;STRONG&gt;can't be used simultaneously&lt;/STRONG&gt; inside a .mex file, due to the drivers limitations with respect to these components compatibility.&lt;/P&gt;
&lt;P&gt;The feature of using the Port component together with the Pins Tool &lt;STRONG&gt;will be available in our next release&lt;/STRONG&gt;, which will include a &lt;STRONG&gt;new RTD package version&lt;/STRONG&gt;, where this issue was addressed.&lt;/P&gt;
&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;Proposed Solution&lt;/STRONG&gt;&lt;/U&gt;: Delete the Port component configuration by right clicking on it and selecting Remove, and add the &lt;STRONG&gt;Siul2_Port&lt;/STRONG&gt; component from the Drivers categories. No other settings must be made inside the Siul2_Port component, as it will be used only for initializing the pins as configured in &lt;STRONG&gt;Pins Tool&lt;/STRONG&gt;.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Irina_Costachescu_0-1709662148543.png" style="width: 486px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/266640iFA3B9D7500B98CF6/image-dimensions/486x278?v=v2" width="486" height="278" role="button" title="Irina_Costachescu_0-1709662148543.png" alt="Irina_Costachescu_0-1709662148543.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;2. The .mex file is configured for the &lt;STRONG&gt;S32K312_100MQFP&lt;/STRONG&gt; processor, while your model is set for an application targeting &lt;STRONG&gt;S32K344-Q172&lt;/STRONG&gt;. There must be a match in the project configuration and the processor targeted by the Simulink model, otherwise errors will be thrown during the build process.&lt;/P&gt;
&lt;P&gt;Now depending on which processor you are targeting, please choose the suitable approach for your use case from the ones mentioned below.&lt;/P&gt;
&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;Proposed Solution 1&lt;/STRONG&gt;&lt;/U&gt;: Change the S32K344-Q172 to S32K312-Q172 from the model's &lt;EM&gt;Hardware Settings - Hardware Implementation - Target Hardware Resources group - Hardware - Hardware Part&lt;/EM&gt; widget. This step will reset your configuration template to the default S32K312-Q172 project the toolbox provides, so you would need to reselect your own Configuration Template by pressing the &lt;STRONG&gt;Browse&lt;/STRONG&gt; button. Check also the selection of the blocks in the Simulink model after this process.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Irina_Costachescu_1-1709662296449.png" style="width: 491px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/266641i48646A2569EDE03D/image-dimensions/491x262?v=v2" width="491" height="262" role="button" title="Irina_Costachescu_1-1709662296449.png" alt="Irina_Costachescu_1-1709662296449.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Irina_Costachescu_2-1709662360793.png" style="width: 489px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/266642iF32E58A1403B2CAD/image-dimensions/489x253?v=v2" width="489" height="253" role="button" title="Irina_Costachescu_2-1709662360793.png" alt="Irina_Costachescu_2-1709662360793.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;Proposed Solution 2&lt;/STRONG&gt;&lt;/U&gt;: Change the processor used in the configuration by accessing &lt;EM&gt;File - Switch Processor&amp;nbsp;&lt;/EM&gt;from the S32 Configuration Tools menu. In the opened window choose the S32K344-Q172, as target by your model and perform your configuration updates.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Irina_Costachescu_3-1709662422928.png" style="width: 497px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/266643iBFF25B5A18993C96/image-dimensions/497x393?v=v2" width="497" height="393" role="button" title="Irina_Costachescu_3-1709662422928.png" alt="Irina_Costachescu_3-1709662422928.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Note&lt;/STRONG&gt;: S32K312_100MQFP is not a package that MBDT provides support for, the only available selection being S32K312-Q172. If you would like to use S32K312-Q100 with MBDT, please check the following thread (&lt;A href="https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/MBDT-1-3-0-support-for-S32K312-in-100-pin-MaxQFP/m-p/1640927" target="_self"&gt;link&lt;/A&gt;).&lt;/P&gt;
&lt;P&gt;3. The MBDT models execute on target periodically, and this is implemented with the help of a timer. If you go to the &lt;EM&gt;Timers&lt;/EM&gt; tab in the model's &lt;EM&gt;Configuration Parameters&lt;/EM&gt;, you will see that the Step Timer used by the model is GPT. This timer is loaded with a configurable period and triggers an interrupt whenever the timeout is reached - inside its Interrupt Service Routine the application code is executed. However, in your associated .mex file the &lt;STRONG&gt;Gpt&lt;/STRONG&gt; component is not configured, therefore, using this selection will cause the build to fail.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Irina_Costachescu_4-1709662617674.png" style="width: 481px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/266644i9BCC51A1548A0B01/image-dimensions/481x303?v=v2" width="481" height="303" role="button" title="Irina_Costachescu_4-1709662617674.png" alt="Irina_Costachescu_4-1709662617674.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;Proposed Solution 1&lt;/STRONG&gt;&lt;/U&gt;: Change the model's Step Timer to SysTick (generic Arm timer which does need a .mex configuration).&lt;BR /&gt;&lt;U&gt;&lt;STRONG&gt;Proposed Solution 2&lt;/STRONG&gt;&lt;/U&gt;: Add Gpt component inside your .mex file and configure it appropriately - for reference you can check the S32K312-Q172 default project existent in &lt;EM&gt;&amp;lt;toolbox_root&amp;gt;/mbdtbx_s32k3/devices/S32K312-Q172/s32ds_default_project_config/s32k312-q172.mex.&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;4. &lt;STRONG&gt;Get Clock Frequency API&lt;/STRONG&gt; must be &lt;STRONG&gt;enabled&lt;/STRONG&gt; inside the Clocks Tool for model's timing computation we perform in our toolbox.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Irina_Costachescu_5-1709662724796.png" style="width: 472px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/266645iA710555F79E96618/image-dimensions/472x253?v=v2" width="472" height="253" role="button" title="Irina_Costachescu_5-1709662724796.png" alt="Irina_Costachescu_5-1709662724796.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;5. MBDT currently offers support only for &lt;STRONG&gt;FunctionalGroups&lt;/STRONG&gt; as the &lt;STRONG&gt;ComponentGenerationMethod.&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Irina_Costachescu_7-1709663148998.png" style="width: 486px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/266648i35DBCED94AD6857B/image-dimensions/486x260?v=v2" width="486" height="260" role="button" title="Irina_Costachescu_7-1709663148998.png" alt="Irina_Costachescu_7-1709663148998.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;6. &lt;STRONG&gt;Os&lt;/STRONG&gt; component needs to be enabled - no specific configuration needed - files from other components are requiring Os drivers.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Irina_Costachescu_6-1709662760690.png" style="width: 548px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/266646i45FF56832721EDB8/image-dimensions/548x304?v=v2" width="548" height="304" role="button" title="Irina_Costachescu_6-1709662760690.png" alt="Irina_Costachescu_6-1709662760690.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;7. There are some known issues with the Adc functionalities for reading channels groups, fixed in the attached .zip file. Please download the attached archive and copy the contents from the &lt;STRONG&gt;adc_patch&lt;/STRONG&gt; folder to their right locations inside the toolbox, as it follows:&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;adc.tlc&lt;/STRONG&gt; and &lt;STRONG&gt;adc.c&amp;nbsp;&lt;/STRONG&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; to &lt;EM&gt;&amp;lt;toolbox_root&amp;gt;/mbdtbx_s32k3/+mbd_s32k3/+common/blocks/adc&lt;/EM&gt;&lt;BR /&gt;&lt;STRONG&gt;s32k3_adc.mexw64&lt;/STRONG&gt;&amp;nbsp; to &lt;EM&gt;&amp;lt;toolbox_root&amp;gt;/mbdtbx_s32k3/blocks/adc&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;Also, inside the archive you could also find an updated version of the files that you have sent, containing modifications for the steps 1-6, with the following mentions:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;STRONG&gt;PIL_RoPPConfig.mex:&lt;/STRONG&gt;&lt;BR /&gt;- used Siul2_Port instead of Port&lt;BR /&gt;- enabled the Get Clock Frequency API&lt;BR /&gt;- changed ComponentGenerationMethod selection to Functional Groups&lt;BR /&gt;- added Os component&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;PIL_RoPP.slx:&lt;/STRONG&gt;&lt;BR /&gt;- changed the model for the S32K312-Q172 Hardware Part&lt;BR /&gt;- changed the model to use SysTick instead of GPT as the Step Timer&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;The model builds successfully with these updates on its settings and inside its associated .mex, however please consider it only as a reference of how to obtain a working setup, and feel free to perform your own changes, as needed by your project, based on the above explanations.&lt;/P&gt;
&lt;P&gt;Also, please consider performing a backup of the .mex I have attached in a location different than the one where the model is placed, to avoid its overwriting during various tests you may perform with your model.&lt;/P&gt;
&lt;P&gt;As for the usage of the Adc_GetStreamLastPointer I would like to point you to the &lt;A href="https://www.autosar.org/fileadmin/standards/R22-11/CP/AUTOSAR_SWS_ADCDriver.pdf" target="_self"&gt;AUTOSAR documentation&lt;/A&gt; which I find to be explained very well &lt;STRONG&gt;(Chapter 7.1.3 ADC Buffer Access Mode Example)&lt;/STRONG&gt;.&lt;/P&gt;
&lt;P&gt;Please let us know if further information is needed.&lt;/P&gt;
&lt;P&gt;Hope this helps,&lt;/P&gt;
&lt;P&gt;Irina&lt;/P&gt;</description>
      <pubDate>Tue, 05 Mar 2024 18:37:34 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/Compilation-Error-for-MBD-Toolbox-S32K3-using-mex-file/m-p/1821816#M8891</guid>
      <dc:creator>Irina_Costachescu</dc:creator>
      <dc:date>2024-03-05T18:37:34Z</dc:date>
    </item>
  </channel>
</rss>

