Skip to content
Snippets Groups Projects
Commit 5d0ce160 authored by TUD278427's avatar TUD278427
Browse files

Generalized the firmware loader. Just copy the paths to a station specific...

Generalized the firmware loader. Just copy the paths to a station specific file (pulse_lib e.g.) and import from there and supply as argument to the loader. Also av_mode now needs to be specified explicitly
parent 5da2b0a9
No related branches found
No related tags found
No related merge requests found
"""
Standard firmware files for the digitizer of the V2 setup.
from projects.keysight_measurement.M3102A import MODES
CLEAN : normal image, revert to the normal AWG.
AVG : special image with MAV and interator. A custom qcodes driver needs to be used for that.
"""
M3102A_CLEAN = "C:/V2_code/FPGA_Bitstreams/Digitizer_FW1.41/clean_4_41.sbp"
M3102A_AVG = "C:/V2_code/FPGA_Bitstreams/Digitizer_FW1.41/averaging_firmware_1_41.sbp"
def firmware_loader(dig, file, av_mode):
"""
load a custom firmware image on board of the digitizer
from core_tools.drivers.M3102A import MODES
Args:
dig <SD_dig (qcodes instrument) : digitzer object
file (string) : location where to find the new firmware
"""
err = dig.SD_AIN.FPGAload(file)
if av_mode == 'normal':
dig.set_aquisition_mode(MODES.NORMAL)
elif av_mode == 'average':
dig.set_aquisition_mode(MODES.AVERAGE)
else:
raise ValueError("Average mode must be normal or average")
def firmware_loader(dig, file):
"""
load a custom firmware image on board of the digitizer
Args:
dig <SD_dig (qcodes instrument) : digitzer object
file (string) : location where to find the new firmware
"""
err = dig.SD_AIN.FPGAload(file)
if file == M3102A_CLEAN:
dig.set_aquisition_mode(MODES.NORMAL)
else:
dig.set_aquisition_mode(MODES.AVERAGE)
if err == 0 :
print("Succesful upload of the firmware")
else:
print("upload failed, error code {} (see keysight manual for instructions)".format(err))
if __name__ == '__main__':
firmware_loader(dig, M3102A_CLEAN)
\ No newline at end of file
if err == 0 :
print("Succesful upload of the firmware")
else:
print("upload failed, error code {} (see keysight manual for instructions)".format(err))
\ No newline at end of file
from core_tools.drivers.M3102A import SD_DIG, MODES, DATA_MODE
from core_tools.drivers.M3102_firmware_loader import firmware_loader, M3102A_CLEAN, M3102A_AVG
import qcodes as qc
from projects.keysight_measurement.M3102A import SD_DIG, MODES, DATA_MODE
from core_tools.drivers.M3102_firmware_loader import firmware_loader
def autoconfig_digitizer(firmware = M3102A_AVG):
station = qc.Station.default
#dig = SD_DIG(name ="M3102A_digitizer_", chassis = 0, slot = 6)
if firmware is not None:
firmware_loader(station.dig, firmware)
def autoconfig_digitizer(digitizer, firmware = None, av_mode = None):
if firmware is not None:
if av_mode is None:
raise ValueError('Please specify average mode (normal or average) when specifying firmware')
firmware_loader(digitizer, firmware, av_mode)
#set digitzer to use software triggering and return 1 point per channel --> average the full trace.
t_measure = 1e4 #1ms (unit ns)
cycles = 1 # just measure once.
#set digitzer to use software triggering and return 1 point per channel --> average the full trace.
t_measure = 1e3 #1us (unit ns)
cycles = 1 # just measure once.
digitizer.set_digitizer_software(t_measure, cycles, data_mode = DATA_MODE.AVERAGE_TIME_AND_CYCLES,
channels = [1,2,3,4], fourchannel = True)
station.dig.set_digitizer_software(t_measure, cycles, data_mode=DATA_MODE.AVERAGE_TIME_AND_CYCLES, channels = [1,2], fourchannel=True )
digitizer.daq_flush(1)
digitizer.daq_flush(2)
digitizer.daq_flush(3)
digitizer.daq_flush(4)
station.dig.daq_flush(1)
station.dig.daq_flush(2)
station.dig.daq_flush(3)
station.dig.daq_flush(4)
print("testing digitzer :: ")
print(station.dig.measure())
\ No newline at end of file
print("testing digitizer:",digitizer.measure())
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment