<?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: LPC54102 DMA Software Trigger in LPC Microcontrollers</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC54102-DMA-Software-Trigger/m-p/2109839#M58305</link>
    <description>&lt;P&gt;Hello Harry,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for the response, I appreciate your help.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried the changes you recommended, at least I think I applied the changes you recommended.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could you please take a look at spis_dma.c? This is the file where I've applied the changes. Maybe I'm missing something.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I also attached the original spis_dma_orig.c file provided by NXP. If you compare the files you'll be able to see the changes that I've made.&lt;/P&gt;&lt;P&gt;Maybe other changes are needed for the .xfercfg?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Ricardo&lt;/P&gt;</description>
    <pubDate>Tue, 03 Jun 2025 23:21:31 GMT</pubDate>
    <dc:creator>rhsalced</dc:creator>
    <dc:date>2025-06-03T23:21:31Z</dc:date>
    <item>
      <title>LPC54102 DMA Software Trigger</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC54102-DMA-Software-Trigger/m-p/2108781#M58287</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;My goal is start/stop DMA transfers via software control. From the main loop I would like to start/stop DMA transfers.&lt;/P&gt;&lt;P&gt;The version of the SDK that I am using is v.3.04.000 and the example project is spis_dma. The reason for using this version is that I am working with legacy code that expects this version of the SDK. I am not planning on using the latest SDK and do not plan to.&lt;/P&gt;&lt;P&gt;From my understanding, I need to configure the DMA to be software trigger driven. From the UM10850 14.7.1 doc:&lt;/P&gt;&lt;P&gt;1) “CFGVALID and SV allows a more direct DMA block timing control by software”&lt;/P&gt;&lt;P&gt;Are these set in the .xfercfg on lines 131, 138, 146, 153 or should they be set elsewhere?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2) ”Leaving a CFGVALID bit set to 0 allows the DMA sequence to pause at the description unit software triggers the continuation”&lt;/P&gt;&lt;P&gt;How and where do I set this up?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;3) “If a channel is configured with SWTRIG = 0, the channel can be later triggered either by hardware or software. Software triggering is accomplished by writing a 1 to the appropriate bit in the SETTRIG register”&lt;/P&gt;&lt;P&gt;How and where do I set this register from the main loop?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;4) “When a channel is initially set up, the SWTRIG bit in the XFERCFG register can be set, causing the transfer to begin immediately”&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am unsure if I am configuring the DMA to be software driven.&lt;/P&gt;&lt;P&gt;Also, I don’t know what function/register I should call to start/stop the transfer. I’m calling the Chip_DMA_SetTrigChannel() function from the main loop, I don’t think I’m using this function correctly.&lt;/P&gt;&lt;P&gt;All that I am trying to do is set a DMA transfer once a second from the main loop via a software trigger. I could really use some help on how to do this.&lt;/P&gt;&lt;P&gt;The changes that I made to spis_dma.c:&lt;/P&gt;&lt;P&gt;1) Set SPI as master. Original project SPI was configured as slave. Set spiSetup.master = 1 on line 80.&lt;/P&gt;&lt;P&gt;2) Removed DMA_XFERCFG_RELOAD from xfercfg (lines 131, 138, 146, 153). I think I needed to do this so the DMA wouldn’t continuously execute.&lt;/P&gt;&lt;P&gt;3) Commented out spis_dma_Start(); from lines 189 and line 201.&lt;/P&gt;&lt;P&gt;4) In main, calling software dma trigger once a second. Lines 257- 258.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help on how to set up a software DMA trigger would be appreciated.&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Mon, 02 Jun 2025 16:30:51 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC54102-DMA-Software-Trigger/m-p/2108781#M58287</guid>
      <dc:creator>rhsalced</dc:creator>
      <dc:date>2025-06-02T16:30:51Z</dc:date>
    </item>
    <item>
      <title>Re: LPC54102 DMA Software Trigger</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC54102-DMA-Software-Trigger/m-p/2109440#M58297</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/229179"&gt;@rhsalced&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;According the&amp;nbsp;UM10850.&lt;/P&gt;
&lt;P&gt;To enable full software control of DMA transfers, you need to:&lt;/P&gt;
&lt;P&gt;Disable peripheral requests (set PERIPHREQEN = 0)&lt;/P&gt;
&lt;P&gt;Configure SWTRIG in XFERCFG for immediate start, or&lt;/P&gt;
&lt;P&gt;Use the SETTRIG register from your main loop&lt;/P&gt;
&lt;P&gt;Use CFGVALID = 0 and SETVALID to pause and resume descriptor chains&lt;/P&gt;
&lt;P&gt;1.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;CFGVALID is set in the descriptor itself:&lt;/P&gt;
&lt;P&gt;dmaDescriptor.xfercfg = DMA_CHANNEL_XFERCFG_CFGVALID_MASK | other_fields;&lt;/P&gt;
&lt;P&gt;To pause execution at a descriptor:&lt;/P&gt;
&lt;P&gt;Do not set CFGVALID in .xfercfg for that descriptor.&lt;/P&gt;
&lt;P&gt;Then&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;DMA0-&amp;gt;SETVALID0 = (1U &amp;lt;&amp;lt; channelNum); // e.g., channelNum = 0&lt;/P&gt;
&lt;P&gt;2.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In your descriptor chain, zero out CFGVALID for the descriptor where you want to pause.&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;descriptor[i].xfercfg &amp;amp;= ~DMA_CHANNEL_XFERCFG_CFGVALID_MASK;&lt;/P&gt;
&lt;P&gt;Then, from your main loop:&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;DMA0-&amp;gt;SETVALID0 = (1U &amp;lt;&amp;lt; DMA_CHANNEL_NUMBER);&lt;/P&gt;
&lt;P&gt;3.&lt;/P&gt;
&lt;P&gt;From your main loop, trigger a DMA transfer like this:&lt;/P&gt;
&lt;P&gt;DMA0-&amp;gt;SETTRIG = (1U &amp;lt;&amp;lt; DMA_CHANNEL_NUMBER); // software trigger&lt;/P&gt;
&lt;P&gt;BR&lt;/P&gt;
&lt;P&gt;Harry&lt;/P&gt;</description>
      <pubDate>Tue, 03 Jun 2025 10:30:31 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC54102-DMA-Software-Trigger/m-p/2109440#M58297</guid>
      <dc:creator>Harry_Zhang</dc:creator>
      <dc:date>2025-06-03T10:30:31Z</dc:date>
    </item>
    <item>
      <title>Re: LPC54102 DMA Software Trigger</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC54102-DMA-Software-Trigger/m-p/2109839#M58305</link>
      <description>&lt;P&gt;Hello Harry,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for the response, I appreciate your help.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried the changes you recommended, at least I think I applied the changes you recommended.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could you please take a look at spis_dma.c? This is the file where I've applied the changes. Maybe I'm missing something.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I also attached the original spis_dma_orig.c file provided by NXP. If you compare the files you'll be able to see the changes that I've made.&lt;/P&gt;&lt;P&gt;Maybe other changes are needed for the .xfercfg?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Ricardo&lt;/P&gt;</description>
      <pubDate>Tue, 03 Jun 2025 23:21:31 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC54102-DMA-Software-Trigger/m-p/2109839#M58305</guid>
      <dc:creator>rhsalced</dc:creator>
      <dc:date>2025-06-03T23:21:31Z</dc:date>
    </item>
    <item>
      <title>Re: LPC54102 DMA Software Trigger</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC54102-DMA-Software-Trigger/m-p/2109849#M58306</link>
      <description>Forgot to mention I'm trying to stop the pause/resume at dmaSPISTxDesc[0].&lt;BR /&gt;&lt;BR /&gt;I set dmaSPISTxDesc[0] = ~DMA_XFERCFG_CFGVALID.&lt;BR /&gt;&lt;BR /&gt;And in the main loop I try resuming by setting SETVALID and SETTRIG.</description>
      <pubDate>Tue, 03 Jun 2025 23:46:41 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC54102-DMA-Software-Trigger/m-p/2109849#M58306</guid>
      <dc:creator>rhsalced</dc:creator>
      <dc:date>2025-06-03T23:46:41Z</dc:date>
    </item>
    <item>
      <title>Re: LPC54102 DMA Software Trigger</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC54102-DMA-Software-Trigger/m-p/2111009#M58314</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/229179"&gt;@rhsalced&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I will check the spis_dma.c and spis_dma_orig.c.&lt;/P&gt;
&lt;P&gt;BR&lt;/P&gt;
&lt;P&gt;Harry&lt;/P&gt;</description>
      <pubDate>Thu, 05 Jun 2025 06:46:53 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC54102-DMA-Software-Trigger/m-p/2111009#M58314</guid>
      <dc:creator>Harry_Zhang</dc:creator>
      <dc:date>2025-06-05T06:46:53Z</dc:date>
    </item>
    <item>
      <title>Re: LPC54102 DMA Software Trigger</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC54102-DMA-Software-Trigger/m-p/2112214#M58319</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/229957"&gt;@Harry_Zhang&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;Have you had the chance to look at spis_dma.c and spis_dma_orig.c?&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Ricardo&lt;/P&gt;</description>
      <pubDate>Fri, 06 Jun 2025 16:36:23 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC54102-DMA-Software-Trigger/m-p/2112214#M58319</guid>
      <dc:creator>rhsalced</dc:creator>
      <dc:date>2025-06-06T16:36:23Z</dc:date>
    </item>
    <item>
      <title>Re: LPC54102 DMA Software Trigger</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC54102-DMA-Software-Trigger/m-p/2112437#M58326</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/229179"&gt;@rhsalced&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I’ve reviewed your code and identified a few critical issues.&lt;/P&gt;
&lt;P&gt;In Hostif_Init():&lt;/P&gt;
&lt;P&gt;Chip_DMA_SetupChannelConfig(LPC_DMA, APP_SPI_DMA_TXCH,&lt;BR /&gt;(~DMA_CFG_PERIPHREQEN | DMA_CFG_TRIGBURST_SNGL | DMA_CFG_CHPRIORITY(0)));&lt;/P&gt;
&lt;P&gt;This is incorrect. You're using bitwise NOT (~DMA_CFG_PERIPHREQEN) which results in all bits flipped and corrupts the config.&lt;/P&gt;
&lt;P&gt;In spis_dma_Start():&lt;/P&gt;
&lt;P&gt;dmaSPISTxDesc[0].xfercfg = ~DMA_XFERCFG_CFGVALID | ...&lt;/P&gt;
&lt;P&gt;The ~DMA_XFERCFG_CFGVALID again corrupts the value.&lt;/P&gt;
&lt;P&gt;BR&lt;/P&gt;
&lt;P&gt;Harry&lt;/P&gt;</description>
      <pubDate>Mon, 09 Jun 2025 01:53:25 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC54102-DMA-Software-Trigger/m-p/2112437#M58326</guid>
      <dc:creator>Harry_Zhang</dc:creator>
      <dc:date>2025-06-09T01:53:25Z</dc:date>
    </item>
    <item>
      <title>Re: LPC54102 DMA Software Trigger</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC54102-DMA-Software-Trigger/m-p/2113055#M58339</link>
      <description>&lt;P&gt;1)&amp;nbsp;&lt;/P&gt;&lt;P&gt;In Hostif_Init():&lt;/P&gt;&lt;P&gt;Chip_DMA_SetupChannelConfig(LPC_DMA, APP_SPI_DMA_TXCH,&lt;BR /&gt;(~DMA_CFG_PERIPHREQEN | DMA_CFG_TRIGBURST_SNGL | DMA_CFG_CHPRIORITY(0)));&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I changed this to:&amp;nbsp;&lt;/P&gt;&lt;P&gt;Chip_DMA_SetupChannelConfig(LPC_DMA, APP_SPI_DMA_TXCH,&lt;BR /&gt;(DMA_CFG_TRIGBURST_SNGL | DMA_CFG_CHPRIORITY(0)));&lt;/P&gt;&lt;P&gt;Did the same for RX.&amp;nbsp;&lt;/P&gt;&lt;P&gt;2)&amp;nbsp;&lt;/P&gt;&lt;P&gt;In spis_dma_Start():&lt;/P&gt;&lt;P&gt;dmaSPISTxDesc[0].xfercfg = ~DMA_XFERCFG_CFGVALID | ...&lt;/P&gt;&lt;P&gt;I removed the ~DMA_XFERCFG_CRGVALID from&amp;nbsp;dmaSPISTxDesc[0].xfercfg. I want to pause/resume from this descriptor. The other descriptors have&amp;nbsp;DMA_XFERCFG_CFGVALID.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Attached is the updated spis_dma.c.&lt;/P&gt;&lt;P&gt;My goal is to resume the DMA from the main loop once per second. Pausing and resuming from&amp;nbsp;dmaSPISTxDesc[0].xfercfg. On the Oscope, I'm only see the SPI bus active for one TX transfer. The DMA seems to be hung up, not sure what I am doing wrong here.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks, in advance for your help.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 09 Jun 2025 22:19:27 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC54102-DMA-Software-Trigger/m-p/2113055#M58339</guid>
      <dc:creator>rhsalced</dc:creator>
      <dc:date>2025-06-09T22:19:27Z</dc:date>
    </item>
    <item>
      <title>Re: LPC54102 DMA Software Trigger</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC54102-DMA-Software-Trigger/m-p/2114303#M58357</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/229179"&gt;@rhsalced&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your DMA descriptors are configured as a ring (cyclic):&lt;/P&gt;
&lt;P&gt;dmaSPISTxDesc[0].next = DMA_ADDR(&amp;amp;dmaSPISTxDesc[1]);&lt;BR /&gt;dmaSPISTxDesc[1].next = DMA_ADDR(&amp;amp;dmaSPISTxDesc[0]);&lt;/P&gt;
&lt;P&gt;That implies continuous DMA transfer, not single-shot.&lt;/P&gt;
&lt;DIV&gt;I think you can refer to the sdk demo.&lt;/DIV&gt;
&lt;DIV&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Harry_Zhang_0-1749631431790.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/342428i169EC4C3D16D0B5D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Harry_Zhang_0-1749631431790.png" alt="Harry_Zhang_0-1749631431790.png" /&gt;&lt;/span&gt;
&lt;P&gt;Or i think you can&amp;nbsp; Simplify to One-Shot DMA and Restart It&lt;/P&gt;
&lt;DIV&gt;Disable the next field (no chaining):&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;dmaSPISTxDesc[0].next = 0;&lt;/DIV&gt;
&lt;DIV&gt;dmaSPISRxDesc[0].next = 0;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;P&gt;Set CFGVALID on every start:&lt;/P&gt;
&lt;P&gt;Move xfercfg setup into the main loop. For example:&lt;/P&gt;
&lt;P&gt;void start_spi_dma_once(void)&lt;BR /&gt;{&lt;BR /&gt;//set up tx and rx&lt;BR /&gt;}&lt;/P&gt;
&lt;P&gt;BR&lt;/P&gt;
&lt;P&gt;Harry&lt;/P&gt;</description>
      <pubDate>Wed, 11 Jun 2025 08:44:50 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC54102-DMA-Software-Trigger/m-p/2114303#M58357</guid>
      <dc:creator>Harry_Zhang</dc:creator>
      <dc:date>2025-06-11T08:44:50Z</dc:date>
    </item>
  </channel>
</rss>

