ADC interrupt configuration in twrk60d100m with KSDK

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

ADC interrupt configuration in twrk60d100m with KSDK

289 Views
josecaballero
Contributor I

Hi, i am trying to use the ADC with the potentiometer that comes in the board, using the end of conversion interrupt but it does not go to the interrupt routine, this is the configuration i am using:

#define ADC16_INSTANCE (1) 
#define ADC16_POTENTIOMETER_CHN (kAdc16Chn20) 
#define ADC16_CHN_GROUP (0) 

//ADC configuration

ADC16_DRV_StructInitUserConfigDefault(&adcUserConfig);
adcUserConfig.hwTriggerEnable = false;
adcUserConfig.continuousConvEnable = false;
ADC16_DRV_Init(ADC16_INSTANCE, &adcUserConfig);
adcChnConfig.chnIdx = (adc16_chn_t)ADC16_POTENTIOMETER_CHN;
#if FSL_FEATURE_ADC16_HAS_DIFF_MODE
adcChnConfig.diffConvEnable = false;
#endif /* FSL_FEATURE_ADC16_HAS_DIFF_MODE */
adcChnConfig.convCompletedIntEnable = true;

then i use the software trigger mode

 ADC16_DRV_ConfigConvChn(ADC16_INSTANCE, ADC16_CHN_GROUP, &adcChnConfig);

and then i am just waiting in the adc interruption subroutine to turn on a led only(the LED is only to make sure the interruption is working) but never turns on so it's not working the interruption

void ADC1_IRQHandler(void)
{
      GPIO_DRV_ClearPinOutput(kGpioLED2);

}

if i turn on the LED in the main program it turns on so the led is working, could anyone please help me if i should do something else or am i doing anything wrong? Thank you

0 Kudos
1 Reply

230 Views
jorge_a_vazquez
NXP Employee
NXP Employee

Hi Jose Caballero

First of all, I saw that you are using SDK 1.3, highly recommend you to use the latest version of SDK, you can download it in the link:

Welcome to MCUXpresso | MCUXpresso Config Tools 

Now, About your issue, are you using an example code? I didn't see your hardware initialization. When you debug, did you see that you are blocking in some code?

I tested the SDK 2.2 driver example code (with the change of ADC1 and channel modifications) and I can see changes in the ADC output.

Best Regards

Jorge Alcala

0 Kudos