Example #1
0
def power_on_init():
    #Turn FM on
    gen = GEN_CTL()
    adc_ps = PS_CTL()
    fm_ps = RIGOL_PS_CTL()
    cq = CMD_ACQ()

    print("Turn FM on")
    fm_ps.ps_init()
    fm_ps.off([1, 2, 3])
    fm_ps.set_channel(channel=1, voltage=2.8, v_limit=3.5, c_limit=1)
    fm_ps.set_channel(channel=2, voltage=5.0, v_limit=5.2, c_limit=1)
    #    fm_ps.set_channel(channel=3, voltage = 5,  c_limit = 1)
    fm_ps.on([1, 2])
    time.sleep(3)
    #FPGA reset
    print("FM Reset")
    cq.bc.udp.write_reg(0, 1)
    time.sleep(0.01)
    cq.bc.udp.write_reg(0, 1)
    time.sleep(1)

    #initilize ADC PS
    print("ADC is powered on")
    adc_ps.ps_init()
    adc_ps.off([1, 2, 3])
    adc_ps.set_channel(1, 2.75)
    adc_ps.set_channel(2, 2.1)
    adc_ps.set_channel(3, 2.25)
    adc_ps.on([1, 2, 3])
    time.sleep(2)

    #initilize Genetor
    print("Generator output off")
    #Disable DS360 generator output
    gen.gen_init()
    gen.gen_set(out="dis")
    time.sleep(3)
Example #2
0
# (5) Synchronization and calibration check   ->   Correct channel mapping (backend communication), record calibration weights

import adc_config as config
from cmd_library import CMD_ACQ
import time
import os
import sys
import csv
import pickle
import numpy as np
import matplotlib.pyplot as plt
from keysight_e36312a_ps import PS_CTL
from stanford_ds360_gen import GEN_CTL
gen = GEN_CTL()  #signal generator library
ps = PS_CTL()  #power supply library
cq = CMD_ACQ()  #command library

#From ADC configuration file (adc_config.py): temperature and directory name. Create directory if not present
env = config.temperature
rawdir = config.subdir
if (os.path.exists(rawdir)):
    while (1):
        print("Folder already exists. Please close *.bat and reset")
        time.sleep(10)
else:
    try:
        os.makedirs(rawdir)
    except OSError:
        print("Error to create folder ")
        sys.exit()
Example #3
0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Jul 17 16:54:11 2019

@author: shanshangao
"""
from cmd_library import CMD_ACQ
import numpy as np
from raw_data_decoder import raw_conv
import pickle
import os
import sys
cq = CMD_ACQ() 

import adc_config as config
rawdir = config.subdir

tp = sys.argv[1]
sg_str = sys.argv[2]
pls_str =  sys.argv[3]
snc_str = sys.argv[4]
sbf_str = sys.argv[5]
sdc_str = sys.argv[6]
sdacsw_str =  sys.argv[7]
testno = int(sys.argv[8])

if tp == "05us":
    tpi = 1
elif tp == "10us":
    tpi = 0
Example #4
0
import numpy as np
import os
from sys import exit
import os.path
import math
import time
import statsmodels.api as sm

import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
import matplotlib.patches as mpatches
import matplotlib.mlab as mlab
import pickle
from stanford_ds360_gen import GEN_CTL
from cmd_library import CMD_ACQ
cq = CMD_ACQ()  #command library
gen = GEN_CTL()  #signal generator library

env = "RT"
baseline = 200

mode16bit = False
if (mode16bit):
    adc_bits = "ADC16bit"
else:
    adc_bits = "ADC12bit"

fn = "D:/ColdADC/ADC_TST_IN/ADC_TST_IN" + "_test" + ".bin"
with open(fn, 'rb') as fp:
    chns = pickle.load(fp)
Example #5
0
# Input: reference, baseline (200 or 900).
# RMS Noise is calculated for every channel, with both 200 mV and 900 mV DC (baseline) inputs from the DS360 Stanford Generator (white noise option with amplitude = 0 is the configuration with best noise performance).
# Output: single channel RMS Noise histograms, all-channels comparison plot. RMS values are saved in Channel Characterization tables.

import adc_config as config
import numpy as np
import os
import sys
import os.path
import csv
import matplotlib.pyplot as plt
from scipy.stats import norm
import pickle
from cmd_library import CMD_ACQ
from stanford_ds360_gen import GEN_CTL
cq = CMD_ACQ()  #command library
gen = GEN_CTL()  #signal generator library

env = config.temperature
rawdir = config.subdir

refs = sys.argv[1]
baseline = sys.argv[2]
adc_sample_rate = sys.argv[3]

gen_load = "Hi-Z"

#env = "RT"
#refs = "CMOS"
#baseline = "200"
Example #6
0
Created on Wed Jul 17 16:54:11 2019

@author: shanshangao
"""
# This file takes care of the full configuration of ColdADC.
# Input: reference, SDC enable, calibration weights (new or old), sampling rate.
# Set sampling rate, power supply configuration (different between BJT and CMOS references), configure ADC itself.

import adc_config as config
from cmd_library import CMD_ACQ
import time
import sys
import pickle
from keysight_e36312a_ps import PS_CTL
ps = PS_CTL()  #power supply library
cq = CMD_ACQ()  #command library

#From ADC configuration file (adc_config.py): temperature and directory name
env = config.temperature
rawdir = config.subdir
ref_set_dir = rawdir + "/Ref_set/"

#Input options from batch file: reference, SDC enable, weights selection, system sample rate
#ADC Sample Rate = 16   ->  16 Ms/s sample rate of internal ADC, 2 MHz sample rate of full system ADC (not fully reliable operation)
#ADC Sample Rate = 4    ->  4 Ms/s sample rate of internal ADC, 500 kHz sample rate of full system ADC (reliable operation)
flg_bjt_r = (sys.argv[1] == "BJT")  #BJR reference flag
cq.flg_bjt_r = flg_bjt_r
adc_sdc_en = (sys.argv[2] == "SDC")  #SDC enable flag
new_weights = (sys.argv[3] == "NEW_CALI")  #New calibration weights flag
adc_sample_rate = sys.argv[4]  #4 Ms/s internal ADC sample rate flag
adc_direct_en = (sys.argv[5] == "ADCinput"
Example #7
0
"""
Created on Wed Jul 17 16:54:11 2019

@author: shanshangao
"""
#import numpy as np
from cmd_library import CMD_ACQ
import time
import numpy as np
from raw_data_decoder import raw_conv

import pickle
import os
import sys

cq = CMD_ACQ()
tp = sys.argv[1]
sg_str = sys.argv[2]
pls_str = sys.argv[3]
snc_str = sys.argv[4]
sbf_str = sys.argv[5]
sdc_str = sys.argv[6]
sdacsw_str = sys.argv[7]
testno = int(sys.argv[8])
env = sys.argv[9]

if tp == "05us":
    tpi = 1
elif tp == "10us":
    tpi = 0
elif tp == "20us":
Example #8
0
# Input: reference.
# Sinewave cumulative histogram method (first implementation)  ->   J. Doernberg, H.-S. Lee, and D. Hodges, “Full-speed testing of A/D converters”, IEEE Journal of Solid-State Circuits, vol. 19, no. 6, pp. 820–827, 1984.
# Wide documentation about this matter can be found in documents on ADC testing by Analog Devices, Maxim Integrated, Texas Instruments and more.
# Output: DNL & INL plots with maximum and minimum values. Worst DNL and Worst INL are saved in Channel Characterization tables.


import adc_config as config
import numpy as np
import os
import sys
import os.path
import csv
import matplotlib.pyplot as plt
from cmd_library import CMD_ACQ
from stanford_ds360_gen import GEN_CTL
cq = CMD_ACQ()  #command library
gen = GEN_CTL() #signal generator library
plt.rcParams.update({'font.size': 18})

#From ADC configuration file (adc_config.py): temperature and directory name 
env = config.temperature
rawdir = config.subdir

#Input option from batch file: temperature
refs = sys.argv[1]
adc_sample_rate = sys.argv[2]

if(adc_sample_rate == "4"):
    freq = "14404.3"
    fs = 500 #kHz
else:
Example #9
0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Jul 17 16:54:11 2019

@author: shanshangao
"""
#import numpy as np
from cmd_library import CMD_ACQ
import os
import sys

env = sys.argv[1]
flg_bjt_r = (sys.argv[2] == "BJT")
adc_sdc_en = (sys.argv[3] == "SDC")

cq = CMD_ACQ() 
if (adc_sdc_en):
    cq.adc_cfg(adc_sdc="On", adc_db="Bypass", adc_sha="Diff", adc_curr_src="BJT-sd", env=env, flg_bjt_r=flg_bjt_r)
else:
    cq.adc_cfg(adc_sdc="Bypass", adc_db="Bypass", adc_sha="Single-ended", adc_curr_src="BJT-sd", env=env, flg_bjt_r=flg_bjt_r)

Example #10
0
import math
import time
from raw_data_decoder import raw_conv

import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
import matplotlib.patches as mpatches
import matplotlib.mlab as mlab
from scipy.fftpack import fft, rfft, ifft, fftn
import scipy.optimize

import pickle
from cmd_library import CMD_ACQ
from stanford_ds360_gen import GEN_CTL

cq = CMD_ACQ()  #command library
gen = GEN_CTL()  #signal generator library

#env = sys.argv[1]
#refs = sys.argv[2]
env = "RT"
refs = "BJT"

plt.rcParams.update({'font.size': 16})
mode16bit = False
if (mode16bit):
    adc_bits = "ADC16bit"
else:
    adc_bits = "ADC12bit"

import time
from raw_data_decoder import raw_conv

import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
import matplotlib.patches as mpatches
import matplotlib.mlab as mlab
from scipy.fftpack import fft, rfft, ifft, fftn
from scipy import signal
from itertools import chain

import pickle
from cmd_library import CMD_ACQ
from stanford_ds360_gen import GEN_CTL

cq = CMD_ACQ()  #command library
gen = GEN_CTL()  #signal generator library

#env = sys.argv[1]
#refs = sys.argv[2]
env = "RT"
refs = "BJT"

plt.rcParams.update({'font.size': 16})
mode16bit = False
if (mode16bit):
    adc_bits = "ADC16bit"
else:
    adc_bits = "ADC12bit"

Example #12
0
# SINAD is calculated by dividing the signal power bins by every noise and harmonic distortion bins.
# ENOB is calculated with correction factor (Vfullscale/Vinput). We cannot use full-range sinewaves because of ColdADC overflowing issue. See MT-003 tutorial by Analog Devices for more information on this.
# Output: PSD plots (relative to full scale) with calculated ENOB, SFDR, SINAD. Values for ENOB are saved in Channel Characterization tables.

import adc_config as config
import numpy as np
import os
import sys
import os.path
import csv
import matplotlib.pyplot as plt
from scipy.fftpack import fft, rfft, ifft, fftn
from cmd_library import CMD_ACQ
from stanford_ds360_gen import GEN_CTL
import pickle
cq = CMD_ACQ()  #command library
gen = GEN_CTL()  #signal generator library
plt.rcParams.update({'font.size': 18})

#From ADC configuration file (adc_config.py): temperature and directory name
env = config.temperature
rawdir = config.subdir

#Input option from batch file: BJT or CMOS reference
refs = sys.argv[1]
adc_sample_rate = sys.argv[2]

if (adc_sample_rate == "4"):
    freq = "14404.3"
    fs = 500  #kHz
else:
Example #13
0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Jul 17 16:54:11 2019

@author: shanshangao
"""
#import numpy as np
import adc_config as config
from cmd_library import CMD_ACQ
import os
import sys
import csv
import pickle
cq = CMD_ACQ()  #command library

env = config.temperature
rawdir = config.subdir

flg_bjt_r = (sys.argv[1] == "BJT")
cq.flg_bjt_r = flg_bjt_r
adc_sdc_en = (sys.argv[2] == "SDC")
new_weights = (sys.argv[3] == "NEW_CALI")
ref_set_dir = rawdir + "/Ref_set/"

#### Debug #####
#env = "RT"
#flg_bjt_r = True
#adc_sdc_en = False
#new_weights = False
################
Example #14
0
import adc_config as config
import numpy as np
import os
import sys
import os.path
import csv
from raw_data_decoder import raw_conv
import matplotlib.pyplot as plt
from scipy.fftpack import fft, rfft, ifft, fftn
from scipy.stats import norm
from itertools import chain
from cmd_library import CMD_ACQ
from stanford_ds360_gen import GEN_CTL
import pickle
cq = CMD_ACQ()  #command library
gen = GEN_CTL()  #signal generator library

env = config.temperature
rawdir = config.subdir

refs = sys.argv[1]
adc_sample_rate = sys.argv[2]

gen_load = "50"


def chn_rfft_psd(chndata, fs=2000000.0, fft_s=2000, avg_cycle=50):
    len_chndata = len(chndata)
    avg_cycle_tmp = avg_cycle
    if (len_chndata >= fft_s * avg_cycle_tmp):