<?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: LPC1788 use DMA controller to transfer data from a SPI port to the CRC engine in LPC Microcontrollers</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1788-use-DMA-controller-to-transfer-data-from-a-SPI-port-to/m-p/521929#M4565</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by xianghuiwang on Wed Sep 17 16:24:43 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi, harper23,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Maybe I miss understood your question. I thought you want to directly do CRC on the SPI data without using two DMA steps to store and then DMA to the CRC engine.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;We have not tested this possibility. If we set the destination of the SPI data to the CRC register, we only will get the CRC result but not the SPI data. This was what I mean previously.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;regards,&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 15 Jun 2016 16:36:11 GMT</pubDate>
    <dc:creator>lpcware</dc:creator>
    <dc:date>2016-06-15T16:36:11Z</dc:date>
    <item>
      <title>LPC1788 use DMA controller to transfer data from a SPI port to the CRC engine</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1788-use-DMA-controller-to-transfer-data-from-a-SPI-port-to/m-p/521925#M4561</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by harper on Wed Aug 20 06:06:51 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;I have an external memory device connected to the SPI controller SSP1. I need to validate the content of the memory. For this purpose a CRC has been calculated and stored somewhere else (EEPROM). &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;To validate the memory content I want to pass all data of one SPI cycle to the CRC data register. Currently this is done by writing bytes to memory device what causes clock cycles and to copy the received bytes to the CRC data register.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;To improve the performance I would like to utilize the DMA controller. The DMA is able to read the data from the SPI port. I also succeeded to pass some data from the RAM to the CRC engine. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;But how can I transfer data directly from on peripheral (SPI) to another (CRC)?? The dummy bytes sent to issue clock cycles could be sent by software or another DMA channel. The only problematic task is the transfer to the CRC.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 16:36:08 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1788-use-DMA-controller-to-transfer-data-from-a-SPI-port-to/m-p/521925#M4561</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T16:36:08Z</dc:date>
    </item>
    <item>
      <title>Re: LPC1788 use DMA controller to transfer data from a SPI port to the CRC engine</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1788-use-DMA-controller-to-transfer-data-from-a-SPI-port-to/m-p/521926#M4562</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by xianghuiwang on Wed Sep 03 09:50:00 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi, &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You can try to set the destination of the SPI DMA to CRC, but you would lose the SPI data. - think this is not what you want.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 16:36:09 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1788-use-DMA-controller-to-transfer-data-from-a-SPI-port-to/m-p/521926#M4562</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T16:36:09Z</dc:date>
    </item>
    <item>
      <title>Re: LPC1788 use DMA controller to transfer data from a SPI port to the CRC engine</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1788-use-DMA-controller-to-transfer-data-from-a-SPI-port-to/m-p/521927#M4563</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by harper23 on Fri Sep 05 06:37:19 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;Quote: xianghuiwang&lt;/STRONG&gt;&lt;BR /&gt;Hi, &lt;BR /&gt;&lt;BR /&gt;You can try to set the destination of the SPI DMA to CRC, but you would lose the SPI data. - think this is not what you want.&lt;BR /&gt;regards,&lt;/SPAN&gt;&lt;HR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Why would I lose SPI data? The CRC engine should be able to calculate the next SUM result within one cycle.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I tried to configure the DMA corresponding to the data sheet.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt;
uint8_t command_echo[5];

// This set of DMA configuration will be applied when the initial data length counts down to zero since the LLI register is set to this array.
uint32_t next_LLI[4] = {
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;amp;LPC_SSP1-&amp;gt;DR,&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // read a byte from SPI
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;amp;LPC_CRC-&amp;gt;WR_DATA_BYTE.DATA,&amp;nbsp;&amp;nbsp;&amp;nbsp; // write the byte to the CRCC
&amp;nbsp;&amp;nbsp;&amp;nbsp; 0,
&amp;nbsp;&amp;nbsp;&amp;nbsp; 0x90000 | GPMDA_DMACCxControl_I&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // length ignored when controlled by peripheral
};

// connect DMA with SSP1
LPC_GPDMACH5-&amp;gt;CConfig = 0
LPC_GPDMACH5-&amp;gt;CLLI = &amp;amp; next_LLI
LPC_GPDMACH5-&amp;gt;CSrcAddr = &amp;amp; LPC_SSP1-&amp;gt;DR
LPC_GPDMACH5-&amp;gt;CDestAddr = command_echo
LPC_GPDMACH5-&amp;gt;CControl = size_of_SPI_command + GPDMA_DMACCxControl_DI
LPC_GPDMA-&amp;gt;DMAREQSEL &amp;amp;= (1 &amp;lt;&amp;lt; GPDMA_CONN_SSP1_Rx)
LPC_GPDMA-&amp;gt;Config = GPDMA_DMACConfig_E

// enable DMA channel
LPC_GPDMACH5-&amp;gt;CConfig = 
&amp;nbsp;&amp;nbsp;&amp;nbsp; GPDMA_DMACCxConfig_TransferType(GPDMA_TRANSFERTYPE_P2M) |
&amp;nbsp;&amp;nbsp;&amp;nbsp; GPDMA_DMACCxConfig_SrcPeripheral(GPDMA_CONN_SSP1_Rx)
LPC_GPDMACH5-&amp;gt;CConfig |= GPDMA_DMACCxConfig_E

// connect SSP to DMA
SSP_DMACmd(LPC_SSP1, SSP_DMA_RX, ENABLE)

// send command
LPC_SSP1-&amp;gt;DR = cmd1
LPC_SSP1-&amp;gt;DR = cmd2
LPC_SSP1-&amp;gt;DR = cmd3
LPC_SSP1-&amp;gt;DR = cmd4
LPC_SSP1-&amp;gt;DR = cmd5
while (!(LPC_SSP1-&amp;gt;SR &amp;amp; SSP_SR_TFE)) { }

// send dummy bytes to the SSP that will cause SSP receive cycles
 do
&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (SSPx-&amp;gt;SR &amp;amp; SSP_SR_TNF)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SSPx-&amp;gt;DR = 0xFF;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp;&amp;nbsp; } while(--length &amp;gt; 0);
&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;But the result is that the CRC SUM register doesn't change at all.&lt;/SPAN&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 16:36:10 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1788-use-DMA-controller-to-transfer-data-from-a-SPI-port-to/m-p/521927#M4563</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T16:36:10Z</dc:date>
    </item>
    <item>
      <title>Re: LPC1788 use DMA controller to transfer data from a SPI port to the CRC engine</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1788-use-DMA-controller-to-transfer-data-from-a-SPI-port-to/m-p/521928#M4564</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by harper23 on Mon Sep 15 22:10:18 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hello NXP Support,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have tried your recommendation and I have reported the results as well as the details how I tried.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Was your post based on the assumptions that my objectives are realistic? Is this possible or did you follow the wrong way as I did?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 16:36:10 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1788-use-DMA-controller-to-transfer-data-from-a-SPI-port-to/m-p/521928#M4564</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T16:36:10Z</dc:date>
    </item>
    <item>
      <title>Re: LPC1788 use DMA controller to transfer data from a SPI port to the CRC engine</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1788-use-DMA-controller-to-transfer-data-from-a-SPI-port-to/m-p/521929#M4565</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by xianghuiwang on Wed Sep 17 16:24:43 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi, harper23,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Maybe I miss understood your question. I thought you want to directly do CRC on the SPI data without using two DMA steps to store and then DMA to the CRC engine.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;We have not tested this possibility. If we set the destination of the SPI data to the CRC register, we only will get the CRC result but not the SPI data. This was what I mean previously.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;regards,&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 16:36:11 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1788-use-DMA-controller-to-transfer-data-from-a-SPI-port-to/m-p/521929#M4565</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T16:36:11Z</dc:date>
    </item>
    <item>
      <title>Re: LPC1788 use DMA controller to transfer data from a SPI port to the CRC engine</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1788-use-DMA-controller-to-transfer-data-from-a-SPI-port-to/m-p/521930#M4566</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by harper23 on Wed Sep 17 22:53:08 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;Quote: xianghuiwang&lt;/STRONG&gt;&lt;BR /&gt;Hi, harper23,&lt;/SPAN&gt;&lt;HR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi xianghuiwang,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;thanks for your reply.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;Quote: xianghuiwang&lt;/STRONG&gt;&lt;BR /&gt;Maybe I miss understood your question. I thought you want to directly do CRC on the SPI data without using two DMA steps to store and then DMA to the CRC engine.&lt;/SPAN&gt;&lt;HR /&gt;&lt;BR /&gt;&lt;SPAN&gt;No, you didn't misunderstood. The objective is to calculate the CRC of the data that is received from the SPI port. The data should transferred directly from the SPI to the CRC engine in one DMA transfer.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Utilizing the RAM would add a penalty of slowing down the process and should be avoided.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;Quote: xianghuiwang&lt;/STRONG&gt;&lt;BR /&gt;We have not tested this possibility.&lt;/SPAN&gt;&lt;HR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Could you test it? I provided the code I used. It failed as it did not change anything in the CRC enging. But probably you find something that coudl be done better.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;Quote: xianghuiwang&lt;/STRONG&gt;&lt;BR /&gt;If we set the destination of the SPI data to the CRC register, we only will get the CRC result but not the SPI data. This was what I mean previously.&lt;/SPAN&gt;&lt;HR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Yes that is the desired result. So I read your reply as it would be possible.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Best regards&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;harper23&lt;/SPAN&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 16:36:12 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1788-use-DMA-controller-to-transfer-data-from-a-SPI-port-to/m-p/521930#M4566</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T16:36:12Z</dc:date>
    </item>
  </channel>
</rss>

