ADALM1000 pysmu 200 kS/s using set_adc_mux() function

A college and I use a larger number of ADALM1000 (Rev. D and F) for distance learning. These are used in take home practicals in the subject electrical engineering, measurement technology and sensor technology (... and soon hopefully also in the subject electronics).
We have had very good experiences with the ADALM1000 so far. Since we teach many younger semesters with it, I have greatly simplified the AliceDesktop software and added German tooltips to make it easier for these students to use the M1K. See github.com/StefanMack/M1K.

For some lab experiments (e.g. ultrasound) I use the 200 kS/s sampling rate. This works fine for the combinations CA-V + CA-I, CB-V + CB-I, CA-V + CB-V and CA-I + CB-I.
In teh libsmu C-library code device_m1000.cpp the combination CA-V + CB-I or CB-V + CA-I is not provided at all:

int M1000_Device::set_adc_mux(unsigned adc_mux){
	if(adc_mux > 7)
		return -1;
	::ADC_MUX_Mode = adc_mux; // set global variable
	
	if(adc_mux == 0) { // Change ADC MUX to 4 signal measure
		ctrl_transfer(0x40, 0x20, 0x20F1, 0, 0, 0, 100);
		ctrl_transfer(0x40, 0x21, 0x20F7, 0, 0, 0, 100);
		ctrl_transfer(0x40, 0x22, 0x20F7, 0, 0, 0, 100);
		ctrl_transfer(0x40, 0x23, 0x20F1, 0, 0, 0, 100);
	}
	if(adc_mux == 1) { // Change ADC MUX to 2 voltage measure
		ctrl_transfer(0x40, 0x20, 0x20F1, 0, 0, 0, 100);
		ctrl_transfer(0x40, 0x21, 0x20F1, 0, 0, 0, 100);
		ctrl_transfer(0x40, 0x22, 0x20F1, 0, 0, 0, 100);
		ctrl_transfer(0x40, 0x23, 0x20F1, 0, 0, 0, 100);
	}
	if(adc_mux == 2) { // Change ADC MUX to 2 current measure
		ctrl_transfer(0x40, 0x20, 0x2071, 0, 0, 0, 100); // ADC U12
		ctrl_transfer(0x40, 0x21, 0x20F7, 0, 0, 0, 100); // ADC U11
		ctrl_transfer(0x40, 0x22, 0x20F7, 0, 0, 0, 100); // ADC U12
		ctrl_transfer(0x40, 0x23, 0x2071, 0, 0, 0, 100); // ADC U11
	}
	if(adc_mux == 4) { // change ADC MUX to CHA Voltage and Current
		ctrl_transfer(0x40, 0x20, 0x2071, 0, 0, 0, 100); // ADC U12
		ctrl_transfer(0x40, 0x21, 0x20F7, 0, 0, 0, 100); // ADC U11
		ctrl_transfer(0x40, 0x22, 0x20F7, 0, 0, 0, 100); // ADC U12
		ctrl_transfer(0x40, 0x23, 0x2071, 0, 0, 0, 100); // ADC U11
		ctrl_transfer(0x40, 0x20, 0x20F1, 0, 0, 0, 100); // ADC U12, 0x20F1, 0x21F1
		ctrl_transfer(0x40, 0x21, 0x20F1, 0, 0, 0, 100); // ADC U12, 0x20F1, 0x21F1
    	ctrl_transfer(0x40, 0x22, 0x2071, 0, 0, 0, 100); // ADC U11, 0x2171, 0x2071
		ctrl_transfer(0x40, 0x23, 0x2071, 0, 0, 0, 100); // ADC U11, 0x2171, 0x2071
	}
	if(adc_mux == 5) { // change ADC MUX to CHB Voltage and Current
		ctrl_transfer(0x40, 0x20, 0x2071, 0, 0, 0, 100); // ADC U12
		ctrl_transfer(0x40, 0x21, 0x20F7, 0, 0, 0, 100); // ADC U11
		ctrl_transfer(0x40, 0x22, 0x20F7, 0, 0, 0, 100); // ADC U12
		ctrl_transfer(0x40, 0x23, 0x2071, 0, 0, 0, 100); // ADC U11
		ctrl_transfer(0x40, 0x20, 0x2071, 0, 0, 0, 100); // ADC U12, 0x2071, 0x2171
		ctrl_transfer(0x40, 0x21, 0x2071, 0, 0, 0, 100); // ADC U12, 0x2071, 0x2171
        ctrl_transfer(0x40, 0x22, 0x20F1, 0, 0, 0, 100); // ADC U11, 0x21F1, 0x20F1
		ctrl_transfer(0x40, 0x23, 0x20F1, 0, 0, 0, 100); // ADC U11, 0x21F1, 0x20F1
	}

	return 0;
}

The python code of aliceDesktop 1.3 however uses the function call set_adc_mux(7) for the combination CA-V + CB-I or CB-V + CA-I:

        elif cf.ADC_Mux_Mode == 2: # CA-V and CB-I
            cf.devx.set_adc_mux(2)
            cf.devx.set_adc_mux(7)
            cf.devx.ctrl_transfer(0x40, 0x20, v1_adc_conf, 0, 0, 0, 100) # U12
            cf.devx.ctrl_transfer(0x40, 0x21, i1_adc_conf, 0, 0, 0, 100) # U12
            cf.devx.ctrl_transfer(0x40, 0x22, v2_adc_conf, 0, 0, 0, 100) # U11
            cf.devx.ctrl_transfer(0x40, 0x22, i2_adc_conf, 0, 0, 0, 100) # U11

        elif cf.ADC_Mux_Mode == 3: # CB-V and CA-I
            cf.devx.set_adc_mux(7)
            cf.devx.ctrl_transfer(0x40, 0x20, v1_adc_conf, 0, 0, 0, 100) # U12
            cf.devx.ctrl_transfer(0x40, 0x21, i1_adc_conf, 0, 0, 0, 100) # U12
            cf.devx.ctrl_transfer(0x40, 0x22, v2_adc_conf, 0, 0, 0, 100) # U11
            cf.devx.ctrl_transfer(0x40, 0x22, i2_adc_conf, 0, 0, 0, 100) # U11

But sampling CA-V + CB-I (or CB-V + CA-I) with 200 kS/s does not work with our M1Ks using pysmu.

The command set_adc_mux(7) has no effect in device_m1000.cpp. I.e. only the 4 ctrl_transfer() functions probably cause the desired multiplexing of the ADC.

Is there any documentation for this so I can debug my code?
Does the 200 kS/s sampling of CAV + CBI or CBV + CAI work at all?

Thanks for your help. Have a nice Christmas and a good start into the new year.

  • 0
    •  Analog Employees 
    on Dec 27, 2020 1:20 AM 2 months ago

    On the surface looking at the hardware schematic and the datasheet for the ADC which includes a built in 4 way input Multiplexer, one might expect at all combinations are possible. As you have determined the CA voltage and CB current as well as the CB voltage and CA current combination is not possible. This is a complex thing to explain in detail but it is due to the automatic sequencer that steps through the ADC Mux channels. The order in which the current and voltage signals are wired to the Mux inputs does not allow the hardware to be configured to support the a fore mentioned combinations. It is felt that the 4 supported measurement combinations are the most useful and the other combinations that are not possible are not show stoppers.

    The ALICE code still includes all combinations from the original testing that was done but can not be accessed in the GUI.

    Doug