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 @@ ...@@ -5,7 +5,7 @@
# Licence: GPL v2 or later. # Licence: GPL v2 or later.
# Website: http://www.ohwr.org # Website: http://www.ohwr.org
# Website: http://www.sevensols.com # Website: http://www.sevensols.com
# Version: 0.2 (Last modifications: 26/4/2012) # Version: 1.0 (Last modifications: 29/4/2012)
LOGDIR=./log_fmcdio5chttla LOGDIR=./log_fmcdio5chttla
...@@ -49,7 +49,7 @@ do ...@@ -49,7 +49,7 @@ do
echo "Test series run $nb_test out of $nb_test_limit" echo "Test series run $nb_test out of $nb_test_limit"
echo " " 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" ] if [ "$nb_test" != "$nb_test_limit" ]
then then
......
...@@ -9,16 +9,19 @@ Author: Richard R. Carrillo <rcarrillo(AT)sevensols.com> ...@@ -9,16 +9,19 @@ Author: Richard R. Carrillo <rcarrillo(AT)sevensols.com>
Licence: GPL v2 or later. Licence: GPL v2 or later.
Website: http://www.ohwr.org Website: http://www.ohwr.org
Website: http://www.sevensols.com Website: http://www.sevensols.com
Last modifications: 1/4/2012 Version 1.0 (Last modifications: 29/4/2012)
This batch of tests makes a connectivity test of the FmcDIO5chTTLa's components. This batch of tests makes a connectivity and operation test of the FmcDIO5chTTLa's components.
- test00: Check fmc-dio-5chttl board EEPROM and DAC presence and temperature-sensor operation - test00: Check fmc-dio-5chttl-board presence (Mezzanine presence line working)
- test01: Check fmc-dio-5chttl-board LEDs (LEDs and LED circuit working) - test01: Check fmc-dio-5chttl-board digital thermometer operation (termperature and unique ID acquisition working)
- test02: Check fmc-dio-5chttl-board ports as output (port driver working, connector connectivity and LVDS to LVCMOS IC working) - test02: Check fmc-dio-5chttl-board EEPROM presence and operation (read and write operations working)
- test03: Check fmc-dio-5chttl-board ports as inputs (DAC and LVDS comparator working) - test03: Check fmc-dio-5chttl-board DAC presence operation (DAC initialization)
- test04: Check output-enable circuit of fmc-dio-5chttl-board ports - test04: Check fmc-dio-5chttl-board LEDs (LEDs and LED circuit working)
- test05: Check termination resistors of fmc-dio-5chttl-board ports - 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' 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 @@ ...@@ -5,7 +5,7 @@
# Licence: GPL v2 or later. # Licence: GPL v2 or later.
# Website: http://www.ohwr.org # Website: http://www.ohwr.org
# Website: http://www.sevensols.com # Website: http://www.sevensols.com
# Last modifications: 1/4/2012 # Version 1.0 (last modifications: 29/4/2012)
import rr import rr
import struct import struct
...@@ -54,46 +54,58 @@ class CFmcDio: ...@@ -54,46 +54,58 @@ class CFmcDio:
DAC_CHANNEL_CORRESP=[0,1,2,7,4,5] 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. """ fmc-dio-5chttla-board presence check, I2C devices response check and OneWire-device funct. init.
bus = host bus (PCIe, VME, etc...) bus = host bus (PCIe, VME, etc...)
base = base address 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.bus = bus
self.base = base self.base = base
self.gpio = CGPIO(bus, base + self.BASE_GPIO) self.gpio = CGPIO(bus, base + self.BASE_GPIO)
if(not self.fmc_present()): if(not self.fmc_present()):
raise CFmcDioError("FMC", base, "DIOERR00: PRESENT line is not asserted") 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: try:
self.i2c = COpenCoresI2C(bus, base + self.BASE_I2C, self.I2C_PRESCALER) 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() found_I2C_periph_addr=self.i2c.scan()
except I2CDeviceOperationError as e: 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: if not found_I2C_periph_addr:
raise CFmcDioError("I2C", base, "DIOERR02: No I2C device found") raise CFmcDioError("I2C", base, "DIOERR02: No I2C device found")
for periph_addr in board_I2C_periph_addr: for periph_addr in board_I2C_periph_addr:
if periph_addr not in found_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") raise CFmcDioError("I2C", periph_addr, "DIOERR03: Device not found. Only "+str(len(found_I2C_periph_addr))+" I2C devices found")
try: if init_eeprom:
self.eeprom = C24AA64(self.i2c, self.I2C_ADDR_EEPROM); try:
except I2CDeviceOperationError as e: self.eeprom = C24AA64(self.i2c, self.I2C_ADDR_EEPROM)
raise CFmcDioError("I2C", self.I2C_ADDR_EEPROM, "DIOERR04: "+e.msg) except I2CDeviceOperationError as e:
raise CFmcDioError("I2C", self.I2C_ADDR_EEPROM, "DIOERR04: Initializing: "+e.msg)
try: else:
self.dac = CDAC5578(self.i2c, self.I2C_ADDR_DAC); self.eeprom=None
except I2CDeviceOperationError as e: if init_dac:
raise CFmcDioError("I2C", self.I2C_ADDR_DAC, "DIOERR05: "+e.msg) try:
self.dac = CDAC5578(self.i2c, self.I2C_ADDR_DAC);
self.onewire = COpenCoresOneWire(self.bus, base + self.BASE_ONEWIRE, 624/2, 124/2) except I2CDeviceOperationError as e:
self.ds1820 = CDS18B20(self.onewire, 0); raise CFmcDioError("I2C", self.I2C_ADDR_DAC, "DIOERR05: Initializing: "+e.msg)
else:
self.dac=None
else: else:
self.i2c=None self.i2c=None
self.onewire=None
self.dac=None self.dac=None
self.eeprom=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 self.ds1820=None
def fmc_present(self): def fmc_present(self):
...@@ -139,9 +151,9 @@ class CFmcDio: ...@@ -139,9 +151,9 @@ class CFmcDio:
try: try:
self.dac.out(self.DAC_CHANNEL_CORRESP[port], threshold) self.dac.out(self.DAC_CHANNEL_CORRESP[port], threshold)
except I2CDeviceOperationError as e: 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: 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): def get_in_threshold(self, port):
""" Returns the DAC value set in a specified channel (port) """ """ Returns the DAC value set in a specified channel (port) """
...@@ -149,10 +161,10 @@ class CFmcDio: ...@@ -149,10 +161,10 @@ class CFmcDio:
try: try:
dacval=self.dac.rd_out(self.DAC_CHANNEL_CORRESP[port]) dacval=self.dac.rd_out(self.DAC_CHANNEL_CORRESP[port])
except I2CDeviceOperationError as e: 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) return(dacval)
else: 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): def DACvalue2voltage(self, dacval):
""" Calculate the voltage corresponding to a specific DAC channel digital value """ """ Calculate the voltage corresponding to a specific DAC channel digital value """
...@@ -207,9 +219,9 @@ class CFmcDio: ...@@ -207,9 +219,9 @@ class CFmcDio:
try: try:
return self.ds1820.read_serial_number() return self.ds1820.read_serial_number()
except OneWireDeviceOperationError as e: except OneWireDeviceOperationError as e:
raise CFmcDioError("OneWire", self.base, "DIOERR09: "+e.msg) raise CFmcDioError("OneWire", 0, "DIOERR09: Getting unique ID: "+e.msg)
else: else:
raise CFmcDioError("OneWire", self.base, "DIOERR10: Device not initialized") raise CFmcDioError("OneWire", 0, "DIOERR10: Device not initialized")
def get_temp(self): def get_temp(self):
""" Returns a temperature value in Celsius degrees by means of the OneWire IC DS1820 """ """ Returns a temperature value in Celsius degrees by means of the OneWire IC DS1820 """
...@@ -218,11 +230,30 @@ class CFmcDio: ...@@ -218,11 +230,30 @@ class CFmcDio:
serial_number = self.ds1820.read_serial_number() serial_number = self.ds1820.read_serial_number()
temp=self.ds1820.read_temp(serial_number) temp=self.ds1820.read_temp(serial_number)
except OneWireDeviceOperationError as e: except OneWireDeviceOperationError as e:
raise CFmcDioError("OneWire", self.base, "DIOERR11: "+e.msg) raise CFmcDioError("OneWire", 0, "DIOERR11: Getting temperature: "+e.msg)
return temp return temp
else: 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() #spec = rr.Gennum()
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
# Licence: GPL v2 or later. # Licence: GPL v2 or later.
# Website: http://www.ohwr.org # Website: http://www.ohwr.org
# Website: http://www.sevensols.com # 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 ptsexcept import *
from dio_fmc import * from dio_fmc import *
...@@ -17,49 +17,18 @@ import os ...@@ -17,49 +17,18 @@ import os
""" """
test00: Check fmc-dio-5chttl-board EEPROM and DAC presence and temperature-sensor operation test00: Check fmc-dio-5chttl-board presence
Conditions: I2C bus and OneWire bus work Conditions: None
User intervention required: No User intervention required: No
Procedure details: Procedure details:
- Load firmware - Load firmware
- Test mezzanine presence line. - 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: class test00:
def __init__(self, spec): def __init__(self, spec):
""" Initialize the board, check PRESENT pin state and look for I2C devices """ """ Initialize the board, check PRESENT pin state """
try: self.dio = CFmcDio(spec, 0x80000, False, False, False) # Do not init any I2C or OneWire device
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
def main(default_directory="."): def main(default_directory="."):
# Configure the FPGA using the program fpga_loader # Configure the FPGA using the program fpga_loader
...@@ -77,22 +46,26 @@ def main(default_directory="."): ...@@ -77,22 +46,26 @@ def main(default_directory="."):
print "Test00 Start" print "Test00 Start"
init_test_time = time.time() init_test_time = time.time()
print "Configuring and checking fmc-dio-5chttla devices" print "Checking fmc-dio-5chttla board presence"
test=test00(spec) try:
print "\nChecking temperature acquisition I.C. (DS18B20)" test=test00(spec)
ret_error=test.test_temp() except CFmcDioError as e:
test_error=e
print str(test_error)
else:
test_error=None
end_test_time = time.time() end_test_time = time.time()
print "\nEnd of Test00" 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__": if __name__ == "__main__":
main(".") main(".")
......
...@@ -2,36 +2,38 @@ ...@@ -2,36 +2,38 @@
#coding: utf8 #coding: utf8
# Copyright CERN, 2012 (Seven Solutions S.L.) # Copyright CERN, 2012 (Seven Solutions S.L.)
# Author: Tomasz?
# Author: Richard Carrillo <rcarrillo(AT)sevensols.com> # Author: Richard Carrillo <rcarrillo(AT)sevensols.com>
# Licence: GPL v2 or later. # Licence: GPL v2 or later.
# Website: http://www.ohwr.org # Website: http://www.ohwr.org
# Website: http://www.sevensols.com # 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 ptsexcept import *
from dio_fmc import * from dio_fmc import *
from keyb import *
import rr import rr
import os import os
import sys
""" """
test01: Check fmc-dio-5chttl-board LEDs (LED and LED circuit working) test01: Check fmc-dio-5chttl-board digital thermometer operation
Conditions: None Conditions: Mezzanine presence line asserted (test00 passed)
User intervention required: Yes User intervention required: No
Procedure details: Procedure details:
- Load firmware - Load firmware
- Test mezzanine presence line - Test mezzanine presence line.
- Blink fmc-dio-5chttl-board LEDs - 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: class test01:
def __init__(self, spec): def __init__(self, spec):
""" check FMC PRESENT-pin state """ """ Initialize the board and check PRESENT pin state """
try: try:
self.dio = CFmcDio(spec, 0x80000, False) self.dio = CFmcDio(spec, 0x80000, True, False, False) # Init only the OneWire device
except CFmcDioError as e: except CFmcDioError as e:
err_msg="While fmc-dio-5chttla initialization: "+str(e) err_msg="While fmc-dio-5chttla initialization: "+str(e)
if e.bus_name == "FMC": if e.bus_name == "FMC":
...@@ -39,38 +41,24 @@ class test01: ...@@ -39,38 +41,24 @@ class test01:
else: else:
raise PtsError(err_msg) # Non-critical error: further tests could be performed successfully raise PtsError(err_msg) # Non-critical error: further tests could be performed successfully
def test_LEDs(self): def test_temp(self):
""" LED-blink Check """ """ Check OneWire device response correctly and check temperature acquisition """
tmp_stdout = sys.stdout try:
sys.stdout = sys.__stdout__ print " chip lasered code: {:x}".format(self.dio.get_unique_id())
tmp_stdin = sys.stdin except CFmcDioError as e:
sys.stdin = sys.__stdin__ print str(e)
print "¿Are the two fmc-dio-5chttla-board LEDs blinking alternately?" ret_error=["E","While getting DS18B20 I.C. unique ID: "+str(e)]
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: else:
emsg=None # test completed successfully try:
return emsg 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="."): def main(default_directory="."):
# Configure the FPGA using the program fpga_loader # Configure the FPGA using the program fpga_loader
...@@ -87,16 +75,23 @@ def main(default_directory="."): ...@@ -87,16 +75,23 @@ def main(default_directory="."):
print "Test01 Start" 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) test=test01(spec)
print "\nChecking temperature acquisition I.C. (DS18B20)"
ret_error=test.test_temp()
print "\nChecking LEDs" end_test_time = time.time()
emsg=test.test_LEDs()
print "\nEnd of Test01" print "\nEnd of Test01"
print "RESULT: [{}]".format("FAIL" if emsg else "OK") 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"))
if emsg: print 'Test01 elapsed time: {:.2f} seconds'.format(end_test_time-init_test_time)
raise PtsError(emsg)
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__": if __name__ == "__main__":
main(".") main(".")
......
...@@ -2,37 +2,37 @@ ...@@ -2,37 +2,37 @@
#coding: utf8 #coding: utf8
# Copyright CERN, 2012 (Seven Solutions S.L.) # Copyright CERN, 2012 (Seven Solutions S.L.)
# Author: Tomasz?
# Author: Richard Carrillo <rcarrillo(AT)sevensols.com> # Author: Richard Carrillo <rcarrillo(AT)sevensols.com>
# Licence: GPL v2 or later. # Licence: GPL v2 or later.
# Website: http://www.ohwr.org # Website: http://www.ohwr.org
# Website: http://www.sevensols.com # 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 ptsexcept import *
from dio_fmc import * from dio_fmc import *
from keyb import *
import rr import rr
import os import os
""" """
test02: Check fmc-dio-5chttl-board ports as output (port driver working, connector connectivity and LVDS to LVCMOS IC working) test02: Check fmc-dio-5chttl-board EEPROM presence and operation
Conditions: fmc-dio-5chttl-board presence line working Conditions: Mezzanine presence line asserted
User intervention required: Yes* User intervention required: No
Procedure details: Procedure details:
- Load firmware. - Load firmware
- Test mezzanine presence line. - Test mezzanine presence line.
- Check that ports work as output - Initialize the board
- Using the port interconnection cables: Check that all ports are interconnected. - Check that I2C device EEPROM (24AA64T) is present
- If all the communications fail: Using the test cable: Oscillate state of fmc-dio-5chttl-board ports - Check writing and reading operation of EEPROM
""" """
class test02: class test02:
def __init__(self, spec): def __init__(self, spec):
""" check FMC PRESENT-pin state """ """ Initialize the board, check PRESENT pin state and look for I2C devices """
try: try:
self.dio = CFmcDio(spec, 0x80000, True) self.dio = CFmcDio(spec, 0x80000, False, True, False) # Init EEPROM I2C device
except CFmcDioError as e: except CFmcDioError as e:
err_msg="While fmc-dio-5chttla initialization: "+str(e) err_msg="While fmc-dio-5chttla initialization: "+str(e)
if e.bus_name == "FMC": if e.bus_name == "FMC":
...@@ -40,128 +40,34 @@ class test02: ...@@ -40,128 +40,34 @@ class test02:
else: else:
raise PtsError(err_msg) # Non-critical error: further tests could be performed successfully raise PtsError(err_msg) # Non-critical error: further tests could be performed successfully
def osc_ports(self): def test_eeprom(self):
""" Oscillate state of fmc-dio-5chttl-board ports """ """ Check EEPROM I.C. operation """
for lemon in range(5): # Disable output of all ports and set them to 1
self.dio.set_dir(lemon,0) wr_pattern_length=8 # length of the testing byte pattern
self.dio.set_out(lemon,1) wr_pattern_addr=20 # address at which the pattern is written
ans="" wr_pattern=list() # List of patterns to verify
lemon=0 wr_pattern.append([0xFF for n in range(wr_pattern_length)]) # first testing pattern
while ans != "Y" and ans != "N": wr_pattern.append([2**n for n in range(wr_pattern_length)]) # second testing pattern
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
try: 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: except CFmcDioError as e:
print str(e) print str(e)
raise PtsError("While setting CDAC5578 channel value: "+str(e)) ret_error="While verifying operation of EEPROM (24AA64T): "+str(e)
time.sleep(0.010) # wait for the DAC output to stabilize return ret_error
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
def main(default_directory="."): def main(default_directory="."):
# Configure the FPGA using the program fpga_loader # Configure the FPGA using the program fpga_loader
...@@ -176,18 +82,22 @@ def main(default_directory="."): ...@@ -176,18 +82,22 @@ def main(default_directory="."):
print "Loading hardware access library and opening device\n" print "Loading hardware access library and opening device\n"
spec = rr.Gennum() 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) test=test02(spec)
print "\nChecking EEPROM I.C. writing and reading operation (24AA64T)"
ret_error=test.test_eeprom()
print "\nChecking connectivity of board ports" end_test_time = time.time()
emsg=test.test_port_inter()
print "\nEnd of Test02" print "\nEnd of Test02"
print "RESULT: [{}]".format("FAIL" if emsg else "OK") print "RESULT: [{}]".format("FAIL" if ret_error else "OK")
if emsg: print 'Test02 elapsed time: {:.2f} seconds'.format(end_test_time-init_test_time)
raise PtsError(emsg)
if ret_error:
raise PtsError(ret_error)
if __name__ == "__main__": if __name__ == "__main__":
main(".") main(".")
......
...@@ -6,8 +6,7 @@ ...@@ -6,8 +6,7 @@
# Licence: GPL v2 or later. # Licence: GPL v2 or later.
# Website: http://www.ohwr.org # Website: http://www.ohwr.org
# Website: http://www.sevensols.com # 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 ptsexcept import *
from dio_fmc import * from dio_fmc import *
...@@ -15,78 +14,22 @@ from dio_fmc import * ...@@ -15,78 +14,22 @@ from dio_fmc import *
import rr import rr
import os import os
""" """
test03: Check fmc-dio-5chttl-board ports as inputs (DAC, LVDS comparator) test03: Check fmc-dio-5chttl-board DAC presence operation
Conditions: fmc-dio-5chttl-board ports work as outputs (test02 passed) and I2C bus works (test00 passed) Conditions: Mezzanine presence line asserted (test00 passed)
User intervention required: No User intervention required: No
Procedure details: Procedure details:
- Load firmware. - Load firmware
- Test mezzanine presence line. - 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: class test03:
def __init__(self, spec): def __init__(self, spec):
""" check FMC PRESENT-pin state """ """ Initialize the board, check PRESENT pin state and DAC presence and response """
try: self.dio = CFmcDio(spec, 0x80000, False, False, True) # Init I2C DAC device
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
def main(default_directory="."): def main(default_directory="."):
# Configure the FPGA using the program fpga_loader # Configure the FPGA using the program fpga_loader
...@@ -101,24 +44,30 @@ def main(default_directory="."): ...@@ -101,24 +44,30 @@ def main(default_directory="."):
print "Loading hardware access library and opening device\n" print "Loading hardware access library and opening device\n"
spec = rr.Gennum() spec = rr.Gennum()
print "Test Start03" print "Test03 Start"
init_test_time = time.time() init_test_time = time.time()
print "Configuring and checking fmc-dio-5chttla devices" print "Checking fmc-dio-5chttla board presence and DAC (CDAC5578) operation"
test=test03(spec) try:
test=test03(spec)
print "\nChecking input operation of board ports" except CFmcDioError as e:
ret_error=test.test_port_in() test_error=e
print str(test_error)
else:
test_error=None
end_test_time = time.time() end_test_time = time.time()
print "\nEnd of Test03" 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) 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 if test_error:
raise PtsWarning(ret_error[1]) err_msg="While fmc-dio-5chttla initialization: "+str(test_error)
else: # Error message returned by test funciton if test_error.bus_name == "FMC":
raise PtsError(ret_error[1]) 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__": if __name__ == "__main__":
main(".") main(".")
......
...@@ -6,31 +6,32 @@ ...@@ -6,31 +6,32 @@
# Licence: GPL v2 or later. # Licence: GPL v2 or later.
# Website: http://www.ohwr.org # Website: http://www.ohwr.org
# Website: http://www.sevensols.com # 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 ptsexcept import *
from dio_fmc import * from dio_fmc import *
from keyb import *
import rr import rr
import os import os
import sys
""" """
test04: Check output-enable circuit of fmc-dio-5chttl-board ports test01: Check fmc-dio-5chttl-board LEDs (LED and LED circuit working)
Conditions: fmc-dio-5chttl-board ports work as outputs (test02 passed), I2C bus works (test00 passed) and Conditions: Mezzanine presence line asserted (test00 passed)
fmc-dio-5chttl-board ports work as inputs (DAC, LVDS comparator) (test03 passed) User intervention required: Yes
User intervention required: No
Procedure details: Procedure details:
- Load firmware. - Load firmware
- Test mezzanine presence line. - 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 - Blink fmc-dio-5chttl-board LEDs
""" """
class test04: class test04:
def __init__(self, spec): def __init__(self, spec):
""" check FMC PRESENT-pin state """ """ check FMC PRESENT-pin state """
try: try:
self.dio = CFmcDio(spec, 0x80000, True) self.dio = CFmcDio(spec, 0x80000, False, False, False)
except CFmcDioError as e: except CFmcDioError as e:
err_msg="While fmc-dio-5chttla initialization: "+str(e) err_msg="While fmc-dio-5chttla initialization: "+str(e)
if e.bus_name == "FMC": if e.bus_name == "FMC":
...@@ -38,45 +39,38 @@ class test04: ...@@ -38,45 +39,38 @@ class test04:
else: else:
raise PtsError(err_msg) # Non-critical error: further tests could be performed successfully raise PtsError(err_msg) # Non-critical error: further tests could be performed successfully
def test_port_oe(self): def test_LEDs(self):
""" Port (LEMO 00 connectors) output-enable check """ """ LED-blink Check """
print "Ensure that nothing is connected to the fmc-dio-5chttla-board ports" tmp_stdout = sys.stdout
print "(Termination resistors disabled, port outputs disabled)" sys.stdout = sys.__stdout__
port_th=[] tmp_stdin = sys.stdin
port_warnhigh=[] sys.stdin = sys.__stdin__
for lemon in range(5): print "¿Are the two fmc-dio-5chttla-board LEDs blinking alternately?"
self.dio.set_term(lemon, 1) # Enable termination resistor to accelerate port state change to 0 print "Press Y/N and Enter"
self.dio.set_dir(lemon,0) # Disable port output ans=""
self.dio.set_out(lemon,1) # set port output value to 1 while ans != "Y" and ans != "N":
self.dio.set_term(lemon, 0) # Disable termination resistor (when port output is stable) for nled in range(2):
try: self.dio.set_led(nled,nled)
th0=self.dio.find_port_voltage(lemon,0.0,0.08) # Find the voltage (threshold) time.sleep(0.2)
except CFmcDioError as e: for nled in range(2):
print str(e) self.dio.set_led(nled,1-nled)
raise PtsError("While setting CDAC5578 channel value: "+str(e)) time.sleep(0.2)
self.dio.set_dir(lemon,0) # Disable port output if kbhit():
self.dio.set_out(lemon,0) # set port output value to 0 ans=raw_input().upper()
if th0>0.1: if ans <> "Y" and ans <> "N":
th0_warn="Warning: Strangely-high value " print "The valid inputs are only Y or N and Enter"
port_warnhigh.append(lemon) sys.stdout = tmp_stdout
else: sys.stdin = tmp_stdin
th0_warn="OK " # purgestdin()
print "Port {} apparent input voltage: {:.3f}V {}".format(lemon,th0,th0_warn) for nled in range(2):
port_th.insert(lemon,th0) self.dio.set_led(nled,0)
port_err=[] print "The user reported {} operation of board LEDs".format("a correct" if ans=="Y" else "an incorrect")
for lemon in range(len(port_th)): if ans == "N":
if port_th[lemon]>0.8: # normal operating conditions emsg="TSTERR00: Operation of fmc-dio-5chttla-board LEDs failed"
port_err.append(lemon) print emsg
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: else:
if port_warnhigh: # Some warning were generated emsg=None # test completed successfully
warn_msg="TSTWRN02: Strangely-high voltage value obtained in ports: {} when output enable=0".format(port_warnhigh) return emsg
ret_error=["W",warn_msg]
else:
ret_error=None
return ret_error
def main(default_directory="."): def main(default_directory="."):
# Configure the FPGA using the program fpga_loader # Configure the FPGA using the program fpga_loader
...@@ -93,22 +87,16 @@ def main(default_directory="."): ...@@ -93,22 +87,16 @@ def main(default_directory="."):
print "Test04 Start" print "Test04 Start"
init_test_time = time.time() print "Checking fmc-dio-5chttla board presence"
print "Configuring and checking fmc-dio-5chttla devices"
test=test04(spec) test=test04(spec)
print "\nChecking output-enable circuits of board ports" print "\nChecking LEDs"
ret_error=test.test_port_oe() emsg=test.test_LEDs()
end_test_time = time.time()
print "\nEnd of Test04" 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 "RESULT: [{}]".format("FAIL" if emsg else "OK")
print 'Test04 elapsed time: {:.2f} seconds'.format(end_test_time-init_test_time) if emsg:
if ret_error: raise PtsError(emsg)
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__": if __name__ == "__main__":
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