<?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>Kinetis Software Development KitのトピックSPI DMA First Byte Read Twice Using FRDM-K22F and Processor Expert</title>
    <link>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/SPI-DMA-First-Byte-Read-Twice-Using-FRDM-K22F-and-Processor/m-p/418776#M2083</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Problem&lt;/P&gt;&lt;P&gt;In my application, all spi reads duplicate the first-byte read, and ignore the last byte read.&lt;/P&gt;&lt;P&gt;any suggestions are appreciated.&lt;/P&gt;&lt;P&gt;thank you&lt;/P&gt;&lt;P&gt;bud&lt;/P&gt;&lt;P style="min- padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE class="c++" name="code"&gt;&amp;nbsp; OSA_Init(); &amp;nbsp; EDMA_DRV_Init(&amp;amp;dmaController1_State, &amp;amp;dmaController1_InitConfig0);&amp;nbsp;&amp;nbsp; &amp;nbsp; DSPI_DRV_EdmaMasterInit(FSL_DSPICOM1, &amp;amp;dspiCom1_MasterState, &amp;amp;dspiCom1_MasterConfig0, &amp;amp;dspiCom1_dmaTcd); &amp;nbsp; DSPI_DRV_EdmaMasterConfigureBus(FSL_DSPICOM1, &amp;amp;dspiCom1_BusConfig0, &amp;amp;dspiCom1_calculatedBaudRate);//startup as slow bus&amp;nbsp;&amp;nbsp; &amp;nbsp; static uint8_t header[5]; &amp;nbsp; header[0]=1; &amp;nbsp; header[1]=2; &amp;nbsp; header[2]=3; &amp;nbsp; header[3]=4; &amp;nbsp; header[4]=5; &amp;nbsp; static uint8_t readdata[5]; &amp;nbsp; readdata[0]=0; &amp;nbsp; readdata[1]=0; &amp;nbsp; readdata[2]=0; &amp;nbsp; readdata[3]=0; &amp;nbsp; readdata[4]=0;&amp;nbsp;&amp;nbsp; &amp;nbsp; DSPI_DRV_EdmaMasterTransferBlocking(FSL_DSPICOM1, NULL, header, readdata, 5, 1000u); //readdata == {1,1,2,3,4} after this command (it should be 1,2,3,4,5))&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/PRE&gt;&lt;P style="min- padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="min- padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i have included the project&lt;/P&gt;&lt;P&gt;to duplicate this problem tie mosi and miso together (PTD6,PTD7)&lt;/P&gt;&lt;P&gt;Kinetis Design Studio Version: 3.0.0&lt;/P&gt;&lt;P&gt;Processor Expert for Kinetis 3.0.1&lt;/P&gt;&lt;P&gt;KSDK_1.2.0&lt;/P&gt;&lt;P style="min- padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;SCOPE DECODE SETTINGS&lt;/P&gt;&lt;P&gt;CPOL = 0&lt;/P&gt;&lt;P&gt;CPHA = 1&lt;/P&gt;&lt;P&gt;CS POLARITY = ACTIVE LOW&lt;/P&gt;&lt;P&gt;BIT ORDER = MSB&lt;/P&gt;&lt;P&gt;BITS PER WORD = 8&lt;/P&gt;&lt;P style="min- padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="lia-inline-image-display-wrapper" image-alt="102477_102477.jpg"&gt;&lt;IMG alt="102477_102477.jpg" src="https://community.nxp.com/t5/image/serverpage/image-id/120820i5DDF5AAE84840B62/image-size/large?v=v2&amp;amp;px=999" title="102477_102477.jpg" /&gt;&lt;/SPAN&gt;&lt;SPAN class="lia-inline-image-display-wrapper" image-alt="LeCroy.jpg"&gt;&lt;IMG alt="LeCroy.jpg" src="https://community.nxp.com/t5/image/serverpage/image-id/31339i298A3BB46860E2CB/image-size/large?v=v2&amp;amp;px=999" title="LeCroy.jpg" /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="min- padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Message was edited by: bud Arriola the previous code I uploaded was for the wrong package ic. I updated the project to have the correct ic. ( The same result can be seen, also if the spi baud rate is lowered then only 3 out of the five bytes will transfer and the cs line will be stuck low.)&lt;/P&gt;&lt;P style="min- padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Message was edited by: bud Arriola I fixed the problem by disabling auto-initialization in the dspi component and the DMA controller though I don't understand why it was wrong.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Original Attachment has been moved to: &lt;A _jive_internal="true" href="https://community.nxp.com/docs/DOC-338475" rel="noopener noreferrer" target="_blank"&gt;working-FRDM-K22F-project.zip&lt;/A&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Original Attachment has been moved to: &lt;A _jive_internal="true" href="https://community.nxp.com/docs/DOC-338475" rel="noopener noreferrer" target="_blank"&gt;FRDM-K22F-project.zip&lt;/A&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 02 Nov 2020 13:18:46 GMT</pubDate>
    <dc:creator>budarriola</dc:creator>
    <dc:date>2020-11-02T13:18:46Z</dc:date>
    <item>
      <title>SPI DMA First Byte Read Twice Using FRDM-K22F and Processor Expert</title>
      <link>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/SPI-DMA-First-Byte-Read-Twice-Using-FRDM-K22F-and-Processor/m-p/418776#M2083</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Problem&lt;/P&gt;&lt;P&gt;In my application, all spi reads duplicate the first-byte read, and ignore the last byte read.&lt;/P&gt;&lt;P&gt;any suggestions are appreciated.&lt;/P&gt;&lt;P&gt;thank you&lt;/P&gt;&lt;P&gt;bud&lt;/P&gt;&lt;P style="min- padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE class="c++" name="code"&gt;&amp;nbsp; OSA_Init(); &amp;nbsp; EDMA_DRV_Init(&amp;amp;dmaController1_State, &amp;amp;dmaController1_InitConfig0);&amp;nbsp;&amp;nbsp; &amp;nbsp; DSPI_DRV_EdmaMasterInit(FSL_DSPICOM1, &amp;amp;dspiCom1_MasterState, &amp;amp;dspiCom1_MasterConfig0, &amp;amp;dspiCom1_dmaTcd); &amp;nbsp; DSPI_DRV_EdmaMasterConfigureBus(FSL_DSPICOM1, &amp;amp;dspiCom1_BusConfig0, &amp;amp;dspiCom1_calculatedBaudRate);//startup as slow bus&amp;nbsp;&amp;nbsp; &amp;nbsp; static uint8_t header[5]; &amp;nbsp; header[0]=1; &amp;nbsp; header[1]=2; &amp;nbsp; header[2]=3; &amp;nbsp; header[3]=4; &amp;nbsp; header[4]=5; &amp;nbsp; static uint8_t readdata[5]; &amp;nbsp; readdata[0]=0; &amp;nbsp; readdata[1]=0; &amp;nbsp; readdata[2]=0; &amp;nbsp; readdata[3]=0; &amp;nbsp; readdata[4]=0;&amp;nbsp;&amp;nbsp; &amp;nbsp; DSPI_DRV_EdmaMasterTransferBlocking(FSL_DSPICOM1, NULL, header, readdata, 5, 1000u); //readdata == {1,1,2,3,4} after this command (it should be 1,2,3,4,5))&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/PRE&gt;&lt;P style="min- padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="min- padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i have included the project&lt;/P&gt;&lt;P&gt;to duplicate this problem tie mosi and miso together (PTD6,PTD7)&lt;/P&gt;&lt;P&gt;Kinetis Design Studio Version: 3.0.0&lt;/P&gt;&lt;P&gt;Processor Expert for Kinetis 3.0.1&lt;/P&gt;&lt;P&gt;KSDK_1.2.0&lt;/P&gt;&lt;P style="min- padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;SCOPE DECODE SETTINGS&lt;/P&gt;&lt;P&gt;CPOL = 0&lt;/P&gt;&lt;P&gt;CPHA = 1&lt;/P&gt;&lt;P&gt;CS POLARITY = ACTIVE LOW&lt;/P&gt;&lt;P&gt;BIT ORDER = MSB&lt;/P&gt;&lt;P&gt;BITS PER WORD = 8&lt;/P&gt;&lt;P style="min- padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="lia-inline-image-display-wrapper" image-alt="102477_102477.jpg"&gt;&lt;IMG alt="102477_102477.jpg" src="https://community.nxp.com/t5/image/serverpage/image-id/120820i5DDF5AAE84840B62/image-size/large?v=v2&amp;amp;px=999" title="102477_102477.jpg" /&gt;&lt;/SPAN&gt;&lt;SPAN class="lia-inline-image-display-wrapper" image-alt="LeCroy.jpg"&gt;&lt;IMG alt="LeCroy.jpg" src="https://community.nxp.com/t5/image/serverpage/image-id/31339i298A3BB46860E2CB/image-size/large?v=v2&amp;amp;px=999" title="LeCroy.jpg" /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="min- padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Message was edited by: bud Arriola the previous code I uploaded was for the wrong package ic. I updated the project to have the correct ic. ( The same result can be seen, also if the spi baud rate is lowered then only 3 out of the five bytes will transfer and the cs line will be stuck low.)&lt;/P&gt;&lt;P style="min- padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Message was edited by: bud Arriola I fixed the problem by disabling auto-initialization in the dspi component and the DMA controller though I don't understand why it was wrong.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Original Attachment has been moved to: &lt;A _jive_internal="true" href="https://community.nxp.com/docs/DOC-338475" rel="noopener noreferrer" target="_blank"&gt;working-FRDM-K22F-project.zip&lt;/A&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Original Attachment has been moved to: &lt;A _jive_internal="true" href="https://community.nxp.com/docs/DOC-338475" rel="noopener noreferrer" target="_blank"&gt;FRDM-K22F-project.zip&lt;/A&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Nov 2020 13:18:46 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/SPI-DMA-First-Byte-Read-Twice-Using-FRDM-K22F-and-Processor/m-p/418776#M2083</guid>
      <dc:creator>budarriola</dc:creator>
      <dc:date>2020-11-02T13:18:46Z</dc:date>
    </item>
  </channel>
</rss>

