<?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>MPC5xxx中的主题 Re: dual conversion, ADC channel order question</title>
    <link>https://community.nxp.com/t5/MPC5xxx/dual-conversion-ADC-channel-order-question/m-p/650061#M6773</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I'm quite confused of this long explanation.&lt;/P&gt;&lt;P&gt;But when is selected dual conversion ADC0 is converted and then ADC1. The ADC0 result is stored first in FIFO and ADC1 as second.&lt;/P&gt;&lt;P&gt;So If you read the FIFO you will read first ADC1 and then ADC0.&lt;/P&gt;&lt;P&gt;Peter&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 30 Dec 2016 10:26:52 GMT</pubDate>
    <dc:creator>petervlna</dc:creator>
    <dc:date>2016-12-30T10:26:52Z</dc:date>
    <item>
      <title>dual conversion, ADC channel order question</title>
      <link>https://community.nxp.com/t5/MPC5xxx/dual-conversion-ADC-channel-order-question/m-p/650060#M6772</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm using a &lt;STRONG&gt;TRK-MPC5604P&lt;/STRONG&gt; kit and I'm following the MPC5643L &lt;STRONG&gt;"PWM triggered measurement concept&lt;/STRONG&gt;" tech note that has been posted in this forum, (I'm using the DMA code as provide).&amp;nbsp; I've changed it to use dual conversion mode (both ADC0 &amp;amp; 1), and I'm getting data, using a PWM trigger of about 1.28ms for testing purposes.&amp;nbsp; The system clock is 40MHz, so the ADC clock is 20MHz.&amp;nbsp; This board has a potentiometer wired to Port E0, which I've configured as ADC1, channel5.&amp;nbsp; I've tested this port assignment using the provided driver, "A2D_GetSingleCh_ADC1(ch)" and that works fine. &amp;nbsp;&amp;nbsp; When using the PWM-CTU-FIFO-DMA, the data values are appropriate, but their location in the array written to by DMA from the FIFO is odd.&amp;nbsp; Specifically, the values that I'm seeing in FreeMaster indicate that the bit for ADC0 is indicated with a "1" and ADC1 is indicated by a "0".&amp;nbsp; Also, I expect the result from ADC0 to be written first, before ADC1, since ADC0 conversion is faster, but I'm seeing the opposite.&amp;nbsp; Seems like my interpretation of ADC1 and ADC0, or the documentation, is reversed.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The following screenshot from FreeMaster indicates that &lt;SPAN style="color: #ff0000;"&gt;ADC_result[0]&lt;/SPAN&gt;, the first value in the result from the FIFO is ADC&lt;SPAN style="color: #ff0000;"&gt;0?&lt;/SPAN&gt;&amp;nbsp;&amp;nbsp; Channel &lt;SPAN style="color: #ff0000;"&gt;5&lt;/SPAN&gt;, with a value of&lt;SPAN style="color: #ff0000;"&gt; 0x3Fe&lt;/SPAN&gt;, (I have the potentiometer maxed at 3.3V).&amp;nbsp; I see alternativing ADC1, ADC0 in the results, (expected) and I can connect the pot to any port and see the appropriate value change, (if I wire the pot to port E7, then ADC_result[7] tracks ADC_result[0].&amp;nbsp;&amp;nbsp; If ADC 0&amp;amp;1 were reversed, this is the ADC order that&amp;nbsp; I would expect.&amp;nbsp; So I'm just wondering why ADC0 &amp;amp; 1 appear reversed from what I expect&lt;SPAN style="color: #ff0000;"&gt;&lt;STRONG&gt;?&lt;/STRONG&gt;&lt;/SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #ff0000;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; a)&lt;/SPAN&gt; ADC1 result appears first in the FIFO, insted of ADC0 which has a faster conversion time;&lt;SPAN style="color: #ff0000;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #ff0000;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b)&lt;/SPAN&gt; ADC1 is indicated by a zero in the ADC results (Ref Man. 25.4.3 ADC result), and ADC0 is show with a "1".&lt;/P&gt;&lt;P&gt;&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 12px;"&gt;&lt;EM&gt;5 bits in the upper 16 bits indicate the &lt;SPAN style="text-decoration: underline;"&gt;ADC unit (1bit)&lt;/SPAN&gt; and the channel number (4 bits).&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="173589_173589.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/122693iD0FB4C4997DFC410/image-size/large?v=v2&amp;amp;px=999" role="button" title="173589_173589.png" alt="173589_173589.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_7.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/4196i1E3318352D07E79D/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_7.png" alt="pastedImage_7.png" /&gt;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ADC_result[7] 0x1A 02 00&amp;nbsp;&amp;nbsp; "1" is suppose to be the ADC #, but it is ADC_0.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier,monospace; font-size: 13px;"&gt;Here's how I configired the CTU ADC command list (triggered off PWM VAL0).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;&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; &lt;SPAN style="font-size: 13px;"&gt;// ADC1B, ADC0A, shift ch_b left one bit&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace; font-size: 13px;"&gt; CTU_0.CLR[0].R = 0x60A4; // 5, 4 dual, first &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace; font-size: 13px;"&gt; CTU_0.CLR[1].R = 0x20C8; // 6, 8&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace; font-size: 13px;"&gt; CTU_0.CLR[2].R = 0x20E9; // 7, 9&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace; font-size: 13px;"&gt; CTU_0.CLR[3].R = 0x21EA; // F, 10&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace; font-size: 13px;"&gt; CTU_0.CLR[4].R = 0x4000; //first, stop&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace; font-size: 13px;"&gt;CTU_0.TH1.B.THRESHOLD0 = 0x7;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* one less thatn # of FIFO 0 entries.*/&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;//------------------------------------------ADC channel initialization.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;void ADC_Init (void)&lt;BR /&gt;{&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;ADC_0.MCR.R = 0;&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; //MCR 0x8002-0000&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;ADC_0.MCR.B.OWREN = 1;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;//overwrite enable&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;ADC_0.MCR.B.CTUEN = 1;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;//CTU mode&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ADC_0.NCMR[0].R = 0x00F0;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //000-0111-1110-0000 enabled conversion channels&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ADC_0.CTR[0].B.INPCMP = 2;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;//1.2us at 20Mhz&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ADC_0.CTR[0].B.INPLATCH = 1;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ADC_0.CTR[0].B.INPSAMP = 13;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ADC_0.CTR[0].B.OFFSHIFT = 1;&amp;nbsp;&amp;nbsp; &amp;nbsp;//tranisition at 1/2 LSB&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;ADC_1.MCR.R = 0;&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; //MCR 0x8002-0000&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;ADC_1.MCR.B.OWREN = 1;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;//overwrite enable&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;ADC_1.MCR.B.CTUEN = 1;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;//CTU mode&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ADC_1.NCMR[0].R = 0x80E0;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //000-0111-1110-0000 enabled conversion channels&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ADC_1.CTR[0].B.INPCMP = 0;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;//3us at 20MHz&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ADC_1.CTR[0].B.INPLATCH = 1;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ADC_1.CTR[0].B.INPSAMP = 14;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ADC_1.CTR[0].B.OFFSHIFT = 1;&amp;nbsp;&amp;nbsp; &amp;nbsp;//tranisition at 1/2 LSB&lt;BR /&gt;}&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Dec 2016 22:34:54 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MPC5xxx/dual-conversion-ADC-channel-order-question/m-p/650060#M6772</guid>
      <dc:creator>duanemattern</dc:creator>
      <dc:date>2016-12-29T22:34:54Z</dc:date>
    </item>
    <item>
      <title>Re: dual conversion, ADC channel order question</title>
      <link>https://community.nxp.com/t5/MPC5xxx/dual-conversion-ADC-channel-order-question/m-p/650061#M6773</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I'm quite confused of this long explanation.&lt;/P&gt;&lt;P&gt;But when is selected dual conversion ADC0 is converted and then ADC1. The ADC0 result is stored first in FIFO and ADC1 as second.&lt;/P&gt;&lt;P&gt;So If you read the FIFO you will read first ADC1 and then ADC0.&lt;/P&gt;&lt;P&gt;Peter&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 Dec 2016 10:26:52 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MPC5xxx/dual-conversion-ADC-channel-order-question/m-p/650061#M6773</guid>
      <dc:creator>petervlna</dc:creator>
      <dc:date>2016-12-30T10:26:52Z</dc:date>
    </item>
    <item>
      <title>Re: dual conversion, ADC channel order question</title>
      <link>https://community.nxp.com/t5/MPC5xxx/dual-conversion-ADC-channel-order-question/m-p/650062#M6774</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Peter, sorry if it was too long.&lt;/P&gt;&lt;P&gt;I was trying to be complete, but I guess I didn't do a good job explaining the question.&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;I appreciate the help and the feedback.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regarding &lt;SPAN style="color: #ff0000;"&gt;a)&lt;/SPAN&gt;&amp;nbsp;&amp;nbsp; Your comment says "ADC0 result is stored first"; "ADC1 as second"; "read first ADC1 and then ADC0".&lt;/P&gt;&lt;P&gt;Your response seems to imply that while the ADC0 conversion completes first, it's written to the 2nd address of the FIFO [1], and ADC1 conversion finishes second, but written to the 1st address of the FIFO [0].&amp;nbsp; &lt;EM&gt;{ I'm not looking at the FIFO memory address, I'm looking at an array written to by the DMA transfer process, but it appears to process them in order.}&lt;/EM&gt; &amp;nbsp; The behavior seems&amp;nbsp; odd,&amp;nbsp; as secion 25.4.2 of the reference manual indicates that &lt;SPAN style="color: #ff0000;"&gt;"&lt;/SPAN&gt;ADC unit 0 has the priority, otherwise the first ADC that ends its conversion will write as first in the FIFO&lt;SPAN style="color: #ff0000;"&gt;"&lt;/SPAN&gt;.&amp;nbsp; And since ADC0 is faster than ADC1, I would have expected ADC0 to be written first (index [0] in the array). &amp;nbsp; I guess it is a &lt;SPAN style="text-decoration: underline;"&gt;skewed FIFO&lt;/SPAN&gt;, First In, Second Out? &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; If that's the behavior, then okay, I just wanted to confirm it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regarding &lt;SPAN style="color: #ff0000;"&gt;b)&amp;nbsp;&lt;SPAN style="color: #000000;"&gt; th&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000;"&gt;e&lt;/SPAN&gt; Analog Unit Number, you didn't comment on this.&amp;nbsp; I showed in the screenshot for ADC_result[0] = 0x503fe, the Analog Unit Number is reported as &lt;SPAN style="color: #ff0000;"&gt;zero&lt;/SPAN&gt;, with the channel number as five, and a value of 0x3FE:&amp;nbsp; 00-&lt;SPAN style="color: #ff0000;"&gt;0&lt;/SPAN&gt;5-03-fe&lt;SPAN style="color: #000000;"&gt;.&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;I know that this is ADC1, ch5, as it is the Potentiometer on the TRK-MPC5604P board, connected to Port: PE0&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;So I guess in this case&lt;SPAN style="text-decoration: underline;"&gt; zero means ADC1&lt;/SPAN&gt; and &lt;SPAN style="text-decoration: underline;"&gt;one means ADC0&lt;/SPAN&gt;, which seems odd, but since it isn't specified in the reference manual, I guess it is okay, but I just want to confirm it.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;I just trying to confirm that the behavior is valid and that I've not configured the device improperly.&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;What I really want to confirm&amp;nbsp; is that ADC0 is faster than ADC1 in terms of conversion, as this result does not seem to confirm that.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;Thanks again for the feedback.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 Dec 2016 15:38:45 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MPC5xxx/dual-conversion-ADC-channel-order-question/m-p/650062#M6774</guid>
      <dc:creator>duanemattern</dc:creator>
      <dc:date>2016-12-30T15:38:45Z</dc:date>
    </item>
  </channel>
</rss>

