Commit 49cd8d02 authored by Richard R. Carrillo's avatar Richard R. Carrillo

some tests of fmcdio5chttla modified

parent fb2f9faf
#!/bin/sh
LOGDIR=./log
# 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: 0.2 (Last modifications: 26/4/2012)
LOGDIR=./log_fmcdio5chttla
mkdir -p $LOGDIR
sudo rm -fr $LOGDIR/pts*
serial=$1
if [ x$1 = x"" ]; then
echo -n "Please, input SERIAL number: "
echo -n "Please scan CERN serial number bar-code, then press [ENTER]: "
read serial
fi
if [ x$serial = x"" ]; then
serial=0000
fi
if [ -e serial.txt ]; then
sudo rm -f serial.txt
fi
echo $serial >> serial.txt
extra_serial=$2
if [ x$2 = x"" ]; then
echo -n "Please, input extra SERIAL number: "
echo -n "If needed, input extra serial number and press [ENTER], OR just press [ENTER]: "
read extra_serial
fi
......@@ -21,11 +38,40 @@ if [ x$extra_serial = x"" ]; then
extra_serial=0000
fi
tmp=""
echo " "
nb_test_limit=2
nb_test=1
while [ "$nb_test" -le "$nb_test_limit" ]
do
echo "--------------------------------------------------------------"
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
if [ "$nb_test" != "$nb_test_limit" ]
then
echo " "
echo -n "Do you want to run the test series again [y,n]? "
read reply
if [ "$reply" != "y" ]
then
break
fi
fi
nb_test=$(($nb_test+1))
done
echo "--------------------------------------------------------------"
echo " "
echo -n "End of the test, do you want to switch the computer OFF? [y,n]"
read reply
if [ "$reply" = "y" ]
then
sudo halt
fi
sudo ./pts.py -b FMC-DIO-5chTTLa -s $serial -e $extra_serial -t./test/fmcdio5chttla/python -l $LOGDIR 00 01 02 03 04 05
echo -n "Press enter to exit..."
read tmp
......@@ -3,7 +3,7 @@
FmcDIO5chTTLa's tests for TPS environment
*******************************************************************************
Seven Solutions S.L.
CERN, 2012 (Seven Solutions S.L.)
Author: Richard R. Carrillo <rcarrillo(AT)sevensols.com>
Licence: GPL v2 or later.
......@@ -16,7 +16,7 @@ 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, LVDS comparator)
- 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
......
No preview for this file type
No preview for this file type
#!/usr/bin/python
#coding: utf8
# Copyright Seven Solutions S.L., 2012
# 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: 0.2 (Last modifications: 24/4/2012)
from ptsexcept import *
from dio_fmc import *
......@@ -26,8 +26,8 @@ Procedure details:
- 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 temperature sensor ID
- Check temperature acquisition.
- Check and store temperature sensor ID
- Check and store temperature acquisition.
"""
class test00:
......@@ -45,19 +45,21 @@ class test00:
def test_temp(self):
""" Check OneWire device response correctly and check temperature acquisition """
try:
uid = self.dio.get_unique_id()
print " chip lasered code: {:x}".format(self.dio.get_unique_id())
except CFmcDioError as e:
print str(e)
emsg="While getting DS18B20 chip ID: "+str(e)
ret_error=["E","While getting DS18B20 chip I.C.: "+str(e)]
else:
try:
print ("FMC temperature: %3.3f°C" % self.dio.get_temp())
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)
emsg="While getting temperature with DS18B20 chip: "+str(e)
else:
emsg=None # test completed successfully
return emsg
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
......@@ -72,20 +74,25 @@ def main(default_directory="."):
print "Loading hardware access library and opening device\n"
spec = rr.Gennum()
print "Test Start"
print "Test00 Start"
init_test_time = time.time()
print "Configuring and checking fmc-dio-5chttla devices"
test=test00(spec)
print "\nChecking temperature acquisition"
emsg=test.test_temp()
print "\nChecking temperature acquisition I.C. (DS18B20)"
ret_error=test.test_temp()
end_test_time = time.time()
print "\nEnd of Test"
print "RESULT: [{}]".format("FAIL" if emsg else "OK")
print 'Test03 elapsed time: {:.2f} seconds'.format(end_test_time-init_test_time)
if emsg:
raise PtsError(emsg)
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])
if __name__ == "__main__":
main(".")
......
#!/usr/bin/python
#coding: utf8
# Copyright Seven Solutions S.L., 2012
# Copyright CERN, 2012 (Seven Solutions S.L.)
# Author: Richard Carrillo <rcarrillo(AT)sevensols.com>
# Licence: GPL v2 or later.
# Website: http://www.ohwr.org
......@@ -85,7 +85,7 @@ def main(default_directory="."):
print "Loading hardware access library and opening device\n"
spec = rr.Gennum()
print "Test Start"
print "Test01 Start"
print "Checking fmc-dio-5chttla board presence"
test=test01(spec)
......@@ -93,7 +93,7 @@ def main(default_directory="."):
print "\nChecking LEDs"
emsg=test.test_LEDs()
print "\nEnd of Test"
print "\nEnd of Test01"
print "RESULT: [{}]".format("FAIL" if emsg else "OK")
if emsg:
raise PtsError(emsg)
......
#!/usr/bin/python
#coding: utf8
# Copyright Seven Solutions S.L., 2012
# 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: 0.1 (Last modifications: 1/4/2012)
# Version: 0.2 (Last modifications: 24/4/2012)
from ptsexcept import *
......@@ -19,18 +19,20 @@ 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
User intervention required: Yes*
Procedure details:
- Load firmware.
- Test mezzanine presence line.
- Oscillate state of fmc-dio-5chttl-board ports
- 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
"""
class test02:
def __init__(self, spec):
""" check FMC PRESENT-pin state """
try:
self.dio = CFmcDio(spec, 0x80000, False)
self.dio = CFmcDio(spec, 0x80000, True)
except CFmcDioError as e:
err_msg="While fmc-dio-5chttla initialization: "+str(e)
if e.bus_name == "FMC":
......@@ -40,15 +42,15 @@ class test02:
def osc_ports(self):
""" Oscillate state of fmc-dio-5chttl-board ports """
for lemon in range(5): # Enable output of all ports and set them to 0
self.dio.set_out(lemon,0)
self.dio.set_dir(lemon,1)
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_out((lemon-1)%5,0)
self.dio.set_out(lemon,1)
self.dio.set_dir((lemon-1)%5,0)
self.dio.set_dir(lemon,1)
lemon=(lemon+1)%5
if kbhit():
ans=raw_input().upper()
......@@ -59,29 +61,107 @@ class test02:
self.dio.set_dir(lemon, 0)
return ans
def test_port_out(self):
""" Port (LEMO 00 connectors) oscillation check """
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:
self.dio.set_in_threshold(inp,self.dio.DACvoltage2value(0.8))
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()
# purgestdin()
raw_input("Disconnect the red LEDs from the fmc-dio-5chttla-board ports (in order to perform further tests) and press Enter")
sys.stdout = tmp_stdout
sys.stdin = tmp_stdin
print "The user reported {} operation of board-port outputs".format("a correct" if ans=="Y" else "an incorrect")
if ans == "N":
emsg="TSTERR01: Operation of fmc-dio-5chttla-board ports as output failed"
print emsg
else:
emsg=None # test completed successfully
return emsg
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="."):
# Configure the FPGA using the program fpga_loader
......@@ -96,15 +176,15 @@ def main(default_directory="."):
print "Loading hardware access library and opening device\n"
spec = rr.Gennum()
print "Test Start"
print "Test Start02"
print "Checking fmc-dio-5chttla board presence"
test=test02(spec)
print "\nChecking connectivity of board ports"
emsg=test.test_port_out()
emsg=test.test_port_inter()
print "\nEnd of Test"
print "\nEnd of Test02"
print "RESULT: [{}]".format("FAIL" if emsg else "OK")
if emsg:
raise PtsError(emsg)
......
#!/usr/bin/python
#coding: utf8
# Copyright Seven Solutions S.L., 2012
# 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: 0.1 (Last modifications: 1/4/2012)
# Version: 0.2 (Last modifications: 1/4/2012)
from ptsexcept import *
......@@ -22,7 +22,7 @@ User intervention required: No
Procedure details:
- Load firmware.
- Test mezzanine presence line.
- Check the voltage of all ports (be means of the DAC) when port output set to 0 and when it is set to 1
- 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 test03:
......@@ -101,7 +101,7 @@ def main(default_directory="."):
print "Loading hardware access library and opening device\n"
spec = rr.Gennum()
print "Test Start"
print "Test Start03"
init_test_time = time.time()
print "Configuring and checking fmc-dio-5chttla devices"
......@@ -111,7 +111,7 @@ def main(default_directory="."):
ret_error=test.test_port_in()
end_test_time = time.time()
print "\nEnd of Test"
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 'Test03 elapsed time: {:.2f} seconds'.format(end_test_time-init_test_time)
if ret_error:
......
#!/usr/bin/python
#coding: utf8
# Copyright Seven Solutions S.L., 2012
# 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: 0.1 (Last modifications: 1/4/2012)
# Version: 0.2 (Last modifications: 1/4/2012)
from ptsexcept import *
......@@ -23,7 +23,7 @@ User intervention required: No
Procedure details:
- Load firmware.
- Test mezzanine presence line.
- Check the voltage of all ports (be means of the DAC) when port output set to 1 and output enable set to 0
- 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 test04:
......@@ -91,7 +91,7 @@ def main(default_directory="."):
print "Loading hardware access library and opening device\n"
spec = rr.Gennum()
print "Test Start"
print "Test04 Start"
init_test_time = time.time()
print "Configuring and checking fmc-dio-5chttla devices"
......@@ -101,7 +101,7 @@ def main(default_directory="."):
ret_error=test.test_port_oe()
end_test_time = time.time()
print "\nEnd of Test"
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:
......
#!/usr/bin/python
#coding: utf8
# Copyright Seven Solutions S.L., 2012
# 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: 0.1 (Last modifications: 1/4/2012)
# Version: 0.2 (Last modifications: 1/4/2012)
from ptsexcept import *
......@@ -23,7 +23,7 @@ User intervention required: No
Procedure details:
- Load firmware.
- Test mezzanine presence line.
- Check the voltage of all ports (be means of the DAC) when port output set to 1, output enable set to 0
- 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
"""
......@@ -99,7 +99,7 @@ def main(default_directory="."):
print "Loading hardware access library and opening device\n"
spec = rr.Gennum()
print "Test Start"
print "Test05 Start"
init_test_time = time.time()
print "Configuring and checking fmc-dio-5chttla devices"
......@@ -109,7 +109,7 @@ def main(default_directory="."):
ret_error=test.test_port_term()
end_test_time = time.time()
print "\nEnd of Test"
print "\nEnd of Test05"
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 'Test05 elapsed time: {:.2f} seconds'.format(end_test_time-init_test_time)
if ret_error:
......
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