From: Dan White Date: Mon, 7 May 2012 18:34:49 +0000 (-0500) Subject: ADC loopback testing X-Git-Tag: calibrations~85 X-Git-Url: http://git.whiteaudio.com/gitweb/?a=commitdiff_plain;h=a21f3bbf7aae2ef358a8ba46224e2efb0a289428;p=430.git ADC loopback testing --- diff --git a/python-lib/mpsse-test.py b/python-lib/mpsse-test.py index 308eecd..fd78f9b 100755 --- a/python-lib/mpsse-test.py +++ b/python-lib/mpsse-test.py @@ -144,7 +144,7 @@ for h in chain.h: ota.fast = 1 ota.gain = 8 ota.offset = 0 -#chain.write() +chain.write() mux.selA = 48 mux.selB = 48 @@ -153,7 +153,7 @@ for ota in mux.ota: ota.fast = 1 ota.gain = 8 ota.offset = 0 -#mux.write() +mux.write() # Secondary Chain1 @@ -166,7 +166,7 @@ for h in arb.h: ota.fast = 1 ota.gain = 8 ota.offset = 0 -arb.write() +#arb.write() amux.selA = 48 amux.selB = 48 @@ -175,7 +175,7 @@ for ota in amux.ota: ota.fast = 1 ota.gain = 8 ota.offset = 0 -amux.write() +#amux.write() @@ -188,6 +188,50 @@ dac.vinb(0.9) +############################################################################## +# ADC testing stuff +# +dac.vina(1.1) + +#go to idle mode +adc.setRegister(adc.TRIGGER_SCR, 0) + +#no average, SPI convst +#16x accurate average +adc.setRegister(adc.ADC_SCR, 0b11100001) + +# dac.vina --> adc.ch4 +adc.setRegister(adc.CHAN_SEL, 4) + +#ch4 setup +adc.setRegister(adc.CH45_CCR, 0b00000000) + +# go to mode 2 (full manual) +adc.setRegister(adc.TRIGGER_SCR, 2) + +print adc.read() + +n = [] +r = [] +for i in range(2**16): + x = i + dac.set(0, x) + adc.read() #sham to trigger conversion + sleep(200e-6) #ensure 160us conversion time delay + n.append(x) + v = adc.read() + r.append(v) + print i + +figure() +plot(n, r) +xlabel('DAC code') +ylabel('ADC count') +title('DAC_ch0 --> ADC_ch4 direct connection') +savefig('dac-adc-loopback.pdf') +show() + + ############################################################################## # drop into an IPython shell