Other Parts Discussed in Thread: SYSCONFIG, , LM4040
Tool/software:
Similar to other threads, i'm only getting 0x0000 returned.
I've set the powerdown mode to manual and lengthened the sampling period.
SYSCFG_DL_init();
NVIC_EnableIRQ(ADC12_0_INST_INT_IRQN);
NVIC_EnableIRQ(ADC12_1_INST_INT_IRQN);
forever(
DL_ADC12_enableConversions(ADC12_1_INST); //??? is this needed a 2nd time after each conversion? wasn't getting a 2nd conversion so added
DL_ADC12_startConversion(ADC12_1_INST);
gStateAdc[1] = adcBusy;
while(gStateAdc[1]!=adcComplete) <wait>
//should not be able to get to this point until after interrupt: DL_ADC12_IIDX_MEM4_RESULT_LOADED
for(uint16_t delay=0;delay<0xF000;delay++) __NOP(); //this is debug code since Janz Bai questioned if there was enough time passed to get any values.
gRegSpace[REG_AdcAmp0] = DL_ADC12_getMemResult(ADC12_1_INST, DL_ADC12_MEM_IDX_0);
gRegSpace[REG_AdcAmp1] = DL_ADC12_getMemResult(ADC12_1_INST, DL_ADC12_MEM_IDX_1);
gRegSpace[REG_AdcAmp2] = DL_ADC12_getMemResult(ADC12_1_INST, DL_ADC12_MEM_IDX_2);
gRegSpace[REG_AdcAmp3] = DL_ADC12_getMemResult(ADC12_1_INST, DL_ADC12_MEM_IDX_3);
gRegSpace[REG_Adc48v ] = DL_ADC12_getMemResult(ADC12_1_INST, DL_ADC12_MEM_IDX_4);
<wait for 100ms timer>
)
void ADC12_1_INST_IRQHandler(void)
{
DL_ADC12_IIDX pendingInterrupt = DL_ADC12_getPendingInterrupt(ADC12_1_INST);
switch (pendingInterrupt) {
case DL_ADC12_IIDX_MEM4_RESULT_LOADED:
//DL_ADC12_stopConversion(ADC12_1_INST);
//DL_ADC12_disableConversions(ADC12_1_INST);
gStateAdc[1] = adcComplete; //change state after stopping conversion
break;
}
I do get interrupts, but every conversion including the first one is value 0x0000