AnsweredAssumed Answered

No interrupt at ADC function with PIT0 trigger and Differential conversions

Question asked by Liu KunYen on Jun 27, 2017

Dear Sir

I have a big trouble at ADC0 action.

My project is as below.

IC: MK22FN256VLH12

function description:The NXP Cup Technical Reports

ADC functino(ADC0, channel0) at interrupt mode  with PIT0 trigger and differential conversions

Issue: No interrupt and can't got ADC value.


My code follow is as below.

stage1: setup Uart0          (normal) with polling action

stage2: setup PIT0           (normal) with interrupt

stage3:set ADC0              (fail)

                   Set ADC0 at  SIM_SCGC6

                   Reset " ADC0ALTTRGEN " &   "ADC0PRETRGSEL" at   SIM_SOPT7

                   Set ADC0TRGSEL(4) | ADC0PRETRGSEL(0) | ADC0ALTTRGEN   at    SIM_SOPT7

                   Set config as below at    CFG1 &  CFG2 & SC2 & SC3 and detail is as below

                                       referenceVoltageSource = kADC16_ReferenceVoltageSourceVref;
                                       clockSource = kADC16_ClockSourceAsynchronousClock;
                                       enableAsynchronousClock = true;
                                       clockDivider = kADC16_ClockDivider8;
                                       resolution = kADC16_ResolutionSE12Bit;
                                       longSampleMode = kADC16_LongSampleDisabled;
                                       enableHighSpeed = false;
                                       enableLowPower = false;
                                       enableContinuousConversion = false;

                   Do caliberation

                   Set hardware  SC2_ADTRG

                   Set DIFF , AIEN  at SC1

                    Enable interrupt at  NVIC_EnableIRQ(ADC0_IRQn)

                    Do while(1) to wait ADC interrupt, if the interrupt is gotten, then set DIFF , AIEN  at SC1 again.

I ever disable hardware trigger, but it's invalie and condtion is the same(no interrupt)@@@@@@@#@@@@@@@@

Could some one could cover this issue?

Thanks your reading.