<?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>S32K中的主题 Re: Continuous SPI with DMA</title>
    <link>https://community.nxp.com/t5/S32K/Continuous-SPI-with-DMA/m-p/1480543#M16097</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;instead of fixed delay you can try to call&amp;nbsp;LPSPI_DRV_MasterGetTransferStatus function in loop to know driver is ready to call new&amp;nbsp;LPSPI_DRV_MasterTransfer.&lt;BR /&gt;However the additional&amp;nbsp;delay you see can be simply&amp;nbsp;due to driver overhead, you can refer to its code.&lt;BR /&gt;You can try to use some nonSDk code, e.g.&amp;nbsp;&lt;A href="https://community.nxp.com/t5/S32K-Knowledge-Base/Example-S32K144-LPIT-DMA-LPSPI/ta-p/1108628," target="_blank"&gt;https://community.nxp.com/t5/S32K-Knowledge-Base/Example-S32K144-LPIT-DMA-LPSPI/ta-p/1108628,&lt;/A&gt;&amp;nbsp;but you need to tailor it for your needs.&lt;/P&gt;
&lt;P&gt;BR, Petr&lt;/P&gt;</description>
    <pubDate>Mon, 27 Jun 2022 10:45:12 GMT</pubDate>
    <dc:creator>PetrS</dc:creator>
    <dc:date>2022-06-27T10:45:12Z</dc:date>
    <item>
      <title>Continuous SPI with DMA</title>
      <link>https://community.nxp.com/t5/S32K/Continuous-SPI-with-DMA/m-p/1480192#M16080</link>
      <description>&lt;P&gt;I am trying to connect an 18-bit SPI ADC to the S32K144(W) for continuous sampling between 40 kSPS up to 400kSPS. For that speed, I need DMA data collection. I implemented it with two Rx buffers.&lt;BR /&gt;The DMA TX Data Ready Interrupt occurred when the last 4 bytes were loaded to the SPI TX buffer, as seen in Figure 1.&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="IRQ_0.jpg" style="width: 999px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/184662iE39D54109031B63A/image-size/large?v=v2&amp;amp;px=999" role="button" title="IRQ_0.jpg" alt="IRQ_0.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The "LPSPI_DRV_MasterTransfer" instruction does not affect if the transmission is in progress.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;To overcome this future of "LPSPI_DRV_MasterTransfer" I introduced some delay. Figure 2 shows a delay that is not long&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;&lt;SPAN&gt;enough&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SPI_IRQZ_2.jpg" style="width: 999px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/184664i7C372DE8B24B711E/image-size/large?v=v2&amp;amp;px=999" role="button" title="SPI_IRQZ_2.jpg" alt="SPI_IRQZ_2.jpg" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Figure 3 shows a "continuous transmission but with gaps between the packages. The gaps are 15.2 us long. The packages are 256 bytes long, which correspond to 64 ADC samples.&lt;BR /&gt;The measured signal is a communication signal, and the gaps are not acceptable.&lt;BR /&gt;What is the solution?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Continuous SPI with 15.2 us gap." style="width: 999px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/184665i9A8B5C5D33EA60B4/image-size/large?v=v2&amp;amp;px=999" role="button" title="SPI_IRQZ_3.jpg" alt="Continuous SPI with 15.2 us gap." /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Continuous SPI with 15.2 us gap.&lt;/span&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The IRQ is:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;static void delayDbg(volatile int cycles)&lt;BR /&gt;{&lt;BR /&gt;/* Delay function - do nothing for a number of cycles */&lt;BR /&gt;while(cycles--);&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;int32_t rxADCdata, counter, *xp;&lt;BR /&gt;int8_t iBufSelect;&lt;/P&gt;&lt;P&gt;/******************************************************************************'&lt;BR /&gt;*&lt;BR /&gt;* DMA 5 TX Interrupt Handler&lt;BR /&gt;*&lt;BR /&gt;****************************************************************************/&lt;BR /&gt;static void DMA5_IRQnHandler(void)&lt;BR /&gt;{&lt;BR /&gt;BLUE_ON; /* LED On */&lt;BR /&gt;DMA-&amp;gt;CINT = DMA_CINT_CINT(DMA5_IRQn); /** Clear the interrupt flag! */&lt;/P&gt;&lt;P&gt;delayDbg(145); /* Required Delay ? */&lt;/P&gt;&lt;P&gt;if( continuousSPI == true)&lt;BR /&gt;{&lt;BR /&gt;iBufSelect = (iBufSelect +1) &amp;amp; 0x01; /* Switch buffer */&lt;BR /&gt;LPSPI_DRV_MasterTransfer(INST_LPSPI_1, uTx.b,uRx[iBufSelect].b, SPI_BYTE_BUFFER_LNGH);&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;BLUE_OFF; /* LED Off */&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 27 Jun 2022 02:37:31 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/Continuous-SPI-with-DMA/m-p/1480192#M16080</guid>
      <dc:creator>Antal</dc:creator>
      <dc:date>2022-06-27T02:37:31Z</dc:date>
    </item>
    <item>
      <title>Re: Continuous SPI with DMA</title>
      <link>https://community.nxp.com/t5/S32K/Continuous-SPI-with-DMA/m-p/1480543#M16097</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;instead of fixed delay you can try to call&amp;nbsp;LPSPI_DRV_MasterGetTransferStatus function in loop to know driver is ready to call new&amp;nbsp;LPSPI_DRV_MasterTransfer.&lt;BR /&gt;However the additional&amp;nbsp;delay you see can be simply&amp;nbsp;due to driver overhead, you can refer to its code.&lt;BR /&gt;You can try to use some nonSDk code, e.g.&amp;nbsp;&lt;A href="https://community.nxp.com/t5/S32K-Knowledge-Base/Example-S32K144-LPIT-DMA-LPSPI/ta-p/1108628," target="_blank"&gt;https://community.nxp.com/t5/S32K-Knowledge-Base/Example-S32K144-LPIT-DMA-LPSPI/ta-p/1108628,&lt;/A&gt;&amp;nbsp;but you need to tailor it for your needs.&lt;/P&gt;
&lt;P&gt;BR, Petr&lt;/P&gt;</description>
      <pubDate>Mon, 27 Jun 2022 10:45:12 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/Continuous-SPI-with-DMA/m-p/1480543#M16097</guid>
      <dc:creator>PetrS</dc:creator>
      <dc:date>2022-06-27T10:45:12Z</dc:date>
    </item>
  </channel>
</rss>

