<?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: MCXA153 Multiple ADC interrupt in MCX Microcontrollers</title>
    <link>https://community.nxp.com/t5/MCX-Microcontrollers/MCXA153-Multiple-ADC-interrupt/m-p/1977759#M1804</link>
    <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/193268"&gt;@MichaelBMiner&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Yes, the MCXA153 only has 4 triggers. We can configure the next command to be executed after one command completes using the "Next Command Select" feature in CMD. We recommend using the Configure tool inside MCUXpresso IDE to set this up. It can generate the code automatically.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Alice_Yang_0-1729489669978.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/305732iCABE2210CA5BF6B7/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Alice_Yang_0-1729489669978.png" alt="Alice_Yang_0-1729489669978.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;BR&lt;/P&gt;
&lt;P&gt;Alice&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 21 Oct 2024 05:48:24 GMT</pubDate>
    <dc:creator>Alice_Yang</dc:creator>
    <dc:date>2024-10-21T05:48:24Z</dc:date>
    <item>
      <title>MCXA153 Multiple ADC interrupt</title>
      <link>https://community.nxp.com/t5/MCX-Microcontrollers/MCXA153-Multiple-ADC-interrupt/m-p/1975440#M1784</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I am using the MCXA153 chip for a project and I have 5 ADC inputs. I do not have hardware yet and I want a sanity check on my code.&amp;nbsp;&lt;/P&gt;&lt;P&gt;My main issue is I do not fully understand&amp;nbsp;lpadcCommandConfig.chainedNextCommandNumber and&amp;nbsp;lpadcTriggerConfig.targetCommandId.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So for my code I have an ADC struct that contains gpio info and a windowed averaging struct.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;typedef enum {
	SPARE_ADC,
	VBATT_ADC,
	CURRENT_ADC,
	BATT_TEMP_ADC,
	SIGN_TEMP_ADC,

	NUM_ADCS
}ADCS;

struct adc_gpio_data {
	GPIO_Type *gpio;
	PORT_Type *port;
	uint32_t pin;
	uint32_t adc_channel;
};

struct adc {
	struct adc_gpio_data adc_gpio;
	struct windowed_average_t average;
};&lt;/LI-CODE&gt;&lt;P&gt;This is my ADC IRQ&lt;/P&gt;&lt;LI-CODE lang="c"&gt;void ADC0_IRQHandler(void) {
    lpadc_conv_result_t convResult;

    if (LPADC_GetConvResult(ADC0, &amp;amp;convResult)) {
        uint32_t conv_trigger = convResult.triggerIdSource;
        if (conv_trigger &amp;lt; NUM_ADCS) {
            uint32_t result = convResult.convValue;
            windowed_average_add(&amp;amp;adcs[conv_trigger].average, result);
        }
    }
}&lt;/LI-CODE&gt;&lt;P&gt;And my init code&lt;/P&gt;&lt;LI-CODE lang="c"&gt;void adc_init(void) {
	lpadc_conv_trigger_config_t lpadcTriggerConfig;
	lpadc_conv_command_config_t lpadcCommandConfig;
	lpadc_config_t lpadcConfig;

	adc_enable_clocks();
	adc_release_peripherals();
	adc_init_gpio();

	adc_init_adc_array();

    lpadcConfig.enableAnalogPreliminary = true;
    lpadcConfig.referenceVoltageSource = kLPADC_ReferenceVoltageAlt3;
    lpadcConfig.conversionAverageMode = kLPADC_ConversionAverage256;

    LPADC_DoResetConfig(ADC0);
    LPADC_Init(ADC0, &amp;amp;lpadcConfig);
    LPADC_DoOffsetCalibration(ADC0);

    LPADC_GetDefaultConvCommandConfig(&amp;amp;lpadcCommandConfig);
    LPADC_GetDefaultConvTriggerConfig(&amp;amp;lpadcTriggerConfig);
    for(uint8_t i=0U; i&amp;lt;NUM_ADCS; i++) {
    	lpadcCommandConfig.channelNumber = adcs[i].adc_gpio.adc_channel;
    	lpadcCommandConfig.conversionResolutionMode = kLPADC_ConversionResolutionStandard;
		lpadcCommandConfig.sampleTimeMode = kLPADC_SampleTimeADCK11;
		lpadcCommandConfig.chainedNextCommandNumber = i+1U;
		LPADC_SetConvCommandConfig(ADC0, i, &amp;amp;lpadcCommandConfig);

		lpadcTriggerConfig.targetCommandId = (i+1U);
		lpadcTriggerConfig.enableHardwareTrigger = false;
		LPADC_SetConvTriggerConfig(ADC0, i, &amp;amp;lpadcTriggerConfig);
    }

    LPADC_EnableInterrupts(ADC0, kLPADC_FIFO0WatermarkInterruptEnable);
	EnableIRQ(ADC0_IRQn);
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Am I properly configuring my ADC channels as interrupt driven, software triggered, and does my IRQ properly determine which channel interrupted?&lt;/P&gt;</description>
      <pubDate>Wed, 16 Oct 2024 19:03:36 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCX-Microcontrollers/MCXA153-Multiple-ADC-interrupt/m-p/1975440#M1784</guid>
      <dc:creator>MichaelBMiner</dc:creator>
      <dc:date>2024-10-16T19:03:36Z</dc:date>
    </item>
    <item>
      <title>Re: MCXA153 Multiple ADC interrupt</title>
      <link>https://community.nxp.com/t5/MCX-Microcontrollers/MCXA153-Multiple-ADC-interrupt/m-p/1975450#M1785</link>
      <description>&lt;P&gt;I have 5 ADC that I want to trigger on. It seems there are only 4 available triggers. I may be changing this to a polling ADC.&lt;/P&gt;</description>
      <pubDate>Wed, 16 Oct 2024 19:28:47 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCX-Microcontrollers/MCXA153-Multiple-ADC-interrupt/m-p/1975450#M1785</guid>
      <dc:creator>MichaelBMiner</dc:creator>
      <dc:date>2024-10-16T19:28:47Z</dc:date>
    </item>
    <item>
      <title>Re: MCXA153 Multiple ADC interrupt</title>
      <link>https://community.nxp.com/t5/MCX-Microcontrollers/MCXA153-Multiple-ADC-interrupt/m-p/1977759#M1804</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/193268"&gt;@MichaelBMiner&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Yes, the MCXA153 only has 4 triggers. We can configure the next command to be executed after one command completes using the "Next Command Select" feature in CMD. We recommend using the Configure tool inside MCUXpresso IDE to set this up. It can generate the code automatically.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Alice_Yang_0-1729489669978.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/305732iCABE2210CA5BF6B7/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Alice_Yang_0-1729489669978.png" alt="Alice_Yang_0-1729489669978.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;BR&lt;/P&gt;
&lt;P&gt;Alice&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 21 Oct 2024 05:48:24 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCX-Microcontrollers/MCXA153-Multiple-ADC-interrupt/m-p/1977759#M1804</guid>
      <dc:creator>Alice_Yang</dc:creator>
      <dc:date>2024-10-21T05:48:24Z</dc:date>
    </item>
  </channel>
</rss>

