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 documents describes all the possible messages which can be reported during the execution of PTS of the FMC-DIO-5chTTLa board. These messages can reveal the cause of a test failure.
Error messages
--------------
DIOERR00: PRESENT line is not asserted in FMC. Is the fmc-dio-5chttla correctly inserted into the carrier?
The PRESENT line of the FMC connector is not asserted. This line is used to state that an adequate board in connected in the FMC connector of the SPEC board (carrier).
Possible causes:
- FMC-DIO-5chTTLa-board is not correctly connected.
- Faulty electrical connectivity in the PRESENT line circuit or FMC connector.
- Incorrect FPGA configuration (bitstream file).
DIOERR01: I2C core is not enabled
The internal flags corresponding to the I2C core are not active.
Possible causes:
- Incorrect FPGA configuration (bitstream file).
DIOERR02: No I2C device found
No device has responded to any address in the I2C bus.
Possible causes:
- I2C bus is not working properly. Check for short-circuits in any of the bus lines.
DIOERR03: Device not found. Only x I2C devices found
The DAC or the EEPROM does not respond to their expected address.
Possible causes:
- Wrong address configuration. If the number of devices found (x) is 3, check the list of devices (addresses) found in the generated log files. For those devices (addresses) which are not listed, check their address configuration lines (chip soldering and FMC GA0 and GA1 lines connectivity).
- Faulty electrical connection. If the number of devices found (x) is less than 3, check the list of devices (addresses) found in the generated log files. For those devices (addresses) which are not listed, check their I2C lines and power pins (chip soldering).
I2C device EEPROM (24AA64T) at addr 0x50 produced the error: DIOERR04: Initializing: x
This error message is reserved for future uses.
Possible causes:
- None
I2C device DAC (DAC5578) at addr 0x48 produced the error: DIOERR05: Initializing: x
The DAC did not respond correctly during the configuration process.
Possible causes:
- An incorrect DAC IC is mounted.
- Defective DAC IC soldering (I2C lines or power-supply pins of DAC).
The message x may give an extra clue about the error cause.
I2C device DAC (DAC5578) at addr 0x48 produced the error: DIOERR06: Setting channel value: x
The DAC did not respond correctly to the set-channel voltage commands.
Possible causes:
- An incorrect DAC IC is mounted.
- Defective DAC IC soldering (I2C lines or power-supply pins of DAC).
The message x may give an extra clue about the error cause.
Error in I2C bus. (Addr: x): DIOERR07: Device not initialized
The I2C-device access library has not been properly initialized. This error should never be reported when executing the original FMC-DIO-5chTTLa-board tests.
Possible causes:
- Test-program programming bug.
I2C device DAC (DAC5578) at addr 0x48 produced the error: DIOERR08: Getting channel value: x
The DAC did not respond correctly to the get channel-voltage configuration commands.
Possible causes:
- An incorrect DAC IC is mounted.
- Defective DAC IC soldering (I2C lines or power-supply pins of DAC).
The message x may give an extra clue about the error cause.
Error in OneWire bus. (Addr: x): DIOERR09: Getting unique ID: y
The OneWire device DS1820 did not respond correctly during the process for obtaining the chip unique ID (first commands).
Possible causes:
- An incorrect IC is mounted.
- Defective chip soldering (OneWire line or power-supply pins of DS1820).
- Electrical connectivity problems (short-circuits or open-circuits) in the OneWire line (FMC connector, OneWire pull-up resistors).
The message y may give an extra clue about the error cause.
Error in OneWire bus. (Addr: x): DIOERR10: Device not initialized
The OneWire-device access library has not been properly initialized. This error should never be reported when executing the original FMC-DIO-5chTTLa-board tests.
Possible causes:
- Test-program programming bug.
Error in OneWire bus. (Addr: x): DIOERR11: Getting temperature: y
The OneWire device DS1820 did not respond correctly during the process for obtaining the temperature.
Possible causes:
- An incorrect IC is mounted.
- Defective chip soldering (OneWire line or power-supply pins of DS1820).
The message y may give an extra clue about the error cause.
Error in I2C bus. (Addr: x): DIOERR012: Device not initialized
The I2C EEPROM access library has not been properly initialized. This error should never be reported when executing the original FMC-DIO-5chTTLa-board tests.
Possible causes:
- Test-program programming bug.
I2C device EEPROM (24AA64T) at addr 0x50 produced the error: DIOERR13: Writing memory data: x
The EEPROM did not respond correctly to the write data commands.
Possible causes:
- An incorrect EEPROM IC is mounted.
- Defective EEPROM IC soldering (I2C lines or power-supply pins of EEPROM).
The message x may give an extra clue about the error cause.
I2C device EEPROM (24AA64T) at addr 0x50 produced the error: DIOERR14: Reading memory data: x
The EEPROM did not respond correctly to the read data commands.
Possible causes:
- An incorrect EEPROM IC is mounted.
- Defective EEPROM IC soldering (I2C lines or power-supply pins of EEPROM).
The message x may give an extra clue about the error cause.
TSTERR00: Operation of fmc-dio-5chttla-board LEDs failed
The user answered “N” indicating that the FMC-DIO-5chTTLa-board LEDs did not operate properly.
Possible causes:
- Soldering problems of the LED circuit (LED, current-limiting resistor or switch transistor).
- Electrical connectivity problems in the LED activation lines of the FMC connector.
TSTERR01: Operation of fmc-dio-5chttla-board ports as output failed
The user answered “N” indicating that the FMC-DIO-5chTTLa-board ports did not provide the correct voltage to turn on and off the test-cable LEDs.
Possible causes:
- Soldering problems (short-circuits and open-circuits) of the corresponding LEMO 00 connectors, corresponding lines (fuses) or voltage clamping components (short-circuits).
- Soldering problems of the corresponding port driver IC and the LVDS-to-LVCMOS IC.
- Electrical connectivity problems of the corresponding port control lines of the FMC connector.
Execute test06 to obtain more information which could be useful to isolate the problem.
TSTERR02: Proper voltage reading not obtained in ports: [x] when output enable=1
Apparently the voltage obtained in the ports x is out of the expected range when the port output is set to a high or low level. Alternatively, a misleading wrong voltage could have been measured due to a DAC or comparator operation problem.
Possible causes:
- Something is connected to the LEMO-00 connectors of the ports. Ensure that nothing is connected to the ports while executing this test.
- Soldering problems (short-circuits) of the corresponding LEMO-00 connectors, corresponding lines (fuses) or voltage clamping components.
- Soldering problems of the corresponding port driver IC or the LVDS-to-LVCMOS IC.
- Soldering problems of the DAC or the corresponding voltage comparator.
- Electrical connectivity problems of the corresponding port control lines of the FMC connector.
- An incorrect port current-driver IC is mounted.
Check the log files to obtain more information about what caused the error.
Check the results of this test to isolate the problem.
TSTERR03: Proper voltage reading not obtained in ports: [x] when output enable=0
Apparently the voltage obtained in the ports x is out of the expected range when the port output is set to a high level, the termination resistor is disabled and the output-enable circuit is disabled. Alternatively, a misleading wrong voltage could have been measured due to a DAC or comparator operation problem.
Possible causes:
- Soldering problems of the corresponding port driver IC or the LVDS-to-LVCMOS IC.
- Soldering problems of the DAC or the corresponding voltage comparator.
- Electrical connectivity problems of the corresponding port control lines of the FMC connector.
Check the log files to obtain more information about what caused the error.
Check the results of test06 to isolate the problem.
TSTERR04: Proper voltage reading not obtained in ports: [x] when termination resistors enabled
Apparently the voltage obtained in the ports x is out of the expected range when the port output is set to a high level and the termination resistor is enabled. Alternatively, a misleading wrong voltage could have been measured due to a DAC or comparator operation problem.
Possible causes:
- Soldering problems (short-circuits) of the corresponding LEMO-00 connectors, corresponding lines (fuses) or port input-voltage clamping components.
- Soldering problems of the corresponding port driver IC or the LVDS-to-LVCMOS IC.
- Soldering problems of the DAC or the corresponding voltage comparator.
- Electrical connectivity problems of the corresponding port control lines of the FMC connector.
- An incorrect port current-driver IC is mounted.
Check the log files to obtain more information about what caused the error.
Check the results of test06 to isolate the problem.
TSTERR05: No communication could be performed between any two ports
No communication could be established between any of the board ports (when the interconnection cables are plugged). That is, the test could not find a port working as input and another as output.
Possible causes:
- The interconnection cables are not connected to the LEMO 00 ports while executing this test.
- Soldering problems (short-circuits and open-circuits) of the corresponding LEMO 00 connectors, corresponding lines (fuses) or voltage clamping components (short-circuits).
- Soldering problems of the corresponding port driver IC or the LVDS-to-LVCMOS IC.
- Soldering problems of the DAC or the corresponding voltage comparator.
- Electrical connectivity problems of the corresponding port control lines of the FMC connector.
Check the log files to obtain more information about what caused the error.
TSTERR06: Ports x appear no to be correctly connected
No communication could be established through ports x (when the interconnection cables are plugged). That is, the test could use ports x neither as input nor output to communicate with the rest of the ports.
Possible causes:
- Some of the interconnection cables are not correctly connected to the LEMO 00 ports while executing this test.
- Soldering problems (open-circuits) of the corresponding LEMO 00 connectors or corresponding lines (fuses).
- Soldering problems of the corresponding port driver IC or the LVDS-to-LVCMOS IC.
- Soldering problems of the DAC or the corresponding voltage comparator.
- Electrical connectivity problems of the corresponding port control lines of the FMC connector.
Check the log files to obtain more information about what caused the error.
TSTERR07: Correct data not read when verifying EEPROM writting operation
Possible causes:
- An incorrect EEPROM IC is mounted.
- Defective EEPROM or IC soldering (I2C lines or power-supply pins of EEPROM).
Warning messages
----------------
TSTWRN00: Strangely-low voltage value obtained in ports: [x] when output=1
Apparently the voltage measured in the ports x is unusually low (but still within the operating range) when the port output is set to a high level.
Possible causes:
- Something is connected to the LEMO-00 connectors of the ports. Ensure that nothing is connected to the ports while executing this test.
- Soldering problems of the termination-resistor activation circuit (switching transistor)
- Electrical connectivity problems of the corresponding port termination-resistor control lines of the FMC connector.
- An incorrect port current-driver IC is mounted.
Check the log files to obtain more information about what caused the error.
TSTWRN01: Strangely-high voltage value obtained in ports: [x] when output=0
Apparently the voltage measured in the ports x is unusually high (but still within the operating range) when the port output is set to a low level.
Possible causes:
- Electrical connectivity problems of the corresponding port control lines of the FMC connector.
- An incorrect port current-driver IC is mounted.
Check the log files to obtain more information about what caused the error.
TSTWRN02: Strangely-high voltage value obtained in ports: [x] when output enable=0
Apparently the voltage measured in the ports x is unusually high (but still within the operating range) when the port output-enable circuit is disabled.
Possible causes:
- Electrical connectivity problems of the corresponding port control lines of the FMC connector.
- An incorrect port current-driver IC is mounted.
Check the log files to obtain more information about what caused the error.
TSTWRN03: Strangely-low voltage value obtained in ports: [x] when termination resistors enabled
Apparently the voltage measured in the ports x is unusually low (but still within the operating range) when the port output is set to a high level and the termination resistor is enabled.
Possible causes:
- Something is connected to the LEMO-00 connectors of the ports. Ensure that nothing is connected to the ports while executing this test.
- Electrical connectivity problems of the corresponding port termination-resistor control lines of the FMC connector.
- An incorrect port current-driver IC is mounted.
Check the log files to obtain more information about what caused the error.
TSTWRN04: Strangely-high voltage value obtained in ports: [x] when termination resistors enabled
Apparently the voltage measured in the ports x is unusually high (but still within the operating range) when the port output is set to a high level and the termination resistor is enabled.
Possible causes:
- Soldering problems of the termination-resistor activation circuit (switching transistor or resistors)
- An incorrect port current-driver IC is mounted.
Check the log files to obtain more information about what caused the error.
TSTWRN05: Strange temperature value measured
Apparently the temperature measured through the OneWire temperature acquisition I.C. is out of a reasonable range.
Possible causes:
- The test is run in extreme temperature conditions.
- Board overheating.
- Faulty temperature acquisition I.C.
Check the log files to obtain the concrete temperature value measured.
...@@ -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(".")
......
...@@ -6,32 +6,33 @@ ...@@ -6,32 +6,33 @@
# 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
""" """
test05: Check termination resistors of fmc-dio-5chttl-board ports 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 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, output enable set to 0 - Check that ports work as output
and termination resistor enabled - 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 test05: class test05:
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, True)
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,52 +40,128 @@ class test05: ...@@ -39,52 +40,128 @@ class test05:
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_term(self): def osc_ports(self):
""" Port (LEMO 00 connectors) termination-resistor enable check """ """ Oscillate state of fmc-dio-5chttl-board ports """
print "Ensure that nothing is connected to the fmc-dio-5chttla-board ports" for lemon in range(5): # Disable output of all ports and set them to 1
print "(Termination resistors enabled, port outputs enabled)" self.dio.set_dir(lemon,0)
port_th=[] self.dio.set_out(lemon,1)
port_warnlow=[] ans=""
port_warnhigh=[] lemon=0
for lemon in range(5): while ans != "Y" and ans != "N":
self.dio.set_term(lemon, 1) # Enable termination resistor time.sleep(0.05)
self.dio.set_dir(lemon,1) # Enable port output self.dio.set_dir((lemon-1)%5,0)
self.dio.set_out(lemon,1) # Set port output value to 1 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:
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: try:
th1=self.dio.find_port_voltage(lemon,2.95,3.02) # Find the voltage (threshold) self.dio.set_in_threshold(inp,self.dio.DACvoltage2value(1.9))
except CFmcDioError as e: except CFmcDioError as e:
print str(e)
raise PtsError("While setting CDAC5578 channel value: "+str(e)) raise PtsError("While setting CDAC5578 channel value: "+str(e))
self.dio.set_dir(lemon,0) # Disable port output time.sleep(0.010) # wait for the DAC output to stabilize
self.dio.set_out(lemon,0) # Set port output value to 0
self.dio.set_term(lemon, 0) # Disable termination resistor if self.dio.get_in(inp): # High value detected in the output port
if th1>3.1: ports_working=True
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: else:
th1_warn="OK" ports_working=False
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: else:
if port_warnlow or port_warnhigh: # Some warning were generated ports_working=False
warn_msg=""
if port_warnlow: self.dio.set_out(outp,0) # Set port output value to 0
warn_msg=warn_msg+"TSTWRN03: Strangely-low voltage value obtained in ports: {} when termination resistors enabled. ".format(port_warnlow) self.dio.set_dir(outp,0) # Disable port output
if port_warnhigh: return ports_working
warn_msg=warn_msg+"TSTWRN04: Strangely-high voltage value obtained in ports: {} when termination resistors enabled. ".format(port_warnhigh)
ret_error=["W",warn_msg] 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 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: else:
ret_error=None emsg=None
return ret_error
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
...@@ -99,24 +176,18 @@ def main(default_directory="."): ...@@ -99,24 +176,18 @@ 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 "Test05 Start" print "Test Start05"
init_test_time = time.time() print "Checking fmc-dio-5chttla board presence"
print "Configuring and checking fmc-dio-5chttla devices"
test=test05(spec) test=test05(spec)
print "\nChecking output-enable circuits of board ports" print "\nChecking connectivity of board ports"
ret_error=test.test_port_term() emsg=test.test_port_inter()
end_test_time = time.time()
print "\nEnd of Test05" 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 "RESULT: [{}]".format("FAIL" if emsg else "OK")
print 'Test05 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(".")
......
#!/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