Commit a5bb06b3 authored by Matthieu Cattin's avatar Matthieu Cattin

Measures SPEC and FMC temperature only once.

parent ad16de87
......@@ -25,23 +25,24 @@ Note: Requires test00.py to run first to load the firmware!
"""
GN4124_CSR = 0x0
FAMILY_CODE = 0x28
def main (default_directory='.'):
load_firmware = raw_input('Do you want to load the firmware? [y,n]')
if(load_firmware == 'y'):
path_fpga_loader = '../../../gnurabbit/user/fpga_loader';
path_firmware = '../firmwares/spec_fmcadc100m14b4cha_test.bin';
def load_firmware(default_directory):
print('Load firmware to FPGA')
path_fpga_loader = '../../../gnurabbit/user/fpga_loader';
path_firmware = '../firmwares/spec_fmcadc100m14b4cha_test.bin';
firmware_loader = os.path.join(default_directory, path_fpga_loader)
bitstream = os.path.join(default_directory, path_firmware)
print firmware_loader + ' ' + bitstream
os.system( firmware_loader + ' ' + bitstream )
time.sleep(2);
firmware_loader = os.path.join(default_directory, path_fpga_loader)
bitstream = os.path.join(default_directory, path_firmware)
print firmware_loader + ' ' + bitstream
os.system( firmware_loader + ' ' + bitstream )
time.sleep(2);
def main (default_directory='.'):
# Load firmware
load_firmware(default_directory)
# Objects declaration
spec = rr.Gennum() # bind to the SPEC board
......@@ -57,6 +58,16 @@ def main (default_directory='.'):
else:
print('SPEC Unique ID: %.12X') % spec_unique_id
# Read SPEC temperature and print to log
spec_temp = spec_fmc.get_temp()
print('SPEC temperature: %3.3f°C') % spec_temp
# Check SPEC thermometer family code
if((spec_unique_id & 0xFF) != FAMILY_CODE):
family_code = spec_unique_id & 0xFF
print('family code: 0x%.8X') % family_code
raise PtsError ("SPEC's 1-wire thermometer has the wrong family code:0x.2X expected:0x%.2X" % family_code,FAMILY_CODE)
# Read FMC unique ID and print to log
fmc_unique_id = fmc.get_unique_id()
if(fmc_unique_id == -1):
......@@ -64,19 +75,14 @@ def main (default_directory='.'):
else:
print('FMC Unique ID: %.12X') % fmc_unique_id
# Read temperatur and print to log
temp = spec_fmc.get_temp()
print('SPEC temperature: %3.3f°C') % temp
if((spec_unique_id & 0xFF) != FAMILY_CODE):
family_code = spec_unique_id & 0xFF
print('family code: 0x%.8X') % family_code
raise PtsError ("SPEC's 1-wire thermometer has the wrong family code:0x.2X expected:0x%.2X" % family_code,FAMILY_CODE)
# Read FMC temperature and print to log
fmc_temp = spec_fmc.get_temp()
print('FMC temperature: %3.3f°C') % fmc_temp
for i in range(1000):
print('%4d: spec: %3.3f°C fmc: %3.3f°C') %(i, spec_fmc.get_temp(),fmc.get_temp())
time.sleep(.5)
#for i in range(1000):
# print('%4d: spec: %3.3f°C fmc: %3.3f°C') %(i, spec_fmc.get_temp(),fmc.get_temp())
# time.sleep(.5)
if __name__ == '__main__' :
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment