<?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: LPC55S36 issue configuring ADC with DMA in LPC Microcontrollers</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC55S36-issue-configuring-ADC-with-DMA/m-p/1456238#M48732</link>
    <description>Hi,
It appears that the ADC configuration is incorrect.
If you want to sample 3 ADC channel for each triggering(either software or hardware), you can use the command chain like:
 /* Set conversion CMD configuration. */
//First command ID index 1 which can configue ONE ADC analog channel
      LPADC_GetDefaultConvCommandConfig(&amp;amp;g_LpadcCommandConfigStruct);
      g_LpadcCommandConfigStruct.channelNumber = ADC_CHANNEL; //it can be 0,1,2,3,4..whatever you are samplg
      g_LpadcCommandConfigStruct.conversionResolutionMode = kLPADC_ConversionResolutionHigh;
          g_LpadcCommandConfigStruct.chainedNextCommandNumber = 2;
          LPADC_SetConvCommandConfig(DEMO_LPADC_BASE, 1, &amp;amp;g_LpadcCommandConfigStruct);

//second command ID index 2 which can configue another ADC analog channel
      LPADC_GetDefaultConvCommandConfig(&amp;amp;g_LpadcCommandConfigStruct);
      g_LpadcCommandConfigStruct.channelNumber = ANOTHER_ADC_CHANNEL; //it can be 0,1,2,3,4..whatever you are sampling
      g_LpadcCommandConfigStruct.conversionResolutionMode = kLPADC_ConversionResolutionHigh;
          g_LpadcCommandConfigStruct.chainedNextCommandNumber = 3;
          LPADC_SetConvCommandConfig(DEMO_LPADC_BASE, 2, &amp;amp;g_LpadcCommandConfigStruct);

//third command ID index 3 which can configue another ADC analog channel
      LPADC_GetDefaultConvCommandConfig(&amp;amp;g_LpadcCommandConfigStruct);
      g_LpadcCommandConfigStruct.channelNumber = Another_ADC_CHANNEL;// it can be 0,1,2,3,4...
      g_LpadcCommandConfigStruct.conversionResolutionMode = kLPADC_ConversionResolutionHigh;
          g_LpadcCommandConfigStruct.chainedNextCommandNumber = 0; // Rong:0 means last channel
          LPADC_SetConvCommandConfig(DEMO_LPADC_BASE, 3, &amp;amp;g_LpadcCommandConfigStruct);


Pls have a try.
BR
XiangJun Rong</description>
    <pubDate>Wed, 11 May 2022 08:28:16 GMT</pubDate>
    <dc:creator>xiangjun_rong</dc:creator>
    <dc:date>2022-05-11T08:28:16Z</dc:date>
    <item>
      <title>LPC55S36 issue configuring ADC with DMA</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC55S36-issue-configuring-ADC-with-DMA/m-p/1453409#M48658</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I'm working on a LPCXpresso55S36 evaluation board (SCH-47745 REV A) and i'm trying to read multiple ADC channels with DMA. I'm started from lpadc dma driver example in SDK 2.10.2. I've attached the lpadc_dma.c file with the changes i made, that are basically the following:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;added the define of a constant value named&amp;nbsp;ADC_READS which represents how many channels of the ADC are read. For simplicity, i read channels from 0 to&amp;nbsp;ADC_READS - 1 only side A. For example, defining&amp;nbsp;&amp;nbsp;ADC_READS 3, only ADC0_CH0A,&amp;nbsp;ADC0_CH1A and&amp;nbsp;ADC0_CH2A are read.&lt;/LI&gt;&lt;LI&gt;changed the dimension of the destination array&amp;nbsp;g_AdcConvResult, from one element to ADC_READS elements.&lt;/LI&gt;&lt;LI&gt;changed the transfer configuration variable, defining the destination increment as&amp;nbsp;kDMA_AddressInterleave1xWidth (every transfer goes to one element of the destination array), and the total bytes of the transfer as&amp;nbsp;sizeof(g_AdcConvResult).&lt;/LI&gt;&lt;LI&gt;set the fifo0 watermark level in the adc configuration:&amp;nbsp;lpadcConfigStruct.FIFO0Watermark = ADC_READS - 1;&lt;/LI&gt;&lt;LI&gt;added multiple ADC channel reading. As i mentioned before, for simplicity i read the first&amp;nbsp;ADC_READS - 1 ADC channels, so i can configure the conversion commands with a for loop.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;The result is that with&amp;nbsp;ADC_READS set to 1,2, or 3 the DMA transfer completes correclty, but for&amp;nbsp;ADC_READS &amp;gt; 3 the program gets stuck in the "while (false == g_DmaTransferDoneFlag)" loop.&lt;/P&gt;&lt;P&gt;In this loop, I've tried to read the XFERCOUNT bits from XFERCFG21 register of DMA, and seems that with&amp;nbsp;ADC_READS &amp;gt; 3 there are always some transfers left (example, with&amp;nbsp;ADC_READS 7, there are 2 transfers left). I've also tried to read the FCOUNT bits from&amp;nbsp; FCTRL0 register of ADC and there are also some elements in the fifo (example, with&amp;nbsp;ADC_READS 7, there are 3 elements left in the fifo). Before the starting of DMA transfer i can see correctly a total of ADC_READS elements in the fifo.&lt;/P&gt;&lt;P&gt;Morevoer, i've tried to set the&amp;nbsp;lpadcConfigStruct.FIFO0Watermark fixed to value 2, and in this case, due to some delays, the DMA transfer works correctly up to&amp;nbsp;ADC_READS 15.&lt;/P&gt;&lt;P&gt;Obviously this is not a correctly solution.&lt;/P&gt;&lt;P&gt;How can i configure the DMA correctly also with more than 3 channels?&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Best regards.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Enrico&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 05 May 2022 09:30:45 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC55S36-issue-configuring-ADC-with-DMA/m-p/1453409#M48658</guid>
      <dc:creator>EnBono</dc:creator>
      <dc:date>2022-05-05T09:30:45Z</dc:date>
    </item>
    <item>
      <title>Re: LPC55S36 issue configuring ADC with DMA</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC55S36-issue-configuring-ADC-with-DMA/m-p/1456238#M48732</link>
      <description>Hi,
It appears that the ADC configuration is incorrect.
If you want to sample 3 ADC channel for each triggering(either software or hardware), you can use the command chain like:
 /* Set conversion CMD configuration. */
//First command ID index 1 which can configue ONE ADC analog channel
      LPADC_GetDefaultConvCommandConfig(&amp;amp;g_LpadcCommandConfigStruct);
      g_LpadcCommandConfigStruct.channelNumber = ADC_CHANNEL; //it can be 0,1,2,3,4..whatever you are samplg
      g_LpadcCommandConfigStruct.conversionResolutionMode = kLPADC_ConversionResolutionHigh;
          g_LpadcCommandConfigStruct.chainedNextCommandNumber = 2;
          LPADC_SetConvCommandConfig(DEMO_LPADC_BASE, 1, &amp;amp;g_LpadcCommandConfigStruct);

//second command ID index 2 which can configue another ADC analog channel
      LPADC_GetDefaultConvCommandConfig(&amp;amp;g_LpadcCommandConfigStruct);
      g_LpadcCommandConfigStruct.channelNumber = ANOTHER_ADC_CHANNEL; //it can be 0,1,2,3,4..whatever you are sampling
      g_LpadcCommandConfigStruct.conversionResolutionMode = kLPADC_ConversionResolutionHigh;
          g_LpadcCommandConfigStruct.chainedNextCommandNumber = 3;
          LPADC_SetConvCommandConfig(DEMO_LPADC_BASE, 2, &amp;amp;g_LpadcCommandConfigStruct);

//third command ID index 3 which can configue another ADC analog channel
      LPADC_GetDefaultConvCommandConfig(&amp;amp;g_LpadcCommandConfigStruct);
      g_LpadcCommandConfigStruct.channelNumber = Another_ADC_CHANNEL;// it can be 0,1,2,3,4...
      g_LpadcCommandConfigStruct.conversionResolutionMode = kLPADC_ConversionResolutionHigh;
          g_LpadcCommandConfigStruct.chainedNextCommandNumber = 0; // Rong:0 means last channel
          LPADC_SetConvCommandConfig(DEMO_LPADC_BASE, 3, &amp;amp;g_LpadcCommandConfigStruct);


Pls have a try.
BR
XiangJun Rong</description>
      <pubDate>Wed, 11 May 2022 08:28:16 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC55S36-issue-configuring-ADC-with-DMA/m-p/1456238#M48732</guid>
      <dc:creator>xiangjun_rong</dc:creator>
      <dc:date>2022-05-11T08:28:16Z</dc:date>
    </item>
    <item>
      <title>Re: LPC55S36 issue configuring ADC with DMA</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC55S36-issue-configuring-ADC-with-DMA/m-p/1457721#M48751</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/26034"&gt;@xiangjun_rong&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;Thank you for your reply. Sorry but i can't see any difference from your configuration and mine:&lt;/P&gt;&lt;P&gt;for (i=0;i&amp;lt;ADC_READS;i++)&lt;BR /&gt;{&lt;BR /&gt;/* Set conversion CMD configuration. */&lt;BR /&gt;LPADC_GetDefaultConvCommandConfig(&amp;amp;g_LpadcCommandConfigStruct);&lt;BR /&gt;g_LpadcCommandConfigStruct.channelNumber = i;&lt;BR /&gt;g_LpadcCommandConfigStruct.conversionResolutionMode = kLPADC_ConversionResolutionHigh;&lt;BR /&gt;if(i == (ADC_READS - 1))&lt;BR /&gt;g_LpadcCommandConfigStruct.chainedNextCommandNumber = 0;&lt;BR /&gt;else&lt;BR /&gt;g_LpadcCommandConfigStruct.chainedNextCommandNumber = i+2;&lt;BR /&gt;LPADC_SetConvCommandConfig(DEMO_LPADC_BASE, i+1, &amp;amp;g_LpadcCommandConfigStruct);&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;with this loop, using ADC_READS 3, it is the same as your configuration:&lt;/P&gt;&lt;P&gt;i=0 configures command 1, which reads channel 0 with&amp;nbsp;chainedNextCommandNumber = 2.&lt;/P&gt;&lt;P&gt;i=1&amp;nbsp;configures command 2, which reads channel 1 with&amp;nbsp;chainedNextCommandNumber = 3.&lt;/P&gt;&lt;P&gt;i=2 configures command 3, which reads channel 2 with&amp;nbsp;chainedNextCommandNumber = 0.&lt;/P&gt;&lt;P&gt;As i said in my question, using a number of channels &amp;lt;= 3 the dma transfer ends correctly. Using a number of channel grater than 4 (ADC_READS 4,&amp;nbsp;ADC_READS 5 ...&amp;nbsp;ADC_READS 15) the dma transfer never ends. For completeness i've also tried to add a fourth channel to your version:&lt;/P&gt;&lt;P&gt;/* Set conversion CMD configuration. */&lt;BR /&gt;&lt;BR /&gt;//First command ID index 1 which can configue ONE ADC analog channel&lt;BR /&gt;LPADC_GetDefaultConvCommandConfig(&amp;amp;g_LpadcCommandConfigStruct);&lt;BR /&gt;g_LpadcCommandConfigStruct.channelNumber = ADC_CHANNEL;&lt;BR /&gt;//it can be 0,1,2,3,4..whatever you are samplg&lt;BR /&gt;g_LpadcCommandConfigStruct.conversionResolutionMode = kLPADC_ConversionResolutionHigh;&lt;BR /&gt;g_LpadcCommandConfigStruct.chainedNextCommandNumber = 2;&lt;BR /&gt;LPADC_SetConvCommandConfig(DEMO_LPADC_BASE, 1, &amp;amp;g_LpadcCommandConfigStruct);&lt;BR /&gt;&lt;BR /&gt;//second command ID index 2 which can configue another ADC analog channel&lt;BR /&gt;LPADC_GetDefaultConvCommandConfig(&amp;amp;g_LpadcCommandConfigStruct);&lt;BR /&gt;g_LpadcCommandConfigStruct.channelNumber = ANOTHER_ADC_CHANNEL;&lt;BR /&gt;//it can be 0,1,2,3,4..whatever you are sampling&lt;BR /&gt;g_LpadcCommandConfigStruct.conversionResolutionMode = kLPADC_ConversionResolutionHigh;&lt;BR /&gt;g_LpadcCommandConfigStruct.chainedNextCommandNumber = 3;&lt;BR /&gt;LPADC_SetConvCommandConfig(DEMO_LPADC_BASE, 2, &amp;amp;g_LpadcCommandConfigStruct);&lt;BR /&gt;&lt;BR /&gt;//third command ID index 3 which can configue another ADC analog channel&lt;BR /&gt;LPADC_GetDefaultConvCommandConfig(&amp;amp;g_LpadcCommandConfigStruct);&lt;BR /&gt;g_LpadcCommandConfigStruct.channelNumber = Another_ADC_CHANNEL;// it can be 0,1,2,3,4...&lt;BR /&gt;g_LpadcCommandConfigStruct.conversionResolutionMode = kLPADC_ConversionResolutionHigh;&lt;BR /&gt;g_LpadcCommandConfigStruct.chainedNextCommandNumber = 4;&lt;BR /&gt;LPADC_SetConvCommandConfig(DEMO_LPADC_BASE, 3, &amp;amp;g_LpadcCommandConfigStruct);&lt;BR /&gt;&lt;BR /&gt;//fourth command ID index 4 which can configue another ADC analog channel&lt;BR /&gt;LPADC_GetDefaultConvCommandConfig(&amp;amp;g_LpadcCommandConfigStruct);&lt;BR /&gt;g_LpadcCommandConfigStruct.channelNumber = Just_Another_ADC_CHANNEL;// it can be 0,1,2,3,4...&lt;BR /&gt;g_LpadcCommandConfigStruct.conversionResolutionMode = kLPADC_ConversionResolutionHigh;&lt;BR /&gt;g_LpadcCommandConfigStruct.chainedNextCommandNumber = 0;&lt;BR /&gt;// Rong:0 means last channel&lt;BR /&gt;LPADC_SetConvCommandConfig(DEMO_LPADC_BASE, 4, &amp;amp;g_LpadcCommandConfigStruct);&lt;/P&gt;&lt;P&gt;And the result is the same as mine: main loop gets stuck in "while (false == g_DmaTransferDoneFlag)".&lt;/P&gt;</description>
      <pubDate>Fri, 13 May 2022 06:50:48 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC55S36-issue-configuring-ADC-with-DMA/m-p/1457721#M48751</guid>
      <dc:creator>EnBono</dc:creator>
      <dc:date>2022-05-13T06:50:48Z</dc:date>
    </item>
    <item>
      <title>Re: LPC55S36 issue configuring ADC with DMA</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC55S36-issue-configuring-ADC-with-DMA/m-p/1631049#M52167</link>
      <description>&lt;P&gt;Hi!&amp;nbsp;&lt;BR /&gt;Did you solve your problem? I'm currently facing with exactly the same issue using the LPC55S06 mcu and the lpadc_dma example &lt;LI-EMOJI id="lia_disappointed-face" title=":disappointed_face:"&gt;&lt;/LI-EMOJI&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Martina&lt;/P&gt;</description>
      <pubDate>Tue, 11 Apr 2023 07:21:13 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC55S36-issue-configuring-ADC-with-DMA/m-p/1631049#M52167</guid>
      <dc:creator>Martifly</dc:creator>
      <dc:date>2023-04-11T07:21:13Z</dc:date>
    </item>
    <item>
      <title>Re: LPC55S36 issue configuring ADC with DMA</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC55S36-issue-configuring-ADC-with-DMA/m-p/1631099#M52169</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/215585"&gt;@Martifly&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;Unfortunately I couldn't find a way to solve that problem, so i decided to read the converted values directly form FIFOs. In my case the process takes a couple of microseconds, but it works correctly, unlike what happened with the use of DMA&lt;/P&gt;</description>
      <pubDate>Tue, 11 Apr 2023 08:18:34 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC55S36-issue-configuring-ADC-with-DMA/m-p/1631099#M52169</guid>
      <dc:creator>EnBono</dc:creator>
      <dc:date>2023-04-11T08:18:34Z</dc:date>
    </item>
    <item>
      <title>Re: LPC55S36 issue configuring ADC with DMA</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC55S36-issue-configuring-ADC-with-DMA/m-p/1631142#M52170</link>
      <description>&lt;P&gt;Hi, thank you for your reply.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm going to use a sort of "workaround" using the lpadc + dma to read 3 channel at a time with 2 different Software triggers (since I need to read 6 adc channels every 60 microseconds).&lt;/P&gt;&lt;P&gt;In any case, I think I will try to contact an NXP support and I will keep you updated in case of a solution!&lt;/P&gt;&lt;P&gt;Martina&lt;/P&gt;</description>
      <pubDate>Tue, 11 Apr 2023 08:43:28 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC55S36-issue-configuring-ADC-with-DMA/m-p/1631142#M52170</guid>
      <dc:creator>Martifly</dc:creator>
      <dc:date>2023-04-11T08:43:28Z</dc:date>
    </item>
  </channel>
</rss>

