<?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: LPC845, DMA : destination increment after transfer</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC845-DMA-destination-increment-after-transfer/m-p/892828#M35798</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello &lt;A _jive_internal="true" data-content-finding="Community" data-userid="339525" data-username="j.mosnino@hotmail.fr" href="https://community.nxp.com/people/j.mosnino@hotmail.fr"&gt;jo mos&lt;/A&gt; ,&lt;/P&gt;&lt;P&gt;Yes, we can only reconfigure the channel descriptor in Single buffer mode, in descriptor re-configure&lt;/P&gt;&lt;P&gt;destination.&lt;/P&gt;&lt;P&gt;USART peripheral DMA, I guess you use Single buffer mode,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_1.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/71541i5EE36B1DFC940847/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_1.png" alt="pastedImage_1.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Have a great day,&lt;BR /&gt;TIC&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-------------------------------------------------------------------------------&lt;BR /&gt;Note:&lt;BR /&gt;- If this post answers your question, please click the "Mark Correct" button. Thank you!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- We are following threads for 7 weeks after the last post, later replies are ignored&lt;BR /&gt; Please open a new thread and refer to the closed one, if you have a related question at a later point in time.&lt;BR /&gt;-------------------------------------------------------------------------------&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 12 Apr 2019 09:35:02 GMT</pubDate>
    <dc:creator>Alice_Yang</dc:creator>
    <dc:date>2019-04-12T09:35:02Z</dc:date>
    <item>
      <title>LPC845, DMA : destination increment after transfer</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC845-DMA-destination-increment-after-transfer/m-p/892827#M35797</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi everyone,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm trying to set the DMA to get the USART RX&amp;nbsp;data when it's available.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So I set up the DMA for a hardware trigger, 1 byte transfer (no BURST). The source USART RX (not incremented) to a buffer I declared in the RAM (incremented), and to be reloaded with the same descriptor at the end.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The transfer happens and I do get the data. But when the descriptor is reloaded, I suppose that the destination address does not get incremented, thus overwriting the previous data over and over...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As a work around, I implemented the DMA IRQ to increment my dest address at th end of a transfer, it is now working.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But isn't there a way for the DMA to automatically increment the dest address over several transfers ? (I did set the DSTINC flag in the XFERCFG register, but I suppose it's only incrementing the dest address within the same transfer...)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Many thanks.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here's my code :&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;typedef enum _DMA_CHANNEL&lt;BR /&gt;{&lt;BR /&gt; DMA_CHANNEL_USART0_RX = 0,&lt;BR /&gt; DMA_CHANNEL_USART0_TX,&lt;BR /&gt; DMA_CHANNEL_USART1_RX,&lt;BR /&gt; DMA_CHANNEL_USART1_TX,&lt;BR /&gt; DMA_CHANNEL_USART2_RX,&lt;BR /&gt; DMA_CHANNEL_USART2_TX,&lt;BR /&gt; DMA_CHANNEL_USART3_RX,&lt;BR /&gt; DMA_CHANNEL_USART3_TX,&lt;BR /&gt; DMA_CHANNEL_USART4_RX,&lt;BR /&gt; DMA_CHANNEL_USART4_TX,&lt;BR /&gt; DMA_CHANNEL_SPI0_RX,&lt;BR /&gt; DMA_CHANNEL_SPI0_TX,&lt;BR /&gt; DMA_CHANNEL_SPI1_RX,&lt;BR /&gt; DMA_CHANNEL_SPI1_TX,&lt;BR /&gt; DMA_CHANNEL_I2C0_MST,&lt;BR /&gt; DMA_CHANNEL_I2C0_SLV,&lt;BR /&gt; DMA_CHANNEL_I2C1_MST,&lt;BR /&gt; DMA_CHANNEL_I2C1_SLV,&lt;BR /&gt; DMA_CHANNEL_I2C2_MST,&lt;BR /&gt; DMA_CHANNEL_I2C2_SLV,&lt;BR /&gt; DMA_CHANNEL_I2C3_MST,&lt;BR /&gt; DMA_CHANNEL_I2C3_SLV,&lt;BR /&gt; DMA_CHANNEL_DAC0,&lt;BR /&gt; DMA_CHANNEL_DAC1,&lt;BR /&gt; DMA_CHANNEL_CAPT1,&lt;BR /&gt; DMA_CHANNEL_COUNT&lt;BR /&gt;} T_DMA_CHANNEL;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;typedef struct _DMA_DESCRIPTOR&lt;BR /&gt;{&lt;BR /&gt; volatile t_uint32 xfercfg; //!&amp;lt; Transfer configuration&lt;BR /&gt;t_uint8 *srcEndAddr; //!&amp;lt; Last source address of DMA transfer &lt;BR /&gt;t_uint8 *dstEndAddr; //!&amp;lt; Last destination address of DMA transfer &lt;BR /&gt;t_uint_32 *linkToNextDesc; //!&amp;lt; Address of next DMA descriptor in chain &lt;BR /&gt;} T_DMA_DESCRIPTOR;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;__attribute__((aligned(512))) static T_DMA_DESCRIPTOR s_dma_descriptor_table[DMA_CHANNEL_COUNT] = {0};&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;t_uint8 rxBuffer[20] = { 0 };&lt;BR /&gt; &lt;BR /&gt; DMA0-&amp;gt;SRAMBASE = (t_uint32)s_dma_descriptor_table;&lt;BR /&gt; DMA0-&amp;gt;CTRL = DMA_CTRL_ENABLE_MASK;&lt;BR /&gt; DMA0-&amp;gt;COMMON-&amp;gt;ENABLESET |= 1 &amp;lt;&amp;lt; DMA_CHANNEL_USART0_RX;&lt;BR /&gt; DMA0-&amp;gt;COMMON-&amp;gt;INTENSET |= 1 &amp;lt;&amp;lt; DMA_CHANNEL_USART0_RX;&lt;BR /&gt; &lt;BR /&gt; DMA0-&amp;gt;CHANNEL[DMA_CHANNEL_USART0_RX].CFG = 1 &amp;lt;&amp;lt; DMA_CHANNEL_CFG_CHPRIORITY_SHIFT |&lt;BR /&gt; 1 &amp;lt;&amp;lt; DMA_CHANNEL_CFG_PERIPHREQEN_SHIFT |&lt;BR /&gt; 1 &amp;lt;&amp;lt; DMA_CHANNEL_CFG_HWTRIGEN_SHIFT |&lt;BR /&gt; 1 &amp;lt;&amp;lt; DMA_CHANNEL_CFG_TRIGPOL_SHIFT |&amp;nbsp;&lt;BR /&gt; 0 &amp;lt;&amp;lt; DMA_CHANNEL_CFG_TRIGTYPE_SHIFT |&amp;nbsp;&lt;BR /&gt; 0 &amp;lt;&amp;lt; DMA_CHANNEL_CFG_TRIGBURST_SHIFT |&lt;BR /&gt; 0 &amp;lt;&amp;lt; DMA_CHANNEL_CFG_BURSTPOWER_SHIFT |&lt;BR /&gt; 1 &amp;lt;&amp;lt; DMA_CHANNEL_CFG_SRCBURSTWRAP_SHIFT |&lt;BR /&gt; 0 &amp;lt;&amp;lt; DMA_CHANNEL_CFG_DSTBURSTWRAP_SHIFT;&lt;BR /&gt; &lt;BR /&gt; DMA0-&amp;gt;CHANNEL[DMA_CHANNEL_USART0_RX].XFERCFG = 1 &amp;lt;&amp;lt; DMA_CHANNEL_XFERCFG_CFGVALID_SHIFT |&lt;BR /&gt; 1 &amp;lt;&amp;lt; DMA_CHANNEL_XFERCFG_RELOAD_SHIFT |&lt;BR /&gt; 0 &amp;lt;&amp;lt; DMA_CHANNEL_XFERCFG_SWTRIG_SHIFT |&lt;BR /&gt; 0 &amp;lt;&amp;lt; DMA_CHANNEL_XFERCFG_CLRTRIG_SHIFT |&lt;BR /&gt; 1 &amp;lt;&amp;lt; DMA_CHANNEL_XFERCFG_SETINTA_SHIFT |&lt;BR /&gt; 0 &amp;lt;&amp;lt; DMA_CHANNEL_XFERCFG_SETINTB_SHIFT |&lt;BR /&gt; 0 &amp;lt;&amp;lt; DMA_CHANNEL_XFERCFG_WIDTH_SHIFT |&lt;BR /&gt; 0 &amp;lt;&amp;lt; DMA_CHANNEL_XFERCFG_SRCINC_SHIFT |&lt;BR /&gt; 1 &amp;lt;&amp;lt; DMA_CHANNEL_XFERCFG_DSTINC_SHIFT |&lt;BR /&gt; 0 &amp;lt;&amp;lt; DMA_CHANNEL_XFERCFG_XFERCOUNT_SHIFT;&lt;BR /&gt; &lt;BR /&gt; // Setup Descriptor&lt;BR /&gt; s_dma_descriptor_table[DMA_CHANNEL_USART0_RX].xfercfg = DMA0-&amp;gt;CHANNEL[DMA_CHANNEL_USART0_RX].XFERCFG;&lt;BR /&gt; s_dma_descriptor_table[DMA_CHANNEL_USART0_RX].srcEndAddr = (t_uint8 *) &amp;amp;USART0-&amp;gt;RXDAT; &lt;BR /&gt; s_dma_descriptor_table[DMA_CHANNEL_USART0_RX].dstEndAddr = rxBuffer;&lt;BR /&gt; s_dma_descriptor_table[DMA_CHANNEL_USART0_RX].linkToNextDesc = (t_uint32*) &amp;amp;s_dma_descriptor_table[DMA_CHANNEL_USART0_RX].xfercfg;&lt;BR /&gt; &lt;BR /&gt; INPUTMUX-&amp;gt;DMA_ITRIG_INMUX[DMA_CHANNEL_USART0_RX] = 0x9;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;// The IRQ workaround solution that I tried&lt;/P&gt;&lt;P&gt;void DMA_IRQ_handler( void )&lt;BR /&gt;{&lt;BR /&gt; s_dma_descriptor_table[DMA_CHANNEL_USART0_RX].dstEndAddr++;&lt;BR /&gt;}&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Apr 2019 12:27:06 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC845-DMA-destination-increment-after-transfer/m-p/892827#M35797</guid>
      <dc:creator>j_mosnino</dc:creator>
      <dc:date>2019-04-11T12:27:06Z</dc:date>
    </item>
    <item>
      <title>Re: LPC845, DMA : destination increment after transfer</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC845-DMA-destination-increment-after-transfer/m-p/892828#M35798</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello &lt;A _jive_internal="true" data-content-finding="Community" data-userid="339525" data-username="j.mosnino@hotmail.fr" href="https://community.nxp.com/people/j.mosnino@hotmail.fr"&gt;jo mos&lt;/A&gt; ,&lt;/P&gt;&lt;P&gt;Yes, we can only reconfigure the channel descriptor in Single buffer mode, in descriptor re-configure&lt;/P&gt;&lt;P&gt;destination.&lt;/P&gt;&lt;P&gt;USART peripheral DMA, I guess you use Single buffer mode,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_1.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/71541i5EE36B1DFC940847/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_1.png" alt="pastedImage_1.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Have a great day,&lt;BR /&gt;TIC&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-------------------------------------------------------------------------------&lt;BR /&gt;Note:&lt;BR /&gt;- If this post answers your question, please click the "Mark Correct" button. Thank you!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- We are following threads for 7 weeks after the last post, later replies are ignored&lt;BR /&gt; Please open a new thread and refer to the closed one, if you have a related question at a later point in time.&lt;BR /&gt;-------------------------------------------------------------------------------&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Apr 2019 09:35:02 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC845-DMA-destination-increment-after-transfer/m-p/892828#M35798</guid>
      <dc:creator>Alice_Yang</dc:creator>
      <dc:date>2019-04-12T09:35:02Z</dc:date>
    </item>
  </channel>
</rss>

