Commit ceb84a96 authored by Richard R. Carrillo's avatar Richard R. Carrillo

the procedure carried out by test00 of the fmcdio5chttla now is divided into…

the procedure carried out by test00 of the fmcdio5chttla now is divided into test00, test01, test02 and test03 (three new tests created)
parent ee5a99fb
......@@ -5,7 +5,7 @@
# Licence: GPL v2 or later.
# Website: http://www.ohwr.org
# Website: http://www.sevensols.com
# Version: 0.2 (Last modifications: 26/4/2012)
# Version: 1.0 (Last modifications: 29/4/2012)
LOGDIR=./log_fmcdio5chttla
......@@ -49,7 +49,7 @@ do
echo "Test series run $nb_test out of $nb_test_limit"
echo " "
sudo ./pts.py -b FMC-DIO-5chTTLa -s $serial -e $extra_serial -t./test/fmcdio5chttla/python -l $LOGDIR 00 01 02 03 04 05
sudo ./pts.py -b FMC-DIO-5chTTLa -s $serial -e $extra_serial -t./test/fmcdio5chttla/python -l $LOGDIR 00 01 02 03 04 05 06 07 08
if [ "$nb_test" != "$nb_test_limit" ]
then
......
......@@ -9,16 +9,19 @@ Author: Richard R. Carrillo <rcarrillo(AT)sevensols.com>
Licence: GPL v2 or later.
Website: http://www.ohwr.org
Website: http://www.sevensols.com
Last modifications: 1/4/2012
This batch of tests makes a connectivity test of the FmcDIO5chTTLa's components.
- test00: Check fmc-dio-5chttl board EEPROM and DAC presence and temperature-sensor operation
- test01: Check fmc-dio-5chttl-board LEDs (LEDs and LED circuit working)
- test02: Check fmc-dio-5chttl-board ports as output (port driver working, connector connectivity and LVDS to LVCMOS IC working)
- test03: Check fmc-dio-5chttl-board ports as inputs (DAC and LVDS comparator working)
- test04: Check output-enable circuit of fmc-dio-5chttl-board ports
- test05: Check termination resistors of fmc-dio-5chttl-board ports
Version 1.0 (Last modifications: 29/4/2012)
This batch of tests makes a connectivity and operation test of the FmcDIO5chTTLa's components.
- test00: Check fmc-dio-5chttl-board presence (Mezzanine presence line working)
- test01: Check fmc-dio-5chttl-board digital thermometer operation (termperature and unique ID acquisition working)
- test02: Check fmc-dio-5chttl-board EEPROM presence and operation (read and write operations working)
- test03: Check fmc-dio-5chttl-board DAC presence operation (DAC initialization)
- test04: Check fmc-dio-5chttl-board LEDs (LEDs and LED circuit working)
- test05: Check fmc-dio-5chttl-board ports as output (port driver working, port connectivity and LVDS to LVCMOS IC working)
- test06: Check fmc-dio-5chttl-board ports as inputs (DAC and LVDS comparator working)
- test07: Check output-enable circuit of fmc-dio-5chttl-board ports
- test08: Check termination resistors of fmc-dio-5chttl-board ports
These tests are made to work stand-alone too. So, it is possible to execute each one using 'sudo ./test0x.py'
......
This diff is collapsed.
......@@ -5,7 +5,7 @@
# Licence: GPL v2 or later.
# Website: http://www.ohwr.org
# Website: http://www.sevensols.com
# Last modifications: 1/4/2012
# Version 1.0 (last modifications: 29/4/2012)
import rr
import struct
......@@ -54,46 +54,58 @@ class CFmcDio:
DAC_CHANNEL_CORRESP=[0,1,2,7,4,5]
def __init__(self, bus, base, init_devices):
def __init__(self, bus, base, init_thermometer, init_eeprom, init_dac):
""" fmc-dio-5chttla-board presence check, I2C devices response check and OneWire-device funct. init.
bus = host bus (PCIe, VME, etc...)
base = base address
init_devices = If it is True, I2C and OneWire devices are initialized and can then be used
init_thermometer = If it is True, OneWire bus and the digital thermometer is initialized for further user
init_eeprom = If it is True, I2C bus and EEPROM is initialized for further user
init_dac = If it is True, I2C bus and DAC is initialized for further user
"""
self.bus = bus
self.base = base
self.gpio = CGPIO(bus, base + self.BASE_GPIO)
if(not self.fmc_present()):
raise CFmcDioError("FMC", base, "DIOERR00: PRESENT line is not asserted")
if init_devices:
if init_eeprom or init_dac: # if any I2C device must be initialized, init the I2C bus
try:
self.i2c = COpenCoresI2C(bus, base + self.BASE_I2C, self.I2C_PRESCALER)
board_I2C_periph_addr=[self.I2C_ADDR_DAC,self.I2C_ADDR_EEPROM]
board_I2C_periph_addr=list()
if init_eeprom:
board_I2C_periph_addr.append(self.I2C_ADDR_EEPROM) # Add EEPROM to the list of required I2C devices
if init_dac:
board_I2C_periph_addr.append(self.I2C_ADDR_DAC) # Add DAC to the list of required I2C devices
found_I2C_periph_addr=self.i2c.scan()
except I2CDeviceOperationError as e:
raise CFmcDioError("I2C", base, "DIOERR01: "+e.msg)
raise CFmcDioError("I2C", base, "DIOERR01: Initializing bus: "+e.msg)
if not found_I2C_periph_addr:
raise CFmcDioError("I2C", base, "DIOERR02: No I2C device found")
for periph_addr in board_I2C_periph_addr:
if periph_addr not in found_I2C_periph_addr:
raise CFmcDioError("I2C", periph_addr, "DIOERR03: Device not found. Only "+str(len(found_I2C_periph_addr))+" I2C devices found")
try:
self.eeprom = C24AA64(self.i2c, self.I2C_ADDR_EEPROM);
except I2CDeviceOperationError as e:
raise CFmcDioError("I2C", self.I2C_ADDR_EEPROM, "DIOERR04: "+e.msg)
try:
self.dac = CDAC5578(self.i2c, self.I2C_ADDR_DAC);
except I2CDeviceOperationError as e:
raise CFmcDioError("I2C", self.I2C_ADDR_DAC, "DIOERR05: "+e.msg)
self.onewire = COpenCoresOneWire(self.bus, base + self.BASE_ONEWIRE, 624/2, 124/2)
self.ds1820 = CDS18B20(self.onewire, 0);
if init_eeprom:
try:
self.eeprom = C24AA64(self.i2c, self.I2C_ADDR_EEPROM)
except I2CDeviceOperationError as e:
raise CFmcDioError("I2C", self.I2C_ADDR_EEPROM, "DIOERR04: Initializing: "+e.msg)
else:
self.eeprom=None
if init_dac:
try:
self.dac = CDAC5578(self.i2c, self.I2C_ADDR_DAC);
except I2CDeviceOperationError as e:
raise CFmcDioError("I2C", self.I2C_ADDR_DAC, "DIOERR05: Initializing: "+e.msg)
else:
self.dac=None
else:
self.i2c=None
self.onewire=None
self.dac=None
self.eeprom=None
if init_thermometer: # if the thermometer must be initialized, init the OneWire bus
self.onewire = COpenCoresOneWire(self.bus, base + self.BASE_ONEWIRE, 624/2, 124/2)
self.ds1820 = CDS18B20(self.onewire, 0)
else:
self.onewire=None
self.ds1820=None
def fmc_present(self):
......@@ -139,9 +151,9 @@ class CFmcDio:
try:
self.dac.out(self.DAC_CHANNEL_CORRESP[port], threshold)
except I2CDeviceOperationError as e:
raise CFmcDioError("I2C", self.I2C_ADDR_DAC, "DIOERR06: "+e.msg)
raise CFmcDioError("I2C", self.I2C_ADDR_DAC, "DIOERR06: Setting channel value: "+e.msg)
else:
raise CFmcDioError("I2C", self.base, "DIOERR07: Device not initialized")
raise CFmcDioError("I2C", self.I2C_ADDR_DAC, "DIOERR07: Device not initialized")
def get_in_threshold(self, port):
""" Returns the DAC value set in a specified channel (port) """
......@@ -149,10 +161,10 @@ class CFmcDio:
try:
dacval=self.dac.rd_out(self.DAC_CHANNEL_CORRESP[port])
except I2CDeviceOperationError as e:
raise CFmcDioError("I2C", self.I2C_ADDR_DAC, "DIOERR08: "+e.msg)
raise CFmcDioError("I2C", self.I2C_ADDR_DAC, "DIOERR08: Getting channel value: "+e.msg)
return(dacval)
else:
raise CFmcDioError("I2C", self.base, "DIOERR07: Device not initialized")
raise CFmcDioError("I2C", self.I2C_ADDR_DAC, "DIOERR07: Device not initialized")
def DACvalue2voltage(self, dacval):
""" Calculate the voltage corresponding to a specific DAC channel digital value """
......@@ -207,9 +219,9 @@ class CFmcDio:
try:
return self.ds1820.read_serial_number()
except OneWireDeviceOperationError as e:
raise CFmcDioError("OneWire", self.base, "DIOERR09: "+e.msg)
raise CFmcDioError("OneWire", 0, "DIOERR09: Getting unique ID: "+e.msg)
else:
raise CFmcDioError("OneWire", self.base, "DIOERR10: Device not initialized")
raise CFmcDioError("OneWire", 0, "DIOERR10: Device not initialized")
def get_temp(self):
""" Returns a temperature value in Celsius degrees by means of the OneWire IC DS1820 """
......@@ -218,11 +230,30 @@ class CFmcDio:
serial_number = self.ds1820.read_serial_number()
temp=self.ds1820.read_temp(serial_number)
except OneWireDeviceOperationError as e:
raise CFmcDioError("OneWire", self.base, "DIOERR11: "+e.msg)
raise CFmcDioError("OneWire", 0, "DIOERR11: Getting temperature: "+e.msg)
return temp
else:
raise CFmcDioError("OneWire", self.base, "DIOERR10: Device not initialized")
raise CFmcDioError("OneWire", 0, "DIOERR10: Device not initialized")
def wr_eeprom(self, mem_addr, data_list):
""" Write a list of bytes (data_list) at the mem_addr address of the board EEPROM (24AA64T)"""
if self.eeprom:
try:
self.eeprom.wr_data(mem_addr,data_list)
except I2CDeviceOperationError as e:
raise CFmcDioError("I2C", self.I2C_ADDR_EEPROM, "DIOERR13: Writing memory data: "+e.msg)
else:
raise CFmcDioError("I2C", self.I2C_ADDR_EEPROM, "DIOERR12: Device not initialized")
def rd_eeprom(self, mem_addr, number_of_bytes):
""" Read a list of bytes (data_list) of number_of_bytes size at the mem_addr address of the board EEPROM (24AA64T)"""
if self.eeprom:
try:
return self.eeprom.rd_data(mem_addr,number_of_bytes)
except I2CDeviceOperationError as e:
raise CFmcDioError("I2C", self.I2C_ADDR_EEPROM, "DIOERR14: Reading memory data: "+e.msg)
else:
raise CFmcDioError("I2C", self.I2C_ADDR_EEPROM, "DIOERR12: Device not initialized")
#spec = rr.Gennum()
......
......@@ -7,7 +7,7 @@
# Licence: GPL v2 or later.
# Website: http://www.ohwr.org
# Website: http://www.sevensols.com
# Version: 0.2 (Last modifications: 24/4/2012)
# Version: 1.0 (Last modifications: 29/4/2012)
from ptsexcept import *
from dio_fmc import *
......@@ -17,49 +17,18 @@ import os
"""
test00: Check fmc-dio-5chttl-board EEPROM and DAC presence and temperature-sensor operation
Conditions: I2C bus and OneWire bus work
test00: Check fmc-dio-5chttl-board presence
Conditions: None
User intervention required: No
Procedure details:
- Load firmware
- Test mezzanine presence line.
- Initialize the board and its peripherals
- Check that I2C devices (EEPROM (24AA64T) and DAC (DAC5578)) are present
- Check that OneWire device (temperature sensor (DS18B20)) is present and responds
- Check and store temperature sensor ID
- Check and store temperature acquisition.
"""
class test00:
def __init__(self, spec):
""" Initialize the board, check PRESENT pin state and look for I2C devices """
try:
self.dio = CFmcDio(spec, 0x80000, True)
except CFmcDioError as e:
err_msg="While fmc-dio-5chttla initialization: "+str(e)
if e.bus_name == "FMC":
raise PtsCritical(err_msg) # Critical error: the fmc-dio-5chttl-board is apparently not present
else:
raise PtsError(err_msg) # Non-critical error: further tests could be performed successfully
def test_temp(self):
""" Check OneWire device response correctly and check temperature acquisition """
try:
print " chip lasered code: {:x}".format(self.dio.get_unique_id())
except CFmcDioError as e:
print str(e)
ret_error=["E","While getting DS18B20 chip I.C.: "+str(e)]
else:
try:
ret_error=None # test completed successfully
temper=self.dio.get_temp()
print " chip temperature: {:.2f}°C".format(temper)
if temper > 50 or temper < 10:
ret_error=["W","While getting temperature with DS18B20 I.C.: TSTWRN05: Strange temperature value measured"]
except CFmcDioError as e:
print str(e)
ret_error=["E","While getting temperature with DS18B20 I.C.: "+str(e)]
return ret_error
""" Initialize the board, check PRESENT pin state """
self.dio = CFmcDio(spec, 0x80000, False, False, False) # Do not init any I2C or OneWire device
def main(default_directory="."):
# Configure the FPGA using the program fpga_loader
......@@ -77,22 +46,26 @@ def main(default_directory="."):
print "Test00 Start"
init_test_time = time.time()
print "Configuring and checking fmc-dio-5chttla devices"
test=test00(spec)
print "\nChecking temperature acquisition I.C. (DS18B20)"
ret_error=test.test_temp()
print "Checking fmc-dio-5chttla board presence"
try:
test=test00(spec)
except CFmcDioError as e:
test_error=e
print str(test_error)
else:
test_error=None
end_test_time = time.time()
print "\nEnd of Test00"
print "RESULT: [{}]".format("FAIL" if ret_error and ret_error[0]=="E" else ("OK with warnings" if ret_error and ret_error[0]=="W" else "OK"))
print 'Test00 elapsed time: {:.2f} seconds'.format(end_test_time-init_test_time)
if ret_error:
if ret_error[0]=="W": # Warning message returned by test funciton
raise PtsWarning(ret_error[1])
else: # Error message returned by test funciton
raise PtsError(ret_error[1])
print "RESULT: [{}]".format("FAIL" if test_error else "OK")
print 'Test00 elapsed time: {:.2f} seconds'.format(end_test_time-init_test_time)
if test_error:
err_msg="While fmc-dio-5chttla initialization: "+str(test_error)
if test_error.bus_name == "FMC":
raise PtsCritical(err_msg) # Critical error: the fmc-dio-5chttl-board is apparently not present
else:
raise PtsError(err_msg) # Non-critical error: further tests could be performed successfully
if __name__ == "__main__":
main(".")
......
......@@ -2,36 +2,38 @@
#coding: utf8
# Copyright CERN, 2012 (Seven Solutions S.L.)
# Author: Tomasz?
# Author: Richard Carrillo <rcarrillo(AT)sevensols.com>
# Licence: GPL v2 or later.
# Website: http://www.ohwr.org
# Website: http://www.sevensols.com
# Version: 0.1 (Last modifications: 1/4/2012)
# Version: 1.0 (Last modifications: 29/4/2012)
from ptsexcept import *
from dio_fmc import *
from keyb import *
import rr
import os
import sys
"""
test01: Check fmc-dio-5chttl-board LEDs (LED and LED circuit working)
Conditions: None
User intervention required: Yes
test01: Check fmc-dio-5chttl-board digital thermometer operation
Conditions: Mezzanine presence line asserted (test00 passed)
User intervention required: No
Procedure details:
- Load firmware
- Test mezzanine presence line
- Blink fmc-dio-5chttl-board LEDs
- Test mezzanine presence line.
- Initialize the board OneWire device (digital thermometer (DS18B20))
- Check that DS18B20 is present and responds
- Check and store temperature sensor ID
- Check and store acquired temperature.
"""
class test01:
def __init__(self, spec):
""" check FMC PRESENT-pin state """
""" Initialize the board and check PRESENT pin state """
try:
self.dio = CFmcDio(spec, 0x80000, False)
self.dio = CFmcDio(spec, 0x80000, True, False, False) # Init only the OneWire device
except CFmcDioError as e:
err_msg="While fmc-dio-5chttla initialization: "+str(e)
if e.bus_name == "FMC":
......@@ -39,38 +41,24 @@ class test01:
else:
raise PtsError(err_msg) # Non-critical error: further tests could be performed successfully
def test_LEDs(self):
""" LED-blink Check """
tmp_stdout = sys.stdout
sys.stdout = sys.__stdout__
tmp_stdin = sys.stdin
sys.stdin = sys.__stdin__
print "¿Are the two fmc-dio-5chttla-board LEDs blinking alternately?"
print "Press Y/N and Enter"
ans=""
while ans != "Y" and ans != "N":
for nled in range(2):
self.dio.set_led(nled,nled)
time.sleep(0.2)
for nled in range(2):
self.dio.set_led(nled,1-nled)
time.sleep(0.2)
if kbhit():
ans=raw_input().upper()
if ans <> "Y" and ans <> "N":
print "The valid inputs are only Y or N and Enter"
sys.stdout = tmp_stdout
sys.stdin = tmp_stdin
# purgestdin()
for nled in range(2):
self.dio.set_led(nled,0)
print "The user reported {} operation of board LEDs".format("a correct" if ans=="Y" else "an incorrect")
if ans == "N":
emsg="TSTERR00: Operation of fmc-dio-5chttla-board LEDs failed"
print emsg
def test_temp(self):
""" Check OneWire device response correctly and check temperature acquisition """
try:
print " chip lasered code: {:x}".format(self.dio.get_unique_id())
except CFmcDioError as e:
print str(e)
ret_error=["E","While getting DS18B20 I.C. unique ID: "+str(e)]
else:
emsg=None # test completed successfully
return emsg
try:
ret_error=None # test completed successfully
temper=self.dio.get_temp()
print " chip temperature: {:.2f}°C".format(temper)
if temper > 50 or temper < 10:
ret_error=["W","While getting temperature with DS18B20 I.C.: TSTWRN05: Strange temperature value measured"]
except CFmcDioError as e:
print str(e)
ret_error=["E","While getting temperature with DS18B20 I.C.: "+str(e)]
return ret_error
def main(default_directory="."):
# Configure the FPGA using the program fpga_loader
......@@ -87,16 +75,23 @@ def main(default_directory="."):
print "Test01 Start"
print "Checking fmc-dio-5chttla board presence"
init_test_time = time.time()
print "Configuring and checking fmc-dio-5chttla board"
test=test01(spec)
print "\nChecking temperature acquisition I.C. (DS18B20)"
ret_error=test.test_temp()
print "\nChecking LEDs"
emsg=test.test_LEDs()
end_test_time = time.time()
print "\nEnd of Test01"
print "RESULT: [{}]".format("FAIL" if emsg else "OK")
if emsg:
raise PtsError(emsg)
print "RESULT: [{}]".format("FAIL" if ret_error and ret_error[0]=="E" else ("OK with warnings" if ret_error and ret_error[0]=="W" else "OK"))
print 'Test01 elapsed time: {:.2f} seconds'.format(end_test_time-init_test_time)
if ret_error:
if ret_error[0]=="W": # Warning message returned by test funciton
raise PtsWarning(ret_error[1])
else: # Error message returned by test funciton
raise PtsError(ret_error[1])
if __name__ == "__main__":
main(".")
......
......@@ -2,37 +2,37 @@
#coding: utf8
# Copyright CERN, 2012 (Seven Solutions S.L.)
# Author: Tomasz?
# Author: Richard Carrillo <rcarrillo(AT)sevensols.com>
# Licence: GPL v2 or later.
# Website: http://www.ohwr.org
# Website: http://www.sevensols.com
# Version: 0.2 (Last modifications: 24/4/2012)
# Version: 1.0 (Last modifications: 29/4/2012)
from ptsexcept import *
from dio_fmc import *
from keyb import *
import rr
import os
"""
test02: Check fmc-dio-5chttl-board ports as output (port driver working, connector connectivity and LVDS to LVCMOS IC working)
Conditions: fmc-dio-5chttl-board presence line working
User intervention required: Yes*
test02: Check fmc-dio-5chttl-board EEPROM presence and operation
Conditions: Mezzanine presence line asserted
User intervention required: No
Procedure details:
- Load firmware.
- Load firmware
- Test mezzanine presence line.
- Check that ports work as output
- Using the port interconnection cables: Check that all ports are interconnected.
- If all the communications fail: Using the test cable: Oscillate state of fmc-dio-5chttl-board ports
- Initialize the board
- Check that I2C device EEPROM (24AA64T) is present
- Check writing and reading operation of EEPROM
"""
class test02:
def __init__(self, spec):
""" check FMC PRESENT-pin state """
""" Initialize the board, check PRESENT pin state and look for I2C devices """
try:
self.dio = CFmcDio(spec, 0x80000, True)
self.dio = CFmcDio(spec, 0x80000, False, True, False) # Init EEPROM I2C device
except CFmcDioError as e:
err_msg="While fmc-dio-5chttla initialization: "+str(e)
if e.bus_name == "FMC":
......@@ -40,128 +40,34 @@ class test02:
else:
raise PtsError(err_msg) # Non-critical error: further tests could be performed successfully
def osc_ports(self):
""" Oscillate state of fmc-dio-5chttl-board ports """
for lemon in range(5): # Disable output of all ports and set them to 1
self.dio.set_dir(lemon,0)
self.dio.set_out(lemon,1)
ans=""
lemon=0
while ans != "Y" and ans != "N":
time.sleep(0.05)
self.dio.set_dir((lemon-1)%5,0)
self.dio.set_dir(lemon,1)
lemon=(lemon+1)%5
if kbhit():
ans=raw_input().upper()
if ans <> "Y" and ans <> "N":
print "The valid inputs are only Y or N and Enter"
for lemon in range(5): # Disable output of all ports
self.dio.set_out(lemon, 0)
self.dio.set_dir(lemon, 0)
return ans
def check_port_couple(self,inp,outp):
""" check if a given port couple works as input (inp) and output (outp) """
self.dio.set_out(outp,0) # Set port output value to 0
self.dio.set_dir(outp,1) # Enable port output
def test_eeprom(self):
""" Check EEPROM I.C. operation """
wr_pattern_length=8 # length of the testing byte pattern
wr_pattern_addr=20 # address at which the pattern is written
wr_pattern=list() # List of patterns to verify
wr_pattern.append([0xFF for n in range(wr_pattern_length)]) # first testing pattern
wr_pattern.append([2**n for n in range(wr_pattern_length)]) # second testing pattern
try:
self.dio.set_in_threshold(inp,self.dio.DACvoltage2value(0.8))
ret_error=None
oldedata=self.dio.rd_eeprom(wr_pattern_addr,wr_pattern_length) # Save EEPROM content before testing
time.sleep(0.01)
for pattern in wr_pattern:
self.dio.wr_eeprom(wr_pattern_addr,pattern)
time.sleep(0.01)
edata=self.dio.rd_eeprom(wr_pattern_addr,wr_pattern_length)
time.sleep(0.01)
if edata <> pattern: # If writen data is not correctly recovered
ret_error="TSTERR07: Correct data not read when verifying EEPROM (24AA64T) writting operation"
print ret_error
break
self.dio.wr_eeprom(wr_pattern_addr,oldedata) # Restore EEPROM content before exiting
except CFmcDioError as e:
print str(e)
raise PtsError("While setting CDAC5578 channel value: "+str(e))
time.sleep(0.010) # wait for the DAC output to stabilize
if not self.dio.get_in(inp): # Low value detected in the input port
self.dio.set_out(outp,1) # Set port output value to 1
try:
self.dio.set_in_threshold(inp,self.dio.DACvoltage2value(1.9))
except CFmcDioError as e:
print str(e)
raise PtsError("While setting CDAC5578 channel value: "+str(e))
time.sleep(0.010) # wait for the DAC output to stabilize
if self.dio.get_in(inp): # High value detected in the output port
ports_working=True
else:
ports_working=False
else:
ports_working=False
self.dio.set_out(outp,0) # Set port output value to 0
self.dio.set_dir(outp,0) # Disable port output
return ports_working
def look_for_working_out_in_port_couple(self):
""" look for a port which works as output and another which works as input """
in_out_port_couple=None
for lemoin, lemoout in ((inp,outp) for inp in range(5) for outp in range(5)):
if lemoout <> lemoin: # Check interconnectivity of different ports only
if self.check_port_couple(lemoin,lemoout): # these ports are connected
in_out_port_couple=[lemoin,lemoout]
break
return in_out_port_couple
def test_port_inter(self):
""" Port (LEMO 00 connectors) interconnection check """
for lemon in range(5):
self.dio.set_term(lemon, 0) # Disable termination resistor
self.dio.set_out(lemon,0) # Set port output value to 0
self.dio.set_dir(lemon,0) # Disable port output
tmp_stdout = sys.stdout
sys.stdout = sys.__stdout__
tmp_stdin = sys.stdin
sys.stdin = sys.__stdin__
raw_input("Plug the interconnection cables in the five LEMO 00 connectors of the fmc-dio-5chttla-board ports and press Enter")
in_out_port_couple=self.look_for_working_out_in_port_couple()
if not in_out_port_couple:
print "TSTERR05: No communication could be performed between any two ports"
msg=self.test_port_out()
emsg=msg[1] # set the new error message reported it by the manual procedure
else:
msg=None # No additional message to be printed
unchecked_ports=list(range(5)) # create a list containing the ports to be checked
# remove the already-checked ports in_out_port_couple
lemoin=in_out_port_couple[0]
lemoout=in_out_port_couple[1]
unchecked_ports.remove(lemoin)
unchecked_ports.remove(lemoout)
faulty_ports=list()
for cport in unchecked_ports:
if not self.check_port_couple(lemoin,cport): # no communication in this way
if not self.check_port_couple(cport,lemoout): # cport is not connected
faulty_ports.append(cport)
#print in_out_port_couple
#print unchecked_ports
#print faulty_ports
if faulty_ports: # Some ports are not correctly interconnected
emsg="TSTERR06: Ports {} do not appear to be correctly connected".format(faulty_ports)
else:
emsg=None
raw_input("Disconnect all the cables from the fmc-dio-5chttla-board ports (in order to perform further tests) and press Enter")
sys.stdout = tmp_stdout
sys.stdin = tmp_stdin
if msg:
print msg[0] # print manual procedure message in case it was performed
if emsg:
print emsg # print result error message
return emsg
def test_port_out(self):
""" Port (LEMO 00 connectors) oscillation check """
print "Connect the testing LEDs to the LEMO 00 connectors of the fmc-dio-5chttla-board ports (120ohm serial resistor included)"
print "¿Are all the connected testing LEDs blinking alternately?"
print "Press Y/N and Enter"
for lemon in range(5): # Disable all termination resistors
self.dio.set_term(lemon, 0)
ans=self.osc_ports()
msg=["The user reported {} operation of board-port outputs".format("a correct" if ans=="Y" else "an incorrect"), "TSTERR01: Operation of fmc-dio-5chttla-board ports as output failed" if ans == "N" else None]
return msg
ret_error="While verifying operation of EEPROM (24AA64T): "+str(e)
return ret_error
def main(default_directory="."):
# Configure the FPGA using the program fpga_loader
......@@ -176,18 +82,22 @@ def main(default_directory="."):
print "Loading hardware access library and opening device\n"
spec = rr.Gennum()
print "Test Start02"
print "Test02 Start"
print "Checking fmc-dio-5chttla board presence"
init_test_time = time.time()
print "Checking fmc-dio-5chttla board and I2C devices"
test=test02(spec)
print "\nChecking EEPROM I.C. writing and reading operation (24AA64T)"
ret_error=test.test_eeprom()
print "\nChecking connectivity of board ports"
emsg=test.test_port_inter()
end_test_time = time.time()
print "\nEnd of Test02"
print "RESULT: [{}]".format("FAIL" if emsg else "OK")
if emsg:
raise PtsError(emsg)
print "RESULT: [{}]".format("FAIL" if ret_error else "OK")
print 'Test02 elapsed time: {:.2f} seconds'.format(end_test_time-init_test_time)
if ret_error:
raise PtsError(ret_error)
if __name__ == "__main__":
main(".")
......
......@@ -6,8 +6,7 @@
# Licence: GPL v2 or later.
# Website: http://www.ohwr.org
# Website: http://www.sevensols.com
# Version: 0.2 (Last modifications: 1/4/2012)
# Version: 1.0 (Last modifications: 29/4/2012)
from ptsexcept import *
from dio_fmc import *
......@@ -15,78 +14,22 @@ from dio_fmc import *
import rr
import os
"""
test03: Check fmc-dio-5chttl-board ports as inputs (DAC, LVDS comparator)
Conditions: fmc-dio-5chttl-board ports work as outputs (test02 passed) and I2C bus works (test00 passed)
test03: Check fmc-dio-5chttl-board DAC presence operation
Conditions: Mezzanine presence line asserted (test00 passed)
User intervention required: No
Procedure details:
- Load firmware.
- Load firmware
- Test mezzanine presence line.
- Check the voltage of all ports (by means of the internal DAC) when port output set to 0 and when it is set to 1
- Initialize the board and its peripherals
- Check that I2C device DAC (DAC5578) is present and respond
"""
class test03:
def __init__(self, spec):
""" check FMC PRESENT-pin state """
try:
self.dio = CFmcDio(spec, 0x80000, True)
except CFmcDioError as e:
err_msg="While fmc-dio-5chttla initialization: "+str(e)
if e.bus_name == "FMC":
raise PtsCritical(err_msg) # Critical error: the fmc-dio-5chttl-board is apparently not present
else:
raise PtsError(err_msg) # Non-critical error: further tests could be performed successfully
def test_port_in(self):
""" Port (LEMO 00 connectors) input check """
print "Ensure that nothing is connected to the fmc-dio-5chttla-board ports"
print "(Termination resistors disabled, port outputs enabled)"
port_th=[]
port_warnlow=[]
port_warnhigh=[]
for lemon in range(5):
self.dio.set_term(lemon, 0) # Disable termination resistor
self.dio.set_out(lemon,0) # set port output value to 0
self.dio.set_dir(lemon,1) # Enable port output
try:
th0=self.dio.find_port_voltage(lemon,0.0,0.08) # Find the voltage (threshold) when out=0
self.dio.set_out(lemon,1) # set port output state to 1
th1=self.dio.find_port_voltage(lemon,3.28,3.3) # Find the voltage (threshold) when out=1
except CFmcDioError as e:
print str(e)
raise PtsError("While setting CDAC5578 channel value: "+str(e))
self.dio.set_dir(lemon,0) # Disable port output
if th0>0.1:
th0_warn="Warning: Strangely-high value "
port_warnhigh.append(lemon)
else:
th0_warn="OK "
if th1<3.2:
th1_warn="Warning: Strangely-low value "
port_warnlow.append(lemon)
else:
th1_warn="OK"
print "Port {} apparent input voltage when out=0: {:.3f}V {}".format(lemon,th0,th0_warn)
print "\t\t\t when out=1: {:.3f}V {}".format(th1,th1_warn)
port_th.insert(lemon,[th0,th1])
port_err=[]
for lemon in range(len(port_th)):
if port_th[lemon][0]>0.8 or port_th[lemon][1]<2.0: # normal operating conditions
port_err.append(lemon)
if port_err: # Some errors were detected
ret_error=["E","TSTERR02: Proper voltage reading not obtained in ports: {} when output enable=1".format(port_err)]
print ret_error[1]
else:
if port_warnlow or port_warnhigh: # Some warning were generated
warn_msg=""
if port_warnlow:
warn_msg=warn_msg+"TSTWRN00: Strangely-low voltage value obtained in ports: {} when output=1. ".format(port_warnlow)
if port_warnhigh:
warn_msg=warn_msg+"TSTWRN01: Strangely-high voltage value obtained in ports: {} when output=0. ".format(port_warnhigh)
ret_error=["W",warn_msg]
else:
ret_error=None
return ret_error
""" Initialize the board, check PRESENT pin state and DAC presence and response """
self.dio = CFmcDio(spec, 0x80000, False, False, True) # Init I2C DAC device
def main(default_directory="."):
# Configure the FPGA using the program fpga_loader
......@@ -101,24 +44,30 @@ def main(default_directory="."):
print "Loading hardware access library and opening device\n"
spec = rr.Gennum()
print "Test Start03"
print "Test03 Start"
init_test_time = time.time()
print "Configuring and checking fmc-dio-5chttla devices"
test=test03(spec)
print "\nChecking input operation of board ports"
ret_error=test.test_port_in()
print "Checking fmc-dio-5chttla board presence and DAC (CDAC5578) operation"
try:
test=test03(spec)
except CFmcDioError as e:
test_error=e
print str(test_error)
else:
test_error=None
end_test_time = time.time()
print "\nEnd of Test03"
print "RESULT: [{}]".format("FAIL" if ret_error and ret_error[0]=="E" else ("OK with warnings" if ret_error and ret_error[0]=="W" else "OK"))
print "RESULT: [{}]".format("FAIL" if test_error else "OK")
print 'Test03 elapsed time: {:.2f} seconds'.format(end_test_time-init_test_time)
if ret_error:
if ret_error[0]=="W": # Warning message returned by test funciton
raise PtsWarning(ret_error[1])
else: # Error message returned by test funciton
raise PtsError(ret_error[1])
if test_error:
err_msg="While fmc-dio-5chttla initialization: "+str(test_error)
if test_error.bus_name == "FMC":
raise PtsCritical(err_msg) # Critical error: the fmc-dio-5chttl-board is apparently not present
else:
raise PtsError(err_msg) # Non-critical error: further tests could be performed successfully
if __name__ == "__main__":
main(".")
......
......@@ -6,31 +6,32 @@
# Licence: GPL v2 or later.
# Website: http://www.ohwr.org
# Website: http://www.sevensols.com
# Version: 0.2 (Last modifications: 1/4/2012)
# Version: 1.0 (Last modifications: 29/4/2012)
from ptsexcept import *
from dio_fmc import *
from keyb import *
import rr
import os
import sys
"""
test04: Check output-enable circuit of fmc-dio-5chttl-board ports
Conditions: fmc-dio-5chttl-board ports work as outputs (test02 passed), I2C bus works (test00 passed) and
fmc-dio-5chttl-board ports work as inputs (DAC, LVDS comparator) (test03 passed)
User intervention required: No
test01: Check fmc-dio-5chttl-board LEDs (LED and LED circuit working)
Conditions: Mezzanine presence line asserted (test00 passed)
User intervention required: Yes
Procedure details:
- Load firmware.
- Test mezzanine presence line.
- Check the voltage of all ports (by means of the internal DAC) when port output set to 1 and output enable set to 0
- Load firmware
- Test mezzanine presence line
- Blink fmc-dio-5chttl-board LEDs
"""
class test04:
def __init__(self, spec):
""" check FMC PRESENT-pin state """
try:
self.dio = CFmcDio(spec, 0x80000, True)
self.dio = CFmcDio(spec, 0x80000, False, False, False)
except CFmcDioError as e:
err_msg="While fmc-dio-5chttla initialization: "+str(e)
if e.bus_name == "FMC":
......@@ -38,45 +39,38 @@ class test04:
else:
raise PtsError(err_msg) # Non-critical error: further tests could be performed successfully
def test_port_oe(self):
""" Port (LEMO 00 connectors) output-enable check """
print "Ensure that nothing is connected to the fmc-dio-5chttla-board ports"
print "(Termination resistors disabled, port outputs disabled)"
port_th=[]
port_warnhigh=[]
for lemon in range(5):
self.dio.set_term(lemon, 1) # Enable termination resistor to accelerate port state change to 0
self.dio.set_dir(lemon,0) # Disable port output
self.dio.set_out(lemon,1) # set port output value to 1
self.dio.set_term(lemon, 0) # Disable termination resistor (when port output is stable)
try:
th0=self.dio.find_port_voltage(lemon,0.0,0.08) # Find the voltage (threshold)
except CFmcDioError as e:
print str(e)
raise PtsError("While setting CDAC5578 channel value: "+str(e))
self.dio.set_dir(lemon,0) # Disable port output
self.dio.set_out(lemon,0) # set port output value to 0
if th0>0.1:
th0_warn="Warning: Strangely-high value "
port_warnhigh.append(lemon)
else:
th0_warn="OK "
print "Port {} apparent input voltage: {:.3f}V {}".format(lemon,th0,th0_warn)
port_th.insert(lemon,th0)
port_err=[]
for lemon in range(len(port_th)):
if port_th[lemon]>0.8: # normal operating conditions
port_err.append(lemon)
if port_err: # Some errors were detected
ret_error=["E","TSTERR03: Proper voltage reading not obtained in ports: {} when output enable=0".format(port_err)]
print ret_error[1]
def test_LEDs(self):
""" LED-blink Check """
tmp_stdout = sys.stdout
sys.stdout = sys.__stdout__
tmp_stdin = sys.stdin
sys.stdin = sys.__stdin__
print "¿Are the two fmc-dio-5chttla-board LEDs blinking alternately?"
print "Press Y/N and Enter"
ans=""
while ans != "Y" and ans != "N":
for nled in range(2):
self.dio.set_led(nled,nled)
time.sleep(0.2)
for nled in range(2):
self.dio.set_led(nled,1-nled)
time.sleep(0.2)
if kbhit():
ans=raw_input().upper()
if ans <> "Y" and ans <> "N":
print "The valid inputs are only Y or N and Enter"
sys.stdout = tmp_stdout
sys.stdin = tmp_stdin
# purgestdin()
for nled in range(2):
self.dio.set_led(nled,0)
print "The user reported {} operation of board LEDs".format("a correct" if ans=="Y" else "an incorrect")
if ans == "N":
emsg="TSTERR00: Operation of fmc-dio-5chttla-board LEDs failed"
print emsg
else:
if port_warnhigh: # Some warning were generated
warn_msg="TSTWRN02: Strangely-high voltage value obtained in ports: {} when output enable=0".format(port_warnhigh)
ret_error=["W",warn_msg]
else:
ret_error=None
return ret_error
emsg=None # test completed successfully
return emsg
def main(default_directory="."):
# Configure the FPGA using the program fpga_loader
......@@ -93,22 +87,16 @@ def main(default_directory="."):
print "Test04 Start"
init_test_time = time.time()
print "Configuring and checking fmc-dio-5chttla devices"
print "Checking fmc-dio-5chttla board presence"
test=test04(spec)
print "\nChecking output-enable circuits of board ports"
ret_error=test.test_port_oe()
print "\nChecking LEDs"
emsg=test.test_LEDs()
end_test_time = time.time()
print "\nEnd of Test04"
print "RESULT: [{}]".format("FAIL" if ret_error and ret_error[0]=="E" else ("OK with warnings" if ret_error and ret_error[0]=="W" else "OK"))
print 'Test04 elapsed time: {:.2f} seconds'.format(end_test_time-init_test_time)
if ret_error:
if ret_error[0]=="W": # Warning message returned by test funciton
raise PtsWarning(ret_error[1])
else: # Error message returned by test funciton
raise PtsError(ret_error[1])
print "RESULT: [{}]".format("FAIL" if emsg else "OK")
if emsg:
raise PtsError(emsg)
if __name__ == "__main__":
main(".")
......
This diff is collapsed.
#!/usr/bin/python
#coding: utf8
# Copyright CERN, 2012 (Seven Solutions S.L.)
# Author: Richard Carrillo <rcarrillo(AT)sevensols.com>
# Licence: GPL v2 or later.
# Website: http://www.ohwr.org
# Website: http://www.sevensols.com
# Version: 1.0 (Last modifications: 29/4/2012)
from ptsexcept import *
from dio_fmc import *
import rr
import os
"""
test06: Check fmc-dio-5chttl-board ports as inputs (DAC, LVDS comparator)
Conditions: fmc-dio-5chttl-board ports work as outputs (test05 passed) and DAC works (test03 passed)
User intervention required: No
Procedure details:
- Load firmware.
- Test mezzanine presence line.
- Check the voltage of all ports (by means of the internal DAC) when port output set to 0 and when it is set to 1
"""
class test06:
def __init__(self, spec):
""" check FMC PRESENT-pin state """
try:
self.dio = CFmcDio(spec, 0x80000, False, False, True)
except CFmcDioError as e:
err_msg="While fmc-dio-5chttla initialization: "+str(e)
if e.bus_name == "FMC":
raise PtsCritical(err_msg) # Critical error: the fmc-dio-5chttl-board is apparently not present
else:
raise PtsError(err_msg) # Non-critical error: further tests could be performed successfully
def test_port_in(self):
""" Port (LEMO 00 connectors) input check """
print "Ensure that nothing is connected to the fmc-dio-5chttla-board ports"
print "(Termination resistors disabled, port outputs enabled)"
port_th=[]
port_warnlow=[]
port_warnhigh=[]
for lemon in range(5):
self.dio.set_term(lemon, 0) # Disable termination resistor
self.dio.set_out(lemon,0) # set port output value to 0
self.dio.set_dir(lemon,1) # Enable port output
try:
th0=self.dio.find_port_voltage(lemon,0.0,0.08) # Find the voltage (threshold) when out=0
self.dio.set_out(lemon,1) # set port output state to 1
th1=self.dio.find_port_voltage(lemon,3.28,3.3) # Find the voltage (threshold) when out=1
except CFmcDioError as e:
print str(e)
raise PtsError("While setting CDAC5578 channel value: "+str(e))
self.dio.set_dir(lemon,0) # Disable port output
if th0>0.1:
th0_warn="Warning: Strangely-high value "
port_warnhigh.append(lemon)
else:
th0_warn="OK "
if th1<3.2:
th1_warn="Warning: Strangely-low value "
port_warnlow.append(lemon)
else:
th1_warn="OK"
print "Port {} apparent input voltage when out=0: {:.3f}V {}".format(lemon,th0,th0_warn)
print "\t\t\t when out=1: {:.3f}V {}".format(th1,th1_warn)
port_th.insert(lemon,[th0,th1])
port_err=[]
for lemon in range(len(port_th)):
if port_th[lemon][0]>0.8 or port_th[lemon][1]<2.0: # normal operating conditions
port_err.append(lemon)
if port_err: # Some errors were detected
ret_error=["E","TSTERR02: Proper voltage reading not obtained in ports: {} when output enable=1".format(port_err)]
print ret_error[1]
else:
if port_warnlow or port_warnhigh: # Some warning were generated
warn_msg=""
if port_warnlow:
warn_msg=warn_msg+"TSTWRN00: Strangely-low voltage value obtained in ports: {} when output=1. ".format(port_warnlow)
if port_warnhigh:
warn_msg=warn_msg+"TSTWRN01: Strangely-high voltage value obtained in ports: {} when output=0. ".format(port_warnhigh)
ret_error=["W",warn_msg]
else:
ret_error=None
return ret_error
def main(default_directory="."):
# Configure the FPGA using the program fpga_loader
path_fpga_loader = '../firmwares/fpga_loader'
path_firmware = '../firmwares/spec_top.bin'
firmware_loader = os.path.join(default_directory, path_fpga_loader)
bitstream = os.path.join(default_directory, path_firmware)
print "Loading firmware: %s" % (firmware_loader + ' ' + bitstream)
os.system( firmware_loader + ' ' + bitstream )
# Load board library and open the corresponding device
print "Loading hardware access library and opening device\n"
spec = rr.Gennum()
print "Test Start06"
init_test_time = time.time()
print "Configuring and checking fmc-dio-5chttla devices"
test=test06(spec)
print "\nChecking input operation of board ports"
ret_error=test.test_port_in()
end_test_time = time.time()
print "\nEnd of Test06"
print "RESULT: [{}]".format("FAIL" if ret_error and ret_error[0]=="E" else ("OK with warnings" if ret_error and ret_error[0]=="W" else "OK"))
print 'Test06 elapsed time: {:.2f} seconds'.format(end_test_time-init_test_time)
if ret_error:
if ret_error[0]=="W": # Warning message returned by test funciton
raise PtsWarning(ret_error[1])
else: # Error message returned by test funciton
raise PtsError(ret_error[1])
if __name__ == "__main__":
main(".")
#!/usr/bin/python
#coding: utf8
# Copyright CERN, 2012 (Seven Solutions S.L.)
# Author: Richard Carrillo <rcarrillo(AT)sevensols.com>
# Licence: GPL v2 or later.
# Website: http://www.ohwr.org
# Website: http://www.sevensols.com
# Version: 1.0 (Last modifications: 29/4/2012)
from ptsexcept import *
from dio_fmc import *
import rr
import os
"""
test07: Check output-enable circuit of fmc-dio-5chttl-board ports
Conditions: fmc-dio-5chttl-board ports work as outputs (test05 passed), DAC works (test03 passed) and fmc-dio-5chttl-board ports work as inputs (DAC, LVDS comparator) (test06 passed)
User intervention required: No
Procedure details:
- Load firmware.
- Test mezzanine presence line.
- Check the voltage of all ports (by means of the internal DAC) when port output set to 1 and output enable set to 0
"""
class test07:
def __init__(self, spec):
""" check FMC PRESENT-pin state """
try:
self.dio = CFmcDio(spec, 0x80000, False, False, True)
except CFmcDioError as e:
err_msg="While fmc-dio-5chttla initialization: "+str(e)
if e.bus_name == "FMC":
raise PtsCritical(err_msg) # Critical error: the fmc-dio-5chttl-board is apparently not present
else:
raise PtsError(err_msg) # Non-critical error: further tests could be performed successfully
def test_port_oe(self):
""" Port (LEMO 00 connectors) output-enable check """
print "Ensure that nothing is connected to the fmc-dio-5chttla-board ports"
print "(Termination resistors disabled, port outputs disabled)"
port_th=[]
port_warnhigh=[]
for lemon in range(5):
self.dio.set_term(lemon, 1) # Enable termination resistor to accelerate port state change to 0
self.dio.set_dir(lemon,0) # Disable port output
self.dio.set_out(lemon,1) # set port output value to 1
self.dio.set_term(lemon, 0) # Disable termination resistor (when port output is stable)
try:
th0=self.dio.find_port_voltage(lemon,0.0,0.08) # Find the voltage (threshold)
except CFmcDioError as e:
print str(e)
raise PtsError("While setting CDAC5578 channel value: "+str(e))
self.dio.set_dir(lemon,0) # Disable port output
self.dio.set_out(lemon,0) # set port output value to 0
if th0>0.1:
th0_warn="Warning: Strangely-high value "
port_warnhigh.append(lemon)
else:
th0_warn="OK "
print "Port {} apparent input voltage: {:.3f}V {}".format(lemon,th0,th0_warn)
port_th.insert(lemon,th0)
port_err=[]
for lemon in range(len(port_th)):
if port_th[lemon]>0.8: # normal operating conditions
port_err.append(lemon)
if port_err: # Some errors were detected
ret_error=["E","TSTERR03: Proper voltage reading not obtained in ports: {} when output enable=0".format(port_err)]
print ret_error[1]
else:
if port_warnhigh: # Some warning were generated
warn_msg="TSTWRN02: Strangely-high voltage value obtained in ports: {} when output enable=0".format(port_warnhigh)
ret_error=["W",warn_msg]
else:
ret_error=None
return ret_error
def main(default_directory="."):
# Configure the FPGA using the program fpga_loader
path_fpga_loader = '../firmwares/fpga_loader'
path_firmware = '../firmwares/spec_top.bin'
firmware_loader = os.path.join(default_directory, path_fpga_loader)
bitstream = os.path.join(default_directory, path_firmware)
print "Loading firmware: %s" % (firmware_loader + ' ' + bitstream)
os.system( firmware_loader + ' ' + bitstream )
# Load board library and open the corresponding device
print "Loading hardware access library and opening device\n"
spec = rr.Gennum()
print "Test07 Start"
init_test_time = time.time()
print "Configuring and checking fmc-dio-5chttla devices"
test=test07(spec)
print "\nChecking output-enable circuits of board ports"
ret_error=test.test_port_oe()
end_test_time = time.time()
print "\nEnd of Test07"
print "RESULT: [{}]".format("FAIL" if ret_error and ret_error[0]=="E" else ("OK with warnings" if ret_error and ret_error[0]=="W" else "OK"))
print 'Test07 elapsed time: {:.2f} seconds'.format(end_test_time-init_test_time)
if ret_error:
if ret_error[0]=="W": # Warning message returned by test funciton
raise PtsWarning(ret_error[1])
else: # Error message returned by test funciton
raise PtsError(ret_error[1])
if __name__ == "__main__":
main(".")
#!/usr/bin/python
#coding: utf8
# Copyright CERN, 2012 (Seven Solutions S.L.)
# Author: Richard Carrillo <rcarrillo(AT)sevensols.com>
# Licence: GPL v2 or later.
# Website: http://www.ohwr.org
# Website: http://www.sevensols.com
# Version: 1.0 (Last modifications: 29/4/2012)
from ptsexcept import *
from dio_fmc import *
import rr
import os
"""
test08: Check termination resistors of fmc-dio-5chttl-board ports
Conditions: fmc-dio-5chttl-board ports work as outputs (test05 passed), DAC works (test03 passed) and fmc-dio-5chttl-board ports work as inputs (DAC, LVDS comparator) (test06 passed)
User intervention required: No
Procedure details:
- Load firmware.
- Test mezzanine presence line.
- Check the voltage of all ports (by means of the internal DAC) when port output set to 1, output enable set to 0 and termination resistor enabled
"""
class test08:
def __init__(self, spec):
""" check FMC PRESENT-pin state """
try:
self.dio = CFmcDio(spec, 0x80000, False, False, True)
except CFmcDioError as e:
err_msg="While fmc-dio-5chttla initialization: "+str(e)
if e.bus_name == "FMC":
raise PtsCritical(err_msg) # Critical error: the fmc-dio-5chttl-board is apparently not present
else:
raise PtsError(err_msg) # Non-critical error: further tests could be performed successfully
def test_port_term(self):
""" Port (LEMO 00 connectors) termination-resistor enable check """
print "Ensure that nothing is connected to the fmc-dio-5chttla-board ports"
print "(Termination resistors enabled, port outputs enabled)"
port_th=[]
port_warnlow=[]
port_warnhigh=[]
for lemon in range(5):
self.dio.set_term(lemon, 1) # Enable termination resistor
self.dio.set_dir(lemon,1) # Enable port output
self.dio.set_out(lemon,1) # Set port output value to 1
try:
th1=self.dio.find_port_voltage(lemon,2.95,3.02) # Find the voltage (threshold)
except CFmcDioError as e:
raise PtsError("While setting CDAC5578 channel value: "+str(e))
self.dio.set_dir(lemon,0) # Disable port output
self.dio.set_out(lemon,0) # Set port output value to 0
self.dio.set_term(lemon, 0) # Disable termination resistor
if th1>3.1:
th1_warn="Warning: Strangely-high value "
port_warnhigh.append(lemon)
elif th1<2.9:
th1_warn="Warning: Strangely-low value "
port_warnlow.append(lemon)
else:
th1_warn="OK"
print "Port {} apparent input voltage: {:.3f}V {}".format(lemon,th1,th1_warn)
port_th.insert(lemon,th1)
port_err=[]
for lemon in range(len(port_th)):
if port_th[lemon]>3.2 or port_th[lemon]<2.8: # normal operating conditions
port_err.append(lemon)
if port_err: # Some errors were detected
ret_error=["E","TSTERR04: Proper voltage reading not obtained in ports: {} when termination resistors enabled".format(port_err)]
print ret_error[1]
else:
if port_warnlow or port_warnhigh: # Some warning were generated
warn_msg=""
if port_warnlow:
warn_msg=warn_msg+"TSTWRN03: Strangely-low voltage value obtained in ports: {} when termination resistors enabled. ".format(port_warnlow)
if port_warnhigh:
warn_msg=warn_msg+"TSTWRN04: Strangely-high voltage value obtained in ports: {} when termination resistors enabled. ".format(port_warnhigh)
ret_error=["W",warn_msg]
else:
ret_error=None
return ret_error
def main(default_directory="."):
# Configure the FPGA using the program fpga_loader
path_fpga_loader = '../firmwares/fpga_loader'
path_firmware = '../firmwares/spec_top.bin'
firmware_loader = os.path.join(default_directory, path_fpga_loader)
bitstream = os.path.join(default_directory, path_firmware)
print "Loading firmware: %s" % (firmware_loader + ' ' + bitstream)
os.system( firmware_loader + ' ' + bitstream )
# Load board library and open the corresponding device
print "Loading hardware access library and opening device\n"
spec = rr.Gennum()
print "Test08 Start"
init_test_time = time.time()
print "Configuring and checking fmc-dio-5chttla devices"
test=test08(spec)
print "\nChecking output-enable circuits of board ports"
ret_error=test.test_port_term()
end_test_time = time.time()
print "\nEnd of Test08"
print "RESULT: [{}]".format("FAIL" if ret_error and ret_error[0]=="E" else ("OK with warnings" if ret_error and ret_error[0]=="W" else "OK"))
print 'Test08 elapsed time: {:.2f} seconds'.format(end_test_time-init_test_time)
if ret_error:
if ret_error[0]=="W": # Warning message returned by test funciton
raise PtsWarning(ret_error[1])
else: # Error message returned by test funciton
raise PtsError(ret_error[1])
if __name__ == "__main__":
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