<?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: SPI Peripheral Configuration in Model-Based Design Toolbox (MBDT)</title>
    <link>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/SPI-Peripheral-Configuration/m-p/1774911#M8721</link>
    <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/224440"&gt;@ankitv&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;I have looked over the attached project and identified the problem. When the LPSPI_2 instance was replaced with the LPSPI_4 instance inside the SpiGeneral -&amp;gt; SpiPhyUnit, the instance was removed from use, but the interrupts were not updated to reflect that.&lt;/P&gt;
&lt;P&gt;The following settings will be found inside Platform -&amp;gt; Interrupt Controller.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="robertv_1-1702568373291.png" style="width: 999px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/254465i09CC51B9123E713A/image-size/large?v=v2&amp;amp;px=999" role="button" title="robertv_1-1702568373291.png" alt="robertv_1-1702568373291.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;To solve the error, the interrupt for the LPSPI_2 has to be changed to &lt;EM&gt;undefined_handler&amp;nbsp;&lt;/EM&gt;and disabled using the checkbox.&lt;BR /&gt;Additionally, the newly configured instance's interrupts must be enabled by clicking the checkbox, setting a priority level and an interrupt handler, &lt;EM&gt;Lpspi_lp_LPSPI_4_IRQHandler&lt;/EM&gt;.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="robertv_2-1702568488766.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/254466i27B843C7D9DF3EDB/image-size/medium?v=v2&amp;amp;px=400" role="button" title="robertv_2-1702568488766.png" alt="robertv_2-1702568488766.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note: ADC1's interrupt priority is set to 5 and having the LPSPI_4's priority set to the same level could cause the CS line of the SPI to behave differently than normal, so I advise you to use a lower value, which translates to a higher priority.&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Robert V&lt;/P&gt;</description>
    <pubDate>Thu, 14 Dec 2023 15:48:34 GMT</pubDate>
    <dc:creator>robertv</dc:creator>
    <dc:date>2023-12-14T15:48:34Z</dc:date>
    <item>
      <title>SPI Peripheral Configuration</title>
      <link>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/SPI-Peripheral-Configuration/m-p/1773618#M8712</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;&lt;BR /&gt;I am using &lt;SPAN&gt;MR-CANHUBK344. I want to use SPI as a master device. I have configured the GPIO SPI pins (17 18 20 21) as follows:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ankitv_1-1702448194944.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/254114iA94479DD4AC068EF/image-size/medium?v=v2&amp;amp;px=400" role="button" title="ankitv_1-1702448194944.png" alt="ankitv_1-1702448194944.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ankitv_0-1702448086307.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/254113i1C3698DB367D8B2D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="ankitv_0-1702448086307.png" alt="ankitv_0-1702448086307.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Can you please advise how to configure the peripherals?&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ankitv_2-1702448272293.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/254115iF5DE81EC368AA217/image-size/medium?v=v2&amp;amp;px=400" role="button" title="ankitv_2-1702448272293.png" alt="ankitv_2-1702448272293.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and what blocks do I need to add in the MBDT?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ankitv_3-1702448384417.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/254116i97CD77AE01FAC7AE/image-size/medium?v=v2&amp;amp;px=400" role="button" title="ankitv_3-1702448384417.png" alt="ankitv_3-1702448384417.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I do not read any signal on the PINS using a oscilloscope. Thanks&lt;/P&gt;&lt;P&gt;-Ankit&lt;/P&gt;</description>
      <pubDate>Wed, 13 Dec 2023 06:20:16 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/SPI-Peripheral-Configuration/m-p/1773618#M8712</guid>
      <dc:creator>ankitv</dc:creator>
      <dc:date>2023-12-13T06:20:16Z</dc:date>
    </item>
    <item>
      <title>Re: SPI Peripheral Configuration</title>
      <link>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/SPI-Peripheral-Configuration/m-p/1773843#M8714</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/224440"&gt;@ankitv&lt;/a&gt;&amp;nbsp;,&lt;BR /&gt;&lt;BR /&gt;Since the direction of the pins is not visible in the attached image, I would like to double check it with you.&lt;BR /&gt;When configuring a Master instance, lpspi4_sin should be an input, while the other 3 signals are configured as outputs.&lt;BR /&gt;&lt;BR /&gt;Also, to verify the physical connections, these are the SPI4 pins:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="robertv_0-1702459082400.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/254148iB237C29647CA3DDE/image-size/medium?v=v2&amp;amp;px=400" role="button" title="robertv_0-1702459082400.png" alt="robertv_0-1702459082400.png" /&gt;&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;Regarding the peripheral configuration, the first step is to configure the SPI instance as a master instance.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="robertv_1-1702459297606.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/254149i90BFB2C674DF5500/image-size/medium?v=v2&amp;amp;px=400" role="button" title="robertv_1-1702459297606.png" alt="robertv_1-1702459297606.png" /&gt;&lt;/span&gt;&lt;BR /&gt;From your SpiDriver screenshot, everything looks alright. Maintaining the default settings would work fine here.&lt;BR /&gt;&lt;BR /&gt;As for the MBDT&amp;nbsp; blocks needed, you need an SPI block to Spi_SetAsyncMode, along with the blocks responsible for storing data in the buffer, sending the data and then validating that the data has been sent using a hardware interrupt callback&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="robertv_4-1702460738252.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/254176i49A65047AA5E5634/image-size/medium?v=v2&amp;amp;px=400" role="button" title="robertv_4-1702460738252.png" alt="robertv_4-1702460738252.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="robertv_3-1702459836618.png" style="width: 999px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/254155i33BA0E9176FC33E8/image-size/large?v=v2&amp;amp;px=999" role="button" title="robertv_3-1702459836618.png" alt="robertv_3-1702459836618.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The "data" Data Store Read instance contains an array of elements of data type uint8 since that is what the SPI driver expects.&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Robert V&lt;/P&gt;</description>
      <pubDate>Wed, 13 Dec 2023 10:14:14 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/SPI-Peripheral-Configuration/m-p/1773843#M8714</guid>
      <dc:creator>robertv</dc:creator>
      <dc:date>2023-12-13T10:14:14Z</dc:date>
    </item>
    <item>
      <title>Re: SPI Peripheral Configuration</title>
      <link>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/SPI-Peripheral-Configuration/m-p/1774213#M8720</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/219933"&gt;@robertv&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;I am getting the following error:&amp;nbsp;&lt;SPAN&gt; undefined reference to `Lpspi_Ip_LPSPI_2_IRQHandler'&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ankitv_1-1702505360042.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/254274i1CD0ADDB7F87BDB1/image-size/medium?v=v2&amp;amp;px=400" role="button" title="ankitv_1-1702505360042.png" alt="ankitv_1-1702505360042.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;BR /&gt;To confirm, I am using the same pins as shown in the image below&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ankitv_0-1702504175302.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/254267i697DBCF0115958DA/image-size/medium?v=v2&amp;amp;px=400" role="button" title="ankitv_0-1702504175302.png" alt="ankitv_0-1702504175302.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Pins are configured as output except for&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;lpspi4_sin&amp;nbsp;which is input.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ankitv_2-1702505490784.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/254275iAB667A04E00F7FB7/image-size/medium?v=v2&amp;amp;px=400" role="button" title="ankitv_2-1702505490784.png" alt="ankitv_2-1702505490784.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I am attaching my project zip for your reference. Can you please help ? Thanks&lt;/P&gt;&lt;P&gt;-Ankit&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;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Dec 2023 22:13:37 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/SPI-Peripheral-Configuration/m-p/1774213#M8720</guid>
      <dc:creator>ankitv</dc:creator>
      <dc:date>2023-12-13T22:13:37Z</dc:date>
    </item>
    <item>
      <title>Re: SPI Peripheral Configuration</title>
      <link>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/SPI-Peripheral-Configuration/m-p/1774911#M8721</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/224440"&gt;@ankitv&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;I have looked over the attached project and identified the problem. When the LPSPI_2 instance was replaced with the LPSPI_4 instance inside the SpiGeneral -&amp;gt; SpiPhyUnit, the instance was removed from use, but the interrupts were not updated to reflect that.&lt;/P&gt;
&lt;P&gt;The following settings will be found inside Platform -&amp;gt; Interrupt Controller.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="robertv_1-1702568373291.png" style="width: 999px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/254465i09CC51B9123E713A/image-size/large?v=v2&amp;amp;px=999" role="button" title="robertv_1-1702568373291.png" alt="robertv_1-1702568373291.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;To solve the error, the interrupt for the LPSPI_2 has to be changed to &lt;EM&gt;undefined_handler&amp;nbsp;&lt;/EM&gt;and disabled using the checkbox.&lt;BR /&gt;Additionally, the newly configured instance's interrupts must be enabled by clicking the checkbox, setting a priority level and an interrupt handler, &lt;EM&gt;Lpspi_lp_LPSPI_4_IRQHandler&lt;/EM&gt;.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="robertv_2-1702568488766.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/254466i27B843C7D9DF3EDB/image-size/medium?v=v2&amp;amp;px=400" role="button" title="robertv_2-1702568488766.png" alt="robertv_2-1702568488766.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note: ADC1's interrupt priority is set to 5 and having the LPSPI_4's priority set to the same level could cause the CS line of the SPI to behave differently than normal, so I advise you to use a lower value, which translates to a higher priority.&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Robert V&lt;/P&gt;</description>
      <pubDate>Thu, 14 Dec 2023 15:48:34 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/SPI-Peripheral-Configuration/m-p/1774911#M8721</guid>
      <dc:creator>robertv</dc:creator>
      <dc:date>2023-12-14T15:48:34Z</dc:date>
    </item>
    <item>
      <title>Re: SPI Peripheral Configuration</title>
      <link>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/SPI-Peripheral-Configuration/m-p/1775707#M8723</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/219933"&gt;@robertv&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;That resolved the issue and I was able to build and deploy. However, I am still not getting the desired signal on the SPI pins. I connected an external oscilloscope but could not read any signal. My Freemaster config looks like this&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ankitv_0-1702661780044.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/254675i081A14BBB87E9AC9/image-size/medium?v=v2&amp;amp;px=400" role="button" title="ankitv_0-1702661780044.png" alt="ankitv_0-1702661780044.png" /&gt;&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;In the above image, the logic seems to be working as my "master_send" increments by 1 everytime I press the "USER_SW1", which indicates a successful transmissions&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ankitv_1-1702661905792.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/254676i6CB7F033CD8FC7BE/image-size/medium?v=v2&amp;amp;px=400" role="button" title="ankitv_1-1702661905792.png" alt="ankitv_1-1702661905792.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="ankitv_2-1702661924698.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/254677i587EDD8DCA8786FE/image-size/medium?v=v2&amp;amp;px=400" role="button" title="ankitv_2-1702661924698.png" alt="ankitv_2-1702661924698.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Is there a way I can monitor the signal on LPSPI4_MOSI, LPSPI4_MISO, LPSPI4_CS0 AND LPSPI4_CS0 in the free master tool ? Just to make sure that I am sending the right bits?&lt;BR /&gt;&lt;BR /&gt;Signal I want to send: Should toggle the SCLK for each bit, and Chip Select (CS) should be pulled low during the entire data frame&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ankitv_4-1702662474121.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/254679i9A19250DAD80C86E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="ankitv_4-1702662474121.png" alt="ankitv_4-1702662474121.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="ankitv_5-1702662526404.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/254680iD8DEBC36A2BBFE2D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="ankitv_5-1702662526404.png" alt="ankitv_5-1702662526404.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I have attached a sample Arduino code that generates the above mentioned desired signal.&lt;BR /&gt;&lt;BR /&gt;Another query:&lt;BR /&gt;Since I am using the MRCANHUB board as a Master device, the PIN LPSPI4_MOSI (PTB11) should it not be Output and PIN LPSPI4_MISO (PTB9) as an Input ?&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ankitv_3-1702662354882.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/254678i0064F890B8466223/image-size/medium?v=v2&amp;amp;px=400" role="button" title="ankitv_3-1702662354882.png" alt="ankitv_3-1702662354882.png" /&gt;&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;Kind Regards,&lt;BR /&gt;-Ankit&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 15 Dec 2023 18:03:20 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/SPI-Peripheral-Configuration/m-p/1775707#M8723</guid>
      <dc:creator>ankitv</dc:creator>
      <dc:date>2023-12-15T18:03:20Z</dc:date>
    </item>
    <item>
      <title>Re: SPI Peripheral Configuration</title>
      <link>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/SPI-Peripheral-Configuration/m-p/1776493#M8724</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/224440"&gt;@ankitv&lt;/a&gt;&amp;nbsp;,&lt;BR /&gt;&lt;BR /&gt;After building and deploying the model you have attached here, along with the suggested fixes from my last reply, I validated that the SPI instance was sending data using a logic analyzer.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="robertv_1-1702910154682.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/254871i4B69292EF65C2567/image-size/medium?v=v2&amp;amp;px=400" role="button" title="robertv_1-1702910154682.png" alt="robertv_1-1702910154682.png" /&gt;&lt;/span&gt;&lt;BR /&gt;Unfortunately the FreeMASTER tool does not provide the ability to monitor signals the way a logic analyzer would.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Since the Job0 transmission ends properly, it indicates that the board is sending the SPI data, so that theoretically points us towards connection issues.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;First, I would suggest running the application without any other devices connected to the MR-CANHUBK344 board.&lt;BR /&gt;Connecting the MR-CANHUB's LPSPI_4's pins directly to an oscilloscope/logic analyzer would show if the signals are being generated by the board. One other thing worth mentioning is that the HIGH level is 3.3 Volts.&lt;BR /&gt;&lt;BR /&gt;Regarding the question about the signal's direction, I understand that the schematic might be unclear when it comes to the labels.&lt;BR /&gt;According to the S32K3 Reference Manual, SIN is an input and SOUT is an output.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="robertv_0-1702910017744.png" style="width: 999px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/254870iEA72C58667B2F352/image-size/large?v=v2&amp;amp;px=999" role="button" title="robertv_0-1702910017744.png" alt="robertv_0-1702910017744.png" /&gt;&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;Since the instance is configured as master, the data out line represents a master output, so it should connect to a slave input on the other device.&amp;nbsp; And similarly for the data input signal, which should be connected to the other device's output SPI pin.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="robertv_2-1702911282920.png" style="width: 999px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/254874i99B5B68C1C9F8C7E/image-size/large?v=v2&amp;amp;px=999" role="button" title="robertv_2-1702911282920.png" alt="robertv_2-1702911282920.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Robert V&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 18 Dec 2023 16:41:59 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/SPI-Peripheral-Configuration/m-p/1776493#M8724</guid>
      <dc:creator>robertv</dc:creator>
      <dc:date>2023-12-18T16:41:59Z</dc:date>
    </item>
    <item>
      <title>Re: SPI Peripheral Configuration</title>
      <link>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/SPI-Peripheral-Configuration/m-p/1777276#M8726</link>
      <description>&lt;P&gt;Hi Robert,&lt;BR /&gt;I got the model working. After analyzing the signal I found that my CS and CLK were inverted. The image below shows fixed CS but CLK as inverted. After correcting CLK as well, I got the desired signal.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ankitv_0-1702999882583.jpeg" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/255095iC1DF3D46C39215E9/image-size/medium?v=v2&amp;amp;px=400" role="button" title="ankitv_0-1702999882583.jpeg" alt="ankitv_0-1702999882583.jpeg" /&gt;&lt;/span&gt;&lt;BR /&gt;I did this by changing the "output inversion select" from Pin config&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ankitv_1-1702999967025.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/255096i137F6623F93F6ADA/image-size/medium?v=v2&amp;amp;px=400" role="button" title="ankitv_1-1702999967025.png" alt="ankitv_1-1702999967025.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Another issue I faced was of the FreeMaster Tool. While I am sending [8 128] as an array which corresponds to 00001000 10000000 in binary and 2176 in decimal. The FreeMaster tool is reading it as [128 8] which is 10000000 00001000 in binary and 32776 in decimal&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ankitv_2-1703000317707.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/255099i3C215A5B9A0438CC/image-size/medium?v=v2&amp;amp;px=400" role="button" title="ankitv_2-1703000317707.png" alt="ankitv_2-1703000317707.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Is there any way I could fix this so that I can quickly monitor the correct 16bit signal that I am sending and receiving? Thanks.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;-Ankit&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Dec 2023 15:40:48 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/SPI-Peripheral-Configuration/m-p/1777276#M8726</guid>
      <dc:creator>ankitv</dc:creator>
      <dc:date>2023-12-19T15:40:48Z</dc:date>
    </item>
    <item>
      <title>Re: SPI Peripheral Configuration</title>
      <link>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/SPI-Peripheral-Configuration/m-p/1778016#M8727</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/224440"&gt;@ankitv&lt;/a&gt;&amp;nbsp;,&lt;BR /&gt;&lt;BR /&gt;Regarding the polarity inversion for the clock, one other thing you could try is the "SpiShiftClockIdleLevel" setting inside SpiDriver. This allows you to set the Clock level outside of the transmission. The level should be the same between the connected devices, as to avoid errors.&amp;nbsp;&lt;BR /&gt;In the same section, there's a setting for "SpiCsSelection" that defines the active polarity of Chip Select, in case you want to change that as well.&lt;BR /&gt;I'm not aware whether using the Output Inversion option, instead of the SPI peripheral settings, leads to the same result or not, but I recommend keeping the alternatives in mind.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="robertv_0-1703078125645.png" style="width: 999px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/255308i720032DC83CC6E90/image-size/large?v=v2&amp;amp;px=999" role="button" title="robertv_0-1703078125645.png" alt="robertv_0-1703078125645.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;From what I can tell from your oscilloscope picture, you are using SpiDataWidth set to 8 and sending 8 bits of data twice, leading to a transfer of 16 bits in the same SPI message. And judging from the master out signal, I think the data is received as [128 8], which does not look normal since the bytes should not be reordered.&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Regarding the FreeMASTER question, I managed to find a solution. In FreeMASTER, the data from the Data Store Memory (the array) has its bits concatenated into a 16 bit value, but not before reordering the bytes, due to&amp;nbsp;endianness.&amp;nbsp;&lt;BR /&gt;A solution to this would be to use the array's indexes to see the values in the order they are stored in Simulink.&lt;BR /&gt;&lt;SPAN&gt;&lt;SPAN class="ui-provider a b c d e f g h i j k l m n o p q r s t u v w x y z ab ac ae af ag ah ai aj ak"&gt;The second solution would be to use a few simulink blocks to invert the bytes, which will allow the data in FreeMASTER to be displayed as initially declared.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;BR /&gt;Below you can see how you can access the data using indexes, and also that outputting a different variable (spi_data_reversed), that contains the reversed bytes shows the value you are expecting.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="robertv_1-1703080396859.png" style="width: 999px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/255311iD0954E36614D2C2D/image-size/large?v=v2&amp;amp;px=999" role="button" title="robertv_1-1703080396859.png" alt="robertv_1-1703080396859.png" /&gt;&lt;/span&gt;&lt;BR /&gt;To obtain the reversed value, you will need another Data Store Memory and the Byte Unpack, Byte Reversal and the Byte Pack blocks.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="robertv_2-1703080569297.png" style="width: 999px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/255312i6BC58963F72A5E2E/image-size/large?v=v2&amp;amp;px=999" role="button" title="robertv_2-1703080569297.png" alt="robertv_2-1703080569297.png" /&gt;&lt;/span&gt;&lt;BR /&gt;They have to be configured as follows:&lt;BR /&gt;The Data Store Memory that will hold the reversed data has to be set up similarly to the original Data Store Memory block, same array initialization, same data type.&lt;BR /&gt;Byte Unpack receives 2 uint8 values and transforms them into a uint16 value.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="robertv_3-1703080683572.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/255313i3FDBD460347756DE/image-size/medium?v=v2&amp;amp;px=400" role="button" title="robertv_3-1703080683572.png" alt="robertv_3-1703080683572.png" /&gt;&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;The Byte Reversal block only needs to have the number of inputs configured. This changes the order of the bytes in the variable.&lt;BR /&gt;For example&lt;BR /&gt;11001000 01110011 -&amp;gt; Byte Reversal -&amp;gt;&amp;nbsp;01110011&amp;nbsp;11001000&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="robertv_5-1703080787411.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/255315iABD6FF8FDC4CA106/image-size/medium?v=v2&amp;amp;px=400" role="button" title="robertv_5-1703080787411.png" alt="robertv_5-1703080787411.png" /&gt;&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;Byte Pack has to be configured to accept uint16 as input.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="robertv_4-1703080748840.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/255314i84CB64BC80936A73/image-size/medium?v=v2&amp;amp;px=400" role="button" title="robertv_4-1703080748840.png" alt="robertv_4-1703080748840.png" /&gt;&lt;/span&gt;&lt;BR /&gt;After that, you will be able to see the initial bytes in FreeMASTER after adding the variable to the Variable Watch section.&lt;/P&gt;
&lt;P&gt;This newly obtained Data Store Read variable can also be used as an input for the SPI, sending the bytes in a different order.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Robert V&lt;/P&gt;</description>
      <pubDate>Wed, 20 Dec 2023 14:25:53 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/SPI-Peripheral-Configuration/m-p/1778016#M8727</guid>
      <dc:creator>robertv</dc:creator>
      <dc:date>2023-12-20T14:25:53Z</dc:date>
    </item>
    <item>
      <title>Re: SPI Peripheral Configuration</title>
      <link>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/SPI-Peripheral-Configuration/m-p/1795513#M8793</link>
      <description>&lt;P&gt;I am currently trying to send SPI commands to a motor driver by configuring the MR-CANHUBK344 evaluation board as a MASTER. Here are my pin configurations using lpspi2. I just want to confirm which 4 SPI pins from the connectors that I should connect my motor driver to.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Bravin_Link_0-1706197142555.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/260114i469C540F51BEECCB/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Bravin_Link_0-1706197142555.png" alt="Bravin_Link_0-1706197142555.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;My current setup is shown below which utilizes the P1B connector which is shown in the schematic:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Bravin_Link_3-1706197287011.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/260117i2683CBA70C9B8DAF/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Bravin_Link_3-1706197287011.png" alt="Bravin_Link_3-1706197287011.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Bravin_Link_4-1706197961851.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/260118i04ACC97FD8078458/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Bravin_Link_4-1706197961851.png" alt="Bravin_Link_4-1706197961851.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 25 Jan 2024 15:53:07 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/SPI-Peripheral-Configuration/m-p/1795513#M8793</guid>
      <dc:creator>Bravin_Link</dc:creator>
      <dc:date>2024-01-25T15:53:07Z</dc:date>
    </item>
    <item>
      <title>Re: SPI Peripheral Configuration</title>
      <link>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/SPI-Peripheral-Configuration/m-p/1795956#M8798</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/220546"&gt;@Bravin_Link&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;First of all, it seems like the pins showcased in the configuration screenshot do not match with MR-CANHUBK344's LPSPI2 pins. More info regarding the setup process can be found in the first article from the MR-CANHUBK344 series,&amp;nbsp;&lt;A href="https://community.nxp.com/t5/NXP-Model-Based-Design-Tools/Interacting-with-Digital-Inputs-Outputs-on-MR-CANHUBK344/ta-p/1746789" target="_blank"&gt;https://community.nxp.com/t5/NXP-Model-Based-Design-Tools/Interacting-with-Digital-Inputs-Outputs-on-MR-CANHUBK344/ta-p/1746789&lt;/A&gt;&amp;nbsp;.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I will attach the MR-CANHUBK344's LPSPI2 pins (obtained from the schematic) below:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="robertv_0-1706258573310.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/260248i9F1498EA4BA925D6/image-size/medium?v=v2&amp;amp;px=400" role="button" title="robertv_0-1706258573310.png" alt="robertv_0-1706258573310.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Since MR-CANHUBK344 uses a custom configuration currently (available as a .mex file in the attachments from the articles), peripherals outside the ones configured in the article series (DIO, ADC, PWM, UART) must be configured separately. In this thread you can find some info regarding the configuration of the SPI peripheral, but the main difference will probably the pins.&lt;/P&gt;
&lt;P&gt;The SIN signal is the input (MISO in case the instance is a master, MOSI in case the instance is a slave) and the SOUT signal is the output (MOSI in case the instance is a master, MISO in case the instance is a slave).&lt;/P&gt;
&lt;P&gt;What I can recommend in this case is making sure that the SIN signal that comes from the MR-CANHUBK344 is connected to the MISO line and that the SOUT signal is connected to the MOSI line (avoiding the confusing label names found in the schematic).&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;BR /&gt;Robert V&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 26 Jan 2024 09:01:49 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/SPI-Peripheral-Configuration/m-p/1795956#M8798</guid>
      <dc:creator>robertv</dc:creator>
      <dc:date>2024-01-26T09:01:49Z</dc:date>
    </item>
  </channel>
</rss>

