<?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 Trigger ADC via PDB in 8-bit Microcontrollers</title>
    <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Trigger-ADC-via-PDB/m-p/316384#M20815</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am not able to get this right.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have an 8KHz FTM2 Edge-Aligned PWM and i need to trigger a ADC channel to read a value.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The count for the FTM2 MOD is 250.&lt;/P&gt;&lt;P&gt;I set the PDB1 as such&lt;/P&gt;&lt;PRE class="plain" name="code"&gt;void PDB1_init() { PDB1CTRL1 = 0xB0; PDB1CTRL2 = 5 ; //Trig 5 by FTM2 //PDB1CTRL2_PRESCALER = 5 ; //5=div by 32 so 32MHz/32 = 1MHz = half of FTM2 PDB1DLYB&amp;nbsp; = FTM2_OVERFLOW/4;//FTM2_OVERFLOW = 250 PDB1SCR = 0xC0;//view on pin PDB1SCR_PDBEN = 1; PDB1CTRL1_LDOK = 1; } &lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I set ADC to trigger from this trigger&lt;/P&gt;&lt;PRE class="plain" name="code"&gt;ADCSC2 = ADCSC2_ADTRG_MASK; &lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the FTM2 overflow ISR&lt;/P&gt;&lt;PRE class="plain" name="code"&gt;.//some code . ADCSC1_ADCH = 11 ; SetVoltage = ADCR ;&amp;nbsp; //read value in a variable . .//other code &lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now i do get the value read.&lt;/P&gt;&lt;P&gt;I want to see whether it is synced to FTM2 , for which i have enabled the PDB1 output pin.&lt;/P&gt;&lt;P&gt;But i am not able to see a train of pulses on this pin, with reference to FTM2 PWM pulses.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Am i doing something wrong??&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please help..tried too many things..maybe i am doing a very fundamental mistake&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 07 Jul 2014 07:00:06 GMT</pubDate>
    <dc:creator>abicash</dc:creator>
    <dc:date>2014-07-07T07:00:06Z</dc:date>
    <item>
      <title>Trigger ADC via PDB</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Trigger-ADC-via-PDB/m-p/316384#M20815</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am not able to get this right.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have an 8KHz FTM2 Edge-Aligned PWM and i need to trigger a ADC channel to read a value.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The count for the FTM2 MOD is 250.&lt;/P&gt;&lt;P&gt;I set the PDB1 as such&lt;/P&gt;&lt;PRE class="plain" name="code"&gt;void PDB1_init() { PDB1CTRL1 = 0xB0; PDB1CTRL2 = 5 ; //Trig 5 by FTM2 //PDB1CTRL2_PRESCALER = 5 ; //5=div by 32 so 32MHz/32 = 1MHz = half of FTM2 PDB1DLYB&amp;nbsp; = FTM2_OVERFLOW/4;//FTM2_OVERFLOW = 250 PDB1SCR = 0xC0;//view on pin PDB1SCR_PDBEN = 1; PDB1CTRL1_LDOK = 1; } &lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I set ADC to trigger from this trigger&lt;/P&gt;&lt;PRE class="plain" name="code"&gt;ADCSC2 = ADCSC2_ADTRG_MASK; &lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the FTM2 overflow ISR&lt;/P&gt;&lt;PRE class="plain" name="code"&gt;.//some code . ADCSC1_ADCH = 11 ; SetVoltage = ADCR ;&amp;nbsp; //read value in a variable . .//other code &lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now i do get the value read.&lt;/P&gt;&lt;P&gt;I want to see whether it is synced to FTM2 , for which i have enabled the PDB1 output pin.&lt;/P&gt;&lt;P&gt;But i am not able to see a train of pulses on this pin, with reference to FTM2 PWM pulses.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Am i doing something wrong??&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please help..tried too many things..maybe i am doing a very fundamental mistake&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 07 Jul 2014 07:00:06 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Trigger-ADC-via-PDB/m-p/316384#M20815</guid>
      <dc:creator>abicash</dc:creator>
      <dc:date>2014-07-07T07:00:06Z</dc:date>
    </item>
    <item>
      <title>Re: Trigger ADC via PDB</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Trigger-ADC-via-PDB/m-p/316385#M20816</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Abhijit,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PDB generally does not have a output pin associated. Can you please tell which device you are working on so that we can cross verify.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Meanwhile to check the syncing, you can enable ADC ISR and toggle a GPIO in it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note: In case you find the answer helpful/correct, please mark the same.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Ankur&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 07 Jul 2014 11:18:16 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Trigger-ADC-via-PDB/m-p/316385#M20816</guid>
      <dc:creator>ankur_kala</dc:creator>
      <dc:date>2014-07-07T11:18:16Z</dc:date>
    </item>
  </channel>
</rss>

