<?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: ADC Hardware Trigger in S32K</title>
    <link>https://community.nxp.com/t5/S32K/ADC-Hardware-Trigger/m-p/1508019#M17173</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/52961"&gt;@PetrS&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Yes. I am planning to do the same . But my question was related to VDD pin. Do i need to interface it the same way i will interface the PTC1&lt;/P&gt;&lt;P&gt;Like, do i need to enable clock or something.&lt;/P&gt;</description>
    <pubDate>Thu, 18 Aug 2022 06:52:55 GMT</pubDate>
    <dc:creator>akhilranga</dc:creator>
    <dc:date>2022-08-18T06:52:55Z</dc:date>
    <item>
      <title>ADC Hardware Trigger</title>
      <link>https://community.nxp.com/t5/S32K/ADC-Hardware-Trigger/m-p/1506725#M17128</link>
      <description>&lt;P&gt;Hello Community.&lt;/P&gt;&lt;P&gt;The below is the example code for ADC in #S32k144#, In that&amp;nbsp; &amp;nbsp;"convertAdcChan(12);" this command is used to convert AD12 to potentiometer on EVB. i am trying to convert that to an external Temperature sesnor LM35 instead of onboard Potentiometer. so i am asuming i can use one ADC function pin such as PTC1 , PTC2 use as data pin for LM35 . But how can i interface that with this code. Like the potentiometer pin is PTC14. But i dont see anywhere it being called or defined in this code. But how did Potentiometer got activated.&lt;/P&gt;&lt;P&gt;My understanding is if i replace on board potentiometer with LM35 things should work.&lt;/P&gt;&lt;P&gt;Help required for : how can i interface my LM35 with 3 pins (VCC, DATA, GND) by leveraging this code.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;Please let me know if i am wrong and help me out.&lt;/P&gt;&lt;LI-CODE lang="c"&gt;#include "S32K144.h" /* include peripheral declarations S32K144 */
#include "clocks_and_modes.h"
#include "ADC.h"
#define PTD15 15 /* RED LED*/
#define PTD16 16 /* GREEN LED*/
#define PTD0 0   /* BLUE LED */

void PORT_init (void) {
  PCC-&amp;gt;PCCn[PCC_PORTD_INDEX ]|=PCC_PCCn_CGC_MASK;   /* Enable clock for PORTD */
  PORTD-&amp;gt;PCR[PTD0]  =  0x00000100;  /* Port D0: MUX = GPIO */
  PORTD-&amp;gt;PCR[PTD15] =  0x00000100;  /* Port D15: MUX = GPIO */
  PORTD-&amp;gt;PCR[PTD16] =  0x00000100;  /* Port D16: MUX = GPIO */

  PTD-&amp;gt;PDDR |= 1&amp;lt;&amp;lt;PTD0;       	  /* Port D0:  Data Direction= output */
  PTD-&amp;gt;PDDR |= 1&amp;lt;&amp;lt;PTD15;          /* Port D15: Data Direction= output */
  PTD-&amp;gt;PDDR |= 1&amp;lt;&amp;lt;PTD16;          /* Port D16: Data Direction= output */
}

void WDOG_disable (void){
  WDOG-&amp;gt;CNT=0xD928C520;     /* Unlock watchdog */
  WDOG-&amp;gt;TOVAL=0x0000FFFF;   /* Maximum timeout value */
  WDOG-&amp;gt;CS = 0x00002100;    /* Disable watchdog */
}

int main(void)
{
  uint32_t adcResultInMv=0;

  WDOG_disable();        /* Disable WDOG*/
  SOSC_init_8MHz();      /* Initialize system oscillator for 8 MHz xtal */
  SPLL_init_160MHz();    /* Initialize SPLL to 160 MHz with 8 MHz SOSC */
  NormalRUNmode_80MHz(); /* Init clocks: 80 MHz sysclk &amp;amp; core, 40 MHz bus, 20 MHz flash */
  PORT_init();		     /* Init  port clocks and gpio outputs */
  ADC_init();            /* Init ADC resolution 12 bit*/

  for(;;) {
    convertAdcChan(12);                   /* Convert Channel AD12 to pot on EVB */
    while(adc_complete()==0){}            /* Wait for conversion complete flag */
    adcResultInMv = read_adc_chx();       /* Get channel's conversion results in mv */

    if (adcResultInMv &amp;gt; 3750) {           /* If result &amp;gt; 3.75V */
      PTD-&amp;gt;PSOR |= 1&amp;lt;&amp;lt;PTD0 | 1&amp;lt;&amp;lt;PTD16;    /* turn off blue, green LEDs */
      PTD-&amp;gt;PCOR |= 1&amp;lt;&amp;lt;PTD15;              /* turn on red LED */
    }
    else if (adcResultInMv &amp;gt; 2500) {      /* If result &amp;gt; 2.5V */
      PTD-&amp;gt;PSOR |= 1&amp;lt;&amp;lt;PTD0 | 1&amp;lt;&amp;lt;PTD15;    /* turn off blue, red LEDs */
      PTD-&amp;gt;PCOR |= 1&amp;lt;&amp;lt;PTD16;     	      /* turn on green LED */
    }
    else if (adcResultInMv &amp;gt;1250) {       /* If result &amp;gt; 1.25V */
      PTD-&amp;gt;PSOR |= 1&amp;lt;&amp;lt;PTD15 | 1&amp;lt;&amp;lt;PTD16;   /* turn off red, green LEDs */
      PTD-&amp;gt;PCOR |= 1&amp;lt;&amp;lt;PTD0;     	      /* turn on blue LED */
    }
    else {
      PTD-&amp;gt;PSOR |= 1&amp;lt;&amp;lt;PTD0 | 1&amp;lt;&amp;lt; PTD15 | 1&amp;lt;&amp;lt;PTD16; /* Turn off all LEDs */
    }

    convertAdcChan(29);                   /* Convert chan 29, Vrefsh */
    while(adc_complete()==0){}            /* Wait for conversion complete flag */
    adcResultInMv = read_adc_chx();       /* Get channel's conversion results in mv */
  }
}&lt;/LI-CODE&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Tue, 16 Aug 2022 09:31:46 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/ADC-Hardware-Trigger/m-p/1506725#M17128</guid>
      <dc:creator>akhilranga</dc:creator>
      <dc:date>2022-08-16T09:31:46Z</dc:date>
    </item>
    <item>
      <title>Re: ADC Hardware Trigger</title>
      <link>https://community.nxp.com/t5/S32K/ADC-Hardware-Trigger/m-p/1506824#M17131</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;if you connect DATA pin of sensor to e.g PTC1 then you need to convert external channel 9 on the ADC&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="PetrS_0-1660653724123.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/190350i756E985690124721/image-size/medium?v=v2&amp;amp;px=400" role="button" title="PetrS_0-1660653724123.png" alt="PetrS_0-1660653724123.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;So within this code it should be enough to use&lt;/P&gt;
&lt;P&gt;convertAdcChan(9); /* Convert Channel AD9, PTC1 on EVB */&lt;/P&gt;
&lt;P&gt;BR, Petr&lt;/P&gt;</description>
      <pubDate>Tue, 16 Aug 2022 12:46:38 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/ADC-Hardware-Trigger/m-p/1506824#M17131</guid>
      <dc:creator>PetrS</dc:creator>
      <dc:date>2022-08-16T12:46:38Z</dc:date>
    </item>
    <item>
      <title>Re: ADC Hardware Trigger</title>
      <link>https://community.nxp.com/t5/S32K/ADC-Hardware-Trigger/m-p/1507257#M17146</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/52961"&gt;@PetrS&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for the help i got it. I was missing that link between ADC channel and port pins. Thanks again for the help.&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Now i just wanted to understand one last thing. I am trying to input 5v input to the sesnor. So, how can i do that. I noticed VDD pins but plese let me know how i can initiate that with this code. I am assuming inorder to access the VDD pins as 5v Power supply, i need to enable clocks and initiate the pins.&amp;nbsp;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;P.S : i just statrted exploring this S32k144 . Excuse my naivety.&amp;nbsp;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Thanks for the help&amp;nbsp;&lt;/EM&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 17 Aug 2022 06:50:39 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/ADC-Hardware-Trigger/m-p/1507257#M17146</guid>
      <dc:creator>akhilranga</dc:creator>
      <dc:date>2022-08-17T06:50:39Z</dc:date>
    </item>
    <item>
      <title>Re: ADC Hardware Trigger</title>
      <link>https://community.nxp.com/t5/S32K/ADC-Hardware-Trigger/m-p/1507507#M17161</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;not sure what you meant. If sensor has 3 wires (VCC, DATA, GND) connect DATA to PTC1 and VCC/GND to VDD/GND, see EVB schematic,&amp;nbsp;VDD/GND and PTC1 are on J5 header.&lt;/P&gt;
&lt;P&gt;BR, Petr&lt;/P&gt;</description>
      <pubDate>Wed, 17 Aug 2022 12:30:01 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/ADC-Hardware-Trigger/m-p/1507507#M17161</guid>
      <dc:creator>PetrS</dc:creator>
      <dc:date>2022-08-17T12:30:01Z</dc:date>
    </item>
    <item>
      <title>Re: ADC Hardware Trigger</title>
      <link>https://community.nxp.com/t5/S32K/ADC-Hardware-Trigger/m-p/1508019#M17173</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/52961"&gt;@PetrS&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Yes. I am planning to do the same . But my question was related to VDD pin. Do i need to interface it the same way i will interface the PTC1&lt;/P&gt;&lt;P&gt;Like, do i need to enable clock or something.&lt;/P&gt;</description>
      <pubDate>Thu, 18 Aug 2022 06:52:55 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/ADC-Hardware-Trigger/m-p/1508019#M17173</guid>
      <dc:creator>akhilranga</dc:creator>
      <dc:date>2022-08-18T06:52:55Z</dc:date>
    </item>
    <item>
      <title>Re: ADC Hardware Trigger</title>
      <link>https://community.nxp.com/t5/S32K/ADC-Hardware-Trigger/m-p/1509272#M17215</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;VDD is just power pin, no setting is for that, you need to connect external voltage to VDD to power the MCU.&lt;/P&gt;
&lt;P&gt;BR, Petr&lt;/P&gt;</description>
      <pubDate>Mon, 22 Aug 2022 07:09:56 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/ADC-Hardware-Trigger/m-p/1509272#M17215</guid>
      <dc:creator>PetrS</dc:creator>
      <dc:date>2022-08-22T07:09:56Z</dc:date>
    </item>
    <item>
      <title>Re: ADC Hardware Trigger</title>
      <link>https://community.nxp.com/t5/S32K/ADC-Hardware-Trigger/m-p/1509525#M17239</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/52961"&gt;@PetrS&lt;/a&gt;&amp;nbsp;.&lt;/P&gt;&lt;P&gt;Thanks for the asssist. Got that thing figured out.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 22 Aug 2022 12:06:26 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/ADC-Hardware-Trigger/m-p/1509525#M17239</guid>
      <dc:creator>akhilranga</dc:creator>
      <dc:date>2022-08-22T12:06:26Z</dc:date>
    </item>
  </channel>
</rss>

