<?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: s32k146 基于MBDT在同一条SPI总线配置多个SPI从设备，SIMULINK报错 in Model-Based Design Toolbox (MBDT)</title>
    <link>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/s32k146-%E5%9F%BA%E4%BA%8EMBDT%E5%9C%A8%E5%90%8C%E4%B8%80%E6%9D%A1SPI%E6%80%BB%E7%BA%BF%E9%85%8D%E7%BD%AE%E5%A4%9A%E4%B8%AASPI%E4%BB%8E%E8%AE%BE%E5%A4%87-SIMULINK%E6%8A%A5%E9%94%99/m-p/2159262#M10407</link>
    <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/253658"&gt;@lsw&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I understand in your use case that you need to reconfigure some of the settings for the SPI configuration transfer not only the PCS.&lt;/P&gt;
&lt;P&gt;Unfortunately, the MBDT for S32K1 was not designed to do so, and there are no blocks to help you to support to do that.&lt;/P&gt;
&lt;P&gt;However, there is a way, which involves using custom code insertion, a method which has been discussed in this article:&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;It your case it is simpler than that.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;First you have to generate code for the first configuration you need for the SPI an to identify the generated code sequence as it can be seen below.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="mariuslucianand_0-1756307015558.png" style="width: 999px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/354403iA9E7038B327FC9BD/image-size/large?v=v2&amp;amp;px=999" role="button" title="mariuslucianand_0-1756307015558.png" alt="mariuslucianand_0-1756307015558.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Then, you can duplicate the lpspi_master_config_t structure, and populate it with the settings you need for all the devices connected to the&amp;nbsp; SPI bus.&lt;/P&gt;
&lt;P&gt;Each time you want to adjust the settings, you need to first call the&amp;nbsp;&lt;/P&gt;
&lt;P&gt;LPSPI_DRV_MasterDeinit(uint32_t instance);&lt;/P&gt;
&lt;P&gt;and then followed by the Init function with the required parameters&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="cpp variable tk traceable"&gt;LPSPI_DRV_MasterInit&lt;/SPAN&gt;&lt;SPAN class="cpp traceable"&gt;(&lt;/SPAN&gt;&lt;SPAN class="cpp number tk traceable"&gt;0&lt;/SPAN&gt;&lt;SPAN class="cpp traceable"&gt;,&lt;/SPAN&gt; &lt;SPAN class="cpp operator tk traceable"&gt;&amp;amp;&lt;/SPAN&gt;&lt;SPAN class="cpp variable tk traceable"&gt;lpspiMasterState0&lt;/SPAN&gt;&lt;SPAN class="cpp traceable"&gt;,&lt;/SPAN&gt; &lt;SPAN class="cpp operator tk traceable"&gt;&amp;amp;&lt;/SPAN&gt;&lt;SPAN class="cpp variable tk traceable"&gt;spiConfig0&lt;/SPAN&gt;&lt;SPAN class="cpp traceable"&gt;)&lt;/SPAN&gt;&lt;SPAN class="cpp traceable"&gt;;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="cpp traceable"&gt;Hope this helps,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="cpp traceable"&gt;Marius&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 27 Aug 2025 15:07:24 GMT</pubDate>
    <dc:creator>mariuslucianand</dc:creator>
    <dc:date>2025-08-27T15:07:24Z</dc:date>
    <item>
      <title>s32k146 基于MBDT在同一条SPI总线配置多个SPI从设备，SIMULINK报错</title>
      <link>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/s32k146-%E5%9F%BA%E4%BA%8EMBDT%E5%9C%A8%E5%90%8C%E4%B8%80%E6%9D%A1SPI%E6%80%BB%E7%BA%BF%E9%85%8D%E7%BD%AE%E5%A4%9A%E4%B8%AASPI%E4%BB%8E%E8%AE%BE%E5%A4%87-SIMULINK%E6%8A%A5%E9%94%99/m-p/2149583#M10386</link>
      <description>&lt;P&gt;自开发一个控制器，用的MCU为S32K146&amp;nbsp; 三条SPI总线都挂了多个SPI从设备。同一条SPI设备，存在每个从设备的时钟极性，相位，位宽不一致。这种情形在SIMULINK中根据不同的SPI从设备进行配置。SPI Reconfig模块用于同一总线上连接多个配置不同的从设备（如波特率、时钟极性/相位不同）。这个SPI Reconfig模块如何使用，有没SPI动态配置的示例。&lt;/P&gt;</description>
      <pubDate>Mon, 11 Aug 2025 01:50:20 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/s32k146-%E5%9F%BA%E4%BA%8EMBDT%E5%9C%A8%E5%90%8C%E4%B8%80%E6%9D%A1SPI%E6%80%BB%E7%BA%BF%E9%85%8D%E7%BD%AE%E5%A4%9A%E4%B8%AASPI%E4%BB%8E%E8%AE%BE%E5%A4%87-SIMULINK%E6%8A%A5%E9%94%99/m-p/2149583#M10386</guid>
      <dc:creator>lsw</dc:creator>
      <dc:date>2025-08-11T01:50:20Z</dc:date>
    </item>
    <item>
      <title>Re: s32k146 基于MBDT在同一条SPI总线配置多个SPI从设备，SIMULINK报错</title>
      <link>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/s32k146-%E5%9F%BA%E4%BA%8EMBDT%E5%9C%A8%E5%90%8C%E4%B8%80%E6%9D%A1SPI%E6%80%BB%E7%BA%BF%E9%85%8D%E7%BD%AE%E5%A4%9A%E4%B8%AASPI%E4%BB%8E%E8%AE%BE%E5%A4%87-SIMULINK%E6%8A%A5%E9%94%99/m-p/2159262#M10407</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/253658"&gt;@lsw&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I understand in your use case that you need to reconfigure some of the settings for the SPI configuration transfer not only the PCS.&lt;/P&gt;
&lt;P&gt;Unfortunately, the MBDT for S32K1 was not designed to do so, and there are no blocks to help you to support to do that.&lt;/P&gt;
&lt;P&gt;However, there is a way, which involves using custom code insertion, a method which has been discussed in this article:&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;It your case it is simpler than that.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;First you have to generate code for the first configuration you need for the SPI an to identify the generated code sequence as it can be seen below.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="mariuslucianand_0-1756307015558.png" style="width: 999px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/354403iA9E7038B327FC9BD/image-size/large?v=v2&amp;amp;px=999" role="button" title="mariuslucianand_0-1756307015558.png" alt="mariuslucianand_0-1756307015558.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Then, you can duplicate the lpspi_master_config_t structure, and populate it with the settings you need for all the devices connected to the&amp;nbsp; SPI bus.&lt;/P&gt;
&lt;P&gt;Each time you want to adjust the settings, you need to first call the&amp;nbsp;&lt;/P&gt;
&lt;P&gt;LPSPI_DRV_MasterDeinit(uint32_t instance);&lt;/P&gt;
&lt;P&gt;and then followed by the Init function with the required parameters&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="cpp variable tk traceable"&gt;LPSPI_DRV_MasterInit&lt;/SPAN&gt;&lt;SPAN class="cpp traceable"&gt;(&lt;/SPAN&gt;&lt;SPAN class="cpp number tk traceable"&gt;0&lt;/SPAN&gt;&lt;SPAN class="cpp traceable"&gt;,&lt;/SPAN&gt; &lt;SPAN class="cpp operator tk traceable"&gt;&amp;amp;&lt;/SPAN&gt;&lt;SPAN class="cpp variable tk traceable"&gt;lpspiMasterState0&lt;/SPAN&gt;&lt;SPAN class="cpp traceable"&gt;,&lt;/SPAN&gt; &lt;SPAN class="cpp operator tk traceable"&gt;&amp;amp;&lt;/SPAN&gt;&lt;SPAN class="cpp variable tk traceable"&gt;spiConfig0&lt;/SPAN&gt;&lt;SPAN class="cpp traceable"&gt;)&lt;/SPAN&gt;&lt;SPAN class="cpp traceable"&gt;;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="cpp traceable"&gt;Hope this helps,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="cpp traceable"&gt;Marius&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 27 Aug 2025 15:07:24 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/s32k146-%E5%9F%BA%E4%BA%8EMBDT%E5%9C%A8%E5%90%8C%E4%B8%80%E6%9D%A1SPI%E6%80%BB%E7%BA%BF%E9%85%8D%E7%BD%AE%E5%A4%9A%E4%B8%AASPI%E4%BB%8E%E8%AE%BE%E5%A4%87-SIMULINK%E6%8A%A5%E9%94%99/m-p/2159262#M10407</guid>
      <dc:creator>mariuslucianand</dc:creator>
      <dc:date>2025-08-27T15:07:24Z</dc:date>
    </item>
    <item>
      <title>Re: s32k146 基于MBDT在同一条SPI总线配置多个SPI从设备，SIMULINK报错</title>
      <link>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/s32k146-%E5%9F%BA%E4%BA%8EMBDT%E5%9C%A8%E5%90%8C%E4%B8%80%E6%9D%A1SPI%E6%80%BB%E7%BA%BF%E9%85%8D%E7%BD%AE%E5%A4%9A%E4%B8%AASPI%E4%BB%8E%E8%AE%BE%E5%A4%87-SIMULINK%E6%8A%A5%E9%94%99/m-p/2167921#M10434</link>
      <description>Hi Marius&lt;BR /&gt;When embedding custom C code in Simulink using the C caller method, we need to call the official SPI deinit function and SPI init functions. However, MATLAB compilation fails, indicating that the library function cannot be found and there is a path error. How can the path be set correctly? Additionally, since the MBDT package will also be used, how can these two components coexist and compile in Simulink?&lt;BR /&gt;waiting for your response and help thks!!!</description>
      <pubDate>Thu, 11 Sep 2025 14:06:40 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/s32k146-%E5%9F%BA%E4%BA%8EMBDT%E5%9C%A8%E5%90%8C%E4%B8%80%E6%9D%A1SPI%E6%80%BB%E7%BA%BF%E9%85%8D%E7%BD%AE%E5%A4%9A%E4%B8%AASPI%E4%BB%8E%E8%AE%BE%E5%A4%87-SIMULINK%E6%8A%A5%E9%94%99/m-p/2167921#M10434</guid>
      <dc:creator>lsw</dc:creator>
      <dc:date>2025-09-11T14:06:40Z</dc:date>
    </item>
  </channel>
</rss>

