<?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 use SPI_MasterTransferBlocking and SPI_MasterTransfer properly? in MPC5xxx</title>
    <link>https://community.nxp.com/t5/MPC5xxx/How-to-use-SPI-MasterTransferBlocking-and-SPI-MasterTransfer/m-p/1685479#M23923</link>
    <description>&lt;P&gt;Thanks!! It worked!!&lt;/P&gt;</description>
    <pubDate>Tue, 11 Jul 2023 06:57:53 GMT</pubDate>
    <dc:creator>AhpKim</dc:creator>
    <dc:date>2023-07-11T06:57:53Z</dc:date>
    <item>
      <title>How to use SPI_MasterTransferBlocking and SPI_MasterTransfer properly?</title>
      <link>https://community.nxp.com/t5/MPC5xxx/How-to-use-SPI-MasterTransferBlocking-and-SPI-MasterTransfer/m-p/1672329#M23839</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to use the SPI protocol between the IMU sensor, ASM330LHHX, and my MCU, MPC5748G.&lt;/P&gt;&lt;P&gt;How it's configured :&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="AhpKim_0-1687226334755.png" style="width: 636px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/228428i7A3F0B164CC05BF3/image-dimensions/636x107?v=v2" width="636" height="107" role="button" title="AhpKim_0-1687226334755.png" alt="AhpKim_0-1687226334755.png" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;AhpKim_0-1687226334755.png&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;CS PIN :&amp;nbsp;SIUL2-&amp;gt;GPDO[26]&lt;/P&gt;&lt;P&gt;By using SPI_MasterTransferBlocking, I can send and receive the sensor data.&lt;/P&gt;&lt;P&gt;But the problem is that I can only get the IMU sensor data, and other modules such as CAN protocol and UART protocol stop running.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So here're two questions I want to ask,&lt;/P&gt;&lt;P&gt;1. How to stop the SPI_MasterTransferBlocking function properly? This is how I use this function:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="AhpKim_0-1687231179125.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/228435i0DE2D304CC33D43B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="AhpKim_0-1687231179125.png" alt="AhpKim_0-1687231179125.png" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;AhpKim_0-1687231179125.png&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;After the transfer, shouldn't it be finished and start running other modules? It seems to have all the usage of the process.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2. So I used SPI_MasterTransfer function, but when I raise CS and run the SPI_MasterTransfer function, SPI_MasterTransfer status keep giving me STATUS_BUSY.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="AhpKim_1-1687231719743.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/228436i4FC9AF134434EB6B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="AhpKim_1-1687231719743.png" alt="AhpKim_1-1687231719743.png" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;AhpKim_1-1687231719743.png&lt;/span&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="AhpKim_2-1687231731975.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/228437i474BA4F851BAD50A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="AhpKim_2-1687231731975.png" alt="AhpKim_2-1687231731975.png" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;AhpKim_2-1687231731975.png&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Green line is CS, Yellow line is the Clock.&amp;nbsp;&lt;/P&gt;&lt;P&gt;So CS turned low before the transfer finished. Is there a way to fix this situation?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help is welcome.&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;</description>
      <pubDate>Tue, 20 Jun 2023 03:31:40 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MPC5xxx/How-to-use-SPI-MasterTransferBlocking-and-SPI-MasterTransfer/m-p/1672329#M23839</guid>
      <dc:creator>AhpKim</dc:creator>
      <dc:date>2023-06-20T03:31:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to use SPI_MasterTransferBlocking and SPI_MasterTransfer properly?</title>
      <link>https://community.nxp.com/t5/MPC5xxx/How-to-use-SPI-MasterTransferBlocking-and-SPI-MasterTransfer/m-p/1672533#M23840</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;1) yes, blocking function is waiting inside until all defined number of bytes are sent or timeout expires. But interrupts are still enabled so can be handled normally from other modules. A timeout for the transfer is in milliseconds. If the transfer takes longer than this amount of time, the transfer is aborted and a STATUS_TIMEOUT error returned.&lt;/P&gt;
&lt;P&gt;2) if there was no transfer before or it was already finished then function should not return STATUS_BUSY, rather STATUS_SUCCESS. For non-blocking function you should test for end of transfer before it can be again called, for example by using DSPI_GetTransferStatus function. For example like below, to ensure transfer is finished and CS (if driven my SW) can be deasserted.&lt;/P&gt;
&lt;PRE&gt;dspi_transfer_status_t status=DSPI_TRANSFER_OK;&lt;BR /&gt;&lt;BR /&gt;SIUL2-&amp;gt;GPDO[24]=0;&lt;BR /&gt;DSPI_MasterTransfer(SPI0_INSTANCE, master_send, master_receive, 2);&lt;BR /&gt;do&lt;BR /&gt;{&lt;BR /&gt;     DSPI_GetTransferStatus(SPI0_INSTANCE, &amp;amp;status);&lt;BR /&gt;}while(status==DSPI_IN_PROGRESS);&lt;BR /&gt;SIUL2-&amp;gt;GPDO[24]=1;&lt;/PRE&gt;
&lt;P&gt;BR, Petr&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 20 Jun 2023 08:24:20 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MPC5xxx/How-to-use-SPI-MasterTransferBlocking-and-SPI-MasterTransfer/m-p/1672533#M23840</guid>
      <dc:creator>PetrS</dc:creator>
      <dc:date>2023-06-20T08:24:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to use SPI_MasterTransferBlocking and SPI_MasterTransfer properly?</title>
      <link>https://community.nxp.com/t5/MPC5xxx/How-to-use-SPI-MasterTransferBlocking-and-SPI-MasterTransfer/m-p/1685479#M23923</link>
      <description>&lt;P&gt;Thanks!! It worked!!&lt;/P&gt;</description>
      <pubDate>Tue, 11 Jul 2023 06:57:53 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MPC5xxx/How-to-use-SPI-MasterTransferBlocking-and-SPI-MasterTransfer/m-p/1685479#M23923</guid>
      <dc:creator>AhpKim</dc:creator>
      <dc:date>2023-07-11T06:57:53Z</dc:date>
    </item>
  </channel>
</rss>

