<?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: MR-CANHUBK344 SPI in Model-Based Design Toolbox (MBDT)</title>
    <link>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/MR-CANHUBK344-SPI/m-p/1773909#M8715</link>
    <description>&lt;P&gt;Hello &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;Regarding the question about using SPI in the P1A connector, that involves configuring the pins for the SPI1 instance.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="robertv_0-1702467122570.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/254206i2F8B2BC63761C722/image-size/medium?v=v2&amp;amp;px=400" role="button" title="robertv_0-1702467122570.png" alt="robertv_0-1702467122570.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Afterwards, the SPI1 instance has to be configured for the desired functionality in the SpiPhyUnit tab inside the SpiGeneral tab. This involves choosing the SPI instance, SpiPhyUnitMapping and SpiPhyUnitMode.&lt;/P&gt;
&lt;P&gt;As for the other question, the SPI driver expects uint8 data as input. So, when sending data, it has to be broken into uint8 values. To be able to send multiple uint8 values, you will have to use a Data Store Memory, configured as an array of uint8 values.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="robertv_1-1702467155073.png" style="width: 999px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/254207i83C5AE25D55C4468/image-size/large?v=v2&amp;amp;px=999" role="button" title="robertv_1-1702467155073.png" alt="robertv_1-1702467155073.png" /&gt;&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;Choosing the type of buffer being used also has an influence on the SPI transfer. &lt;BR /&gt;When using the internal buffer, the user has to configure the number of buffers utilized when sending data, by modifying the SpiIbNBuffers field. &lt;BR /&gt;When using an external buffer, this is no longer an issue. On the other hand, the user can choose the maximum number of buffers that can be used - by default it's set to 1000.&lt;/P&gt;
&lt;P&gt;So, in your case, I would suggest using the external buffer, chosen by selecting the "EB" option for the SpiChannelType field, along with the Spi_SetupEB function of the Spi block, to be able to store data in the buffer.&lt;/P&gt;
&lt;P&gt;The SpiDataWidth option being set to 16 still involves using uint8 variables as inputs. One aspect that should be taken into consideration is how the data is ordered afterwards.&lt;BR /&gt;Sending the following array, [1 2 3 4] would show up as [2 1 | 4 3] on the analyzer. Two 16-bit frames, each made up of two 8-bit values which end up reversed because of the order of the transmission.&lt;BR /&gt;Setting SpiDataWidth to 8 and sending the same array would show up as [ 1 | 2 | 3 | 4]. Four 8-bit frames, each made up of its own 8 bit value.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;Regards,&lt;BR /&gt;Robert V&lt;/P&gt;</description>
    <pubDate>Wed, 13 Dec 2023 11:36:12 GMT</pubDate>
    <dc:creator>robertv</dc:creator>
    <dc:date>2023-12-13T11:36:12Z</dc:date>
    <item>
      <title>MR-CANHUBK344 SPI</title>
      <link>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/MR-CANHUBK344-SPI/m-p/1770950#M8706</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to send 16-bit data on SPI. Getting the following error:&lt;/P&gt;&lt;P&gt;&lt;EM&gt;"Data type mismatch. '&lt;A href="matlab:slprivate('open_and_hilite_port_hyperlink', 'hilite', ['mrcanhubk344_dio_s32ct/Triggered Subsystem/Spi'], 'Inport', 1);" target="_blank"&gt;Input Port 1&lt;/A&gt;' of '&lt;A href="matlab:open_and_hilite_hyperlink ('mrcanhubk344_dio_s32ct/Triggered Subsystem/Spi','error')" target="_blank"&gt;mrcanhubk344_dio_s32ct/Triggered Subsystem/Spi&lt;/A&gt;' expects a signal of data type 'uint8'. However, it is driven by a signal of data type 'uint16'"&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="avi_magna_0-1701968876443.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/253440iE30281623B5E3D75/image-size/medium?v=v2&amp;amp;px=400" role="button" title="avi_magna_0-1701968876443.png" alt="avi_magna_0-1701968876443.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Where can I change the data type to uint16 ?&lt;/P&gt;&lt;P&gt;I am using the channel 0 on P1A connector&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="avi_magna_1-1701969097981.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/253441i66296D844FADE642/image-size/medium?v=v2&amp;amp;px=400" role="button" title="avi_magna_1-1701969097981.png" alt="avi_magna_1-1701969097981.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Peripherals settings are as follows, I have updated the SpiDataWidth to 16.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="avi_magna_2-1701969135809.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/253442i6C4ACEA15FBC0E20/image-size/medium?v=v2&amp;amp;px=400" role="button" title="avi_magna_2-1701969135809.png" alt="avi_magna_2-1701969135809.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Thanks&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>Thu, 07 Dec 2023 17:14:58 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/MR-CANHUBK344-SPI/m-p/1770950#M8706</guid>
      <dc:creator>ankitv</dc:creator>
      <dc:date>2023-12-07T17:14:58Z</dc:date>
    </item>
    <item>
      <title>Re: MR-CANHUBK344 SPI</title>
      <link>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/MR-CANHUBK344-SPI/m-p/1773909#M8715</link>
      <description>&lt;P&gt;Hello &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;Regarding the question about using SPI in the P1A connector, that involves configuring the pins for the SPI1 instance.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="robertv_0-1702467122570.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/254206i2F8B2BC63761C722/image-size/medium?v=v2&amp;amp;px=400" role="button" title="robertv_0-1702467122570.png" alt="robertv_0-1702467122570.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Afterwards, the SPI1 instance has to be configured for the desired functionality in the SpiPhyUnit tab inside the SpiGeneral tab. This involves choosing the SPI instance, SpiPhyUnitMapping and SpiPhyUnitMode.&lt;/P&gt;
&lt;P&gt;As for the other question, the SPI driver expects uint8 data as input. So, when sending data, it has to be broken into uint8 values. To be able to send multiple uint8 values, you will have to use a Data Store Memory, configured as an array of uint8 values.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="robertv_1-1702467155073.png" style="width: 999px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/254207i83C5AE25D55C4468/image-size/large?v=v2&amp;amp;px=999" role="button" title="robertv_1-1702467155073.png" alt="robertv_1-1702467155073.png" /&gt;&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;Choosing the type of buffer being used also has an influence on the SPI transfer. &lt;BR /&gt;When using the internal buffer, the user has to configure the number of buffers utilized when sending data, by modifying the SpiIbNBuffers field. &lt;BR /&gt;When using an external buffer, this is no longer an issue. On the other hand, the user can choose the maximum number of buffers that can be used - by default it's set to 1000.&lt;/P&gt;
&lt;P&gt;So, in your case, I would suggest using the external buffer, chosen by selecting the "EB" option for the SpiChannelType field, along with the Spi_SetupEB function of the Spi block, to be able to store data in the buffer.&lt;/P&gt;
&lt;P&gt;The SpiDataWidth option being set to 16 still involves using uint8 variables as inputs. One aspect that should be taken into consideration is how the data is ordered afterwards.&lt;BR /&gt;Sending the following array, [1 2 3 4] would show up as [2 1 | 4 3] on the analyzer. Two 16-bit frames, each made up of two 8-bit values which end up reversed because of the order of the transmission.&lt;BR /&gt;Setting SpiDataWidth to 8 and sending the same array would show up as [ 1 | 2 | 3 | 4]. Four 8-bit frames, each made up of its own 8 bit value.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;Regards,&lt;BR /&gt;Robert V&lt;/P&gt;</description>
      <pubDate>Wed, 13 Dec 2023 11:36:12 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/MR-CANHUBK344-SPI/m-p/1773909#M8715</guid>
      <dc:creator>robertv</dc:creator>
      <dc:date>2023-12-13T11:36:12Z</dc:date>
    </item>
  </channel>
</rss>

