<?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>LPC MicrocontrollersのトピックRe: SPI and DMA</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/SPI-and-DMA/m-p/522265#M4901</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 Fri May 23 12:48:53 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi, elgarbe,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Please let us know which part is this about - so we can help you better? Maybe I missed the part name in your text?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;good luck!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 15 Jun 2016 16:38:35 GMT</pubDate>
    <dc:creator>lpcware</dc:creator>
    <dc:date>2016-06-15T16:38:35Z</dc:date>
    <item>
      <title>SPI and DMA</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/SPI-and-DMA/m-p/522264#M4900</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by elgarbe on Mon Mar 24 16:19:35 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm really need some support about it...&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I want to send 256bytes from SPI using DMA. Just use MOSI, I don't use Receiver part and CLK neither.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm testing this other code:&lt;/SPAN&gt;&lt;BR /&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt;
char data[64]={1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2};

#include &amp;lt;cr_section_macros.h&amp;gt;
#include &amp;lt;NXP/crp.h&amp;gt;

void SSP0Init();

/*******************************************************************************
**&amp;nbsp;&amp;nbsp; Main Function&amp;nbsp; main()
*******************************************************************************/
int main (void){

SSP0Init();// Inicializo el bus SPI

LPC_SC-&amp;gt;PCONP |= 1 &amp;lt;&amp;lt; 29; // Power up DMA

LPC_GPDMACH0-&amp;gt;DMACCConfig = 0; // stop ch0 dma
//LPC_SC-&amp;gt;DMAREQSEL |= 1 &amp;lt;&amp;lt; 2; // Timer1 Match Compare 0 as DMA request

&amp;nbsp;&amp;nbsp;&amp;nbsp; LPC_GPDMACH0-&amp;gt;DMACCSrcAddr = (uint32_t) &amp;amp;data[0]; // data[] is the array where I have stored alternating 1's and 0's.
LPC_GPDMACH0-&amp;gt;DMACCDestAddr = (uint32_t) &amp;amp;(LPC_SSP0-&amp;gt;DR); // SSP0
LPC_GPDMACH0-&amp;gt;DMACCLLI = 0;
LPC_GPDMACH0-&amp;gt;DMACCControl = 32 // Transferencia de 32 bytes, 1 burst
| (1 &amp;lt;&amp;lt; 12) // Burst de 1 bytes
| (1 &amp;lt;&amp;lt; 15) // Burst de 1 bytes
| ( 1 &amp;lt;&amp;lt; 26 ); // Source increment.
LPC_GPDMACH0-&amp;gt;DMACCConfig = ( 0 &amp;lt;&amp;lt; 6 ) | ( 1 &amp;lt;&amp;lt; 11); // Set SPI as destination request peripheral and the type pf transfer as Memory to Peripheral.

LPC_GPDMA-&amp;gt;DMACIntErrClr |= 0xff;//Clear all DMA interrupts
LPC_GPDMA-&amp;gt;DMACIntTCClear |= 0xff;

LPC_GPDMA-&amp;gt;DMACConfig |= 1 &amp;lt;&amp;lt; 0; // enable DMA
LPC_GPDMACH0-&amp;gt;DMACCConfig |= 1; //enable ch0

while ( 1 ){
}
}
&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In these case I don't configure DMAREQSEL and set SPI tx as "destination request peripheral". I try to send 32bytes. This is the only code that works well. But I don't understand "destination request peripheral"... what is it? wich is the purpose of DMAREQSEL? when SPI activate the request signal?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In these code I have SPI configured for 8bits long. So when I connect the oscilloscope on SPI Clock I see 32 groups of 8 clock pulse. But I see a litle space (1 clock?) between each byte. Can I remove this space with some configuration change? becouse I need to Send 320 bits...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Now, what if I want to activate DMA with a timer mach register? I configure Timer1 Match register 0 to 20usec. I would like to this match fire DMA to SPI transfer.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;So, I write this code:&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;
/*******************************************************************************
**&amp;nbsp;&amp;nbsp; Main Function&amp;nbsp; main()
*******************************************************************************/
int main (void){

SSP0Init();// Inicializo el bus SPI

// setup timer1
LPC_SC-&amp;gt;PCONP |= 1 &amp;lt;&amp;lt; 2; // Power up
LPC_SC-&amp;gt;PCLKSEL0 |= 0x01 &amp;lt;&amp;lt; 4; // CCLK -&amp;gt; 10nseg ticks
LPC_TIM1-&amp;gt;MR0 = 2000;// Match a los 10 segundos
LPC_TIM1-&amp;gt;MCR = 1 &amp;lt;&amp;lt; 1; // reset on Match Compare 0

LPC_TIM1-&amp;gt;IR |= 0xff; // Clear all timer interrupts if there are any
LPC_TIM1-&amp;gt;TCR = 2;// Pongo a 0 el Contador del Timer y queda desabilitado

LPC_SC-&amp;gt;PCONP |= 1 &amp;lt;&amp;lt; 29; // Power up DMA

LPC_GPDMACH0-&amp;gt;DMACCConfig = 0; // stop ch0 dma

LPC_SC-&amp;gt;DMAREQSEL |= 1 &amp;lt;&amp;lt; 2; // Timer1 Match Compare 0 as DMA request

LPC_GPDMA-&amp;gt;DMACIntErrClr |= 0xff;
LPC_GPDMA-&amp;gt;DMACIntTCClear |= 0xff;

&amp;nbsp;&amp;nbsp;&amp;nbsp; LPC_GPDMACH0-&amp;gt;DMACCSrcAddr = (uint32_t) &amp;amp;data[0]; // hora[] is the array where I have stored alternating 1's and 0's.
LPC_GPDMACH0-&amp;gt;DMACCDestAddr = (uint32_t) &amp;amp;(LPC_SSP0-&amp;gt;DR); // SSP0
LPC_GPDMACH0-&amp;gt;DMACCLLI = 0;
LPC_GPDMACH0-&amp;gt;DMACCControl = 16 // Transferencia de 16 bytes
| (1 &amp;lt;&amp;lt; 12) // Burst de 8 bytes
| (1 &amp;lt;&amp;lt; 15) // Burst de 8 bytes
| (1 &amp;lt;&amp;lt; 26 ); // Source increment.
LPC_GPDMACH0-&amp;gt;DMACCConfig = ( 10 &amp;lt;&amp;lt; 6 ) | ( 1 &amp;lt;&amp;lt; 11); // Set MAT1.0 as destination request peripheral and the type pf transfer as Memory to Peripheral.

LPC_GPDMA-&amp;gt;DMACConfig |= 1 &amp;lt;&amp;lt; 0; // enable DMA
LPC_GPDMACH0-&amp;gt;DMACCConfig |= 1; //enable ch0
LPC_TIM1-&amp;gt;TCR = 0x01; // start timer.

while ( 1 ){
}
}
&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;As you can see I configure all on main.c to go step by step.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Here I have DMAREQSEL and destination request peripheral doubt. What shoud I use on each register?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;On this code I try to send 16 bytes once Timer1 Match0 fire. What I see on my osccilloscope is 20useg, a group of 4byte, 20useg, another group of 4byte and so on until 16 bytes is send. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If I change the code and set SPI as destination request periperal:&lt;/SPAN&gt;&lt;BR /&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt;
LPC_GPDMACH0-&amp;gt;DMACCConfig = ( 0 &amp;lt;&amp;lt; 6 ) | ( 1 &amp;lt;&amp;lt; 11); // Set SPI as destination request peripheral and the type pf transfer as Memory to Peripheral.
&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;SPAN&gt;What I see is 16 groups of pulse, but no 20usec on the first pulse. When I enable DMA it's fire without waiting for timer1 match0.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So, I can change all my code logic, I can configure Match register 0 to produce interrupt, and on interrupt I can fire DMA manually, but I need to understand each regiter before I use DMA.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Is there any documentation for DMA? I already read UM, but it's not clear.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm really needing NXP support on it.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thk and best regards!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 16:38:34 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/SPI-and-DMA/m-p/522264#M4900</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T16:38:34Z</dc:date>
    </item>
    <item>
      <title>Re: SPI and DMA</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/SPI-and-DMA/m-p/522265#M4901</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 Fri May 23 12:48:53 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi, elgarbe,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Please let us know which part is this about - so we can help you better? Maybe I missed the part name in your text?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;good luck!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 16:38:35 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/SPI-and-DMA/m-p/522265#M4901</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T16:38:35Z</dc:date>
    </item>
    <item>
      <title>Re: SPI and DMA</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/SPI-and-DMA/m-p/522266#M4902</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by elgarbe on Fri May 23 13:59:05 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;It's a lpc1769&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thk&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 16:38:35 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/SPI-and-DMA/m-p/522266#M4902</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T16:38:35Z</dc:date>
    </item>
  </channel>
</rss>

