Analog input multiplexing on the ADuCM360

I am trying to continuously sample data from three sources with the ADuCM360. ADC1 is configured to read differential pair AIN1/AIN0 at 60sps (SF=125,AF=0). I want ADC0 to use the same filter settings but alternately sample between AIN3/2 and AIN5/4 pairs. I am using the simultaneous sampling mode by setting ADCCFG[15]=1 which seems to work until I change the ADC0 mux configuration.

To cycle between the two input sources I update pADI_ADC1->CON during the ADC interrupt handler.

void ADC1_Int_Handler() {
    adc0_data = AdcRd(pADI_ADC0);            // read ADC result register
	adc1_data = AdcRd(pADI_ADC1);            // read ADC result register
	
	bSendResultToUART = 1;  // Set flag to indicate ready to send result to UART
	
	if(bADC_mux_state = 0) {
	    con = pADI_ADC1->CON & 0xFFFF00;
	    con |= 0x0000A4; // Change mux to ADC5/4
	    pADI_ADC1->CON = con;
	    bADC_mux_state = 1;
	} else {
		con = pADI_ADC1->CON & 0xFFFF00;
	    con |= 0x000062; // Change mux to ADC3/2
	    pADI_ADC1->CON = con;
	    bADC_mux_state = 0;
	}
}

However, whenever I change the state of pADI_ADC1->CON the simultaneous acquisition stops. How do I cycle between input mux settings on alternate cycles?

Thanks,

Mike

  • +1
    •  Analog Employees 
    on Jun 25, 2019 3:29 AM over 1 year ago

    Hi Mike,

    Any change of the ADC configuration will stop the corresponding ADC. Or you need to make the ADC into the Idle mode, then you can reconfigure the ADC.

    So you must stop the simultaneous mode, then you can change the ADC0 channel, and then reconfigure the ADC0 and ADC1 in simultaneous mode.

    Regards,

    Barry

  • Hi Barry,

    I guess I understand that simultaneous sampling mode will be disrupted if I change the ADC1->CON register. If I am not using simultaneous mode doesn't the CON register control both the mux and the ADC mode, so do I need to switch to idle before changing the mux or can I just switch the mux bits and leave the ADC in continuous sampling mode? Is switching the mux this way fast enough to get a reliable stream of samples at 60sps (30sps per mux state as I am scanning) or will I have trouble with settling time and a reduction in ENOB?

    Also, are the ADC DATA regististers buffered so that if ADC1 and ADC0 are both set to 60sps I can let them run asynchronously but still read them out at the same time using either the ADC0 or ADC1 interrupt?

    Thanks,

    Mike

  • +1
    •  Analog Employees 
    on Jun 26, 2019 3:21 AM over 1 year ago in reply to MikeH64

    Hi Mike,

    There are two different Control registers for each ADC. You need to configure the ADC into Idle mode before you re-configure the ADC, even mux or PGA or filter configuration, whatever any mode, single, continuous or simultaneous mode.

    If you only reconfigure the ADC1 register, you just need to configure ADC1 into idle mode. The ADC0 can work continuously in non-simultaneous mode. 

    After you reconfigure the ADC registers, and make ADC to work again, supposing continuous mode, be sure to consider the filter settling time for the first ready data. It means once you start a new conversion, the first data will be ready with a longer time. For example, 50Hz update rate with SInc3 filter. At time 0, the ADC start working, the data will be available at time ~60ms(3*time), 80ms, 100ms... 

    Regards,

    Barry

  • Is the Sinc3 setting time built into the HW? If I set the ADC for a single acquisition (or even continuous) will the ADC interrupt for the first sample be appropriately delayed to account for the 3*time setting? Or do I need to consciously throw out the first two samples?

    It sounds like my best bet for multiplexing is to run the ADC in single shot mode and then use the ISR to buffer the data, change mux, start a new acquisition. I can then run the other channel in continuous mode and not have to worry about the difference in sample rates from all the starting and stopping.

  • +1
    •  Analog Employees 
    on Jun 28, 2019 10:10 AM over 1 year ago in reply to MikeH64

    Yes, the Sinc3 filter is hardware realization and built into the part. Even in single mode, the ready data will be available after ~3*times. You don't need to throw out he first two samples.

    I agree with your thoughts.