Commit 19b003d2 authored by Dimitris Lampridis's avatar Dimitris Lampridis

Merge remote-tracking branch 'origin/mcattin_dev' into dlamprid-dev

parents 88134293 98c5a3ef
......@@ -47,7 +47,7 @@ do
echo "Test series run $nb_test out of $nb_test_limit"
echo " "
sudo ./pts/pts.py -b FmcAdc100M14b4cha -s $serial -e $extra_serial -t ./tests -l $LOGDIR 00 01 02 03 04 05 06 07 08 09 22 19 23 25
sudo ./pts/pts.py -b FmcAdc100M14b4cha -s $serial -e $extra_serial -t ./tests -l $LOGDIR 00 01 02 03 04 05 06 07 08 09 22 19 23 47 25
if [ "$nb_test" != "$nb_test_limit" ]
then
......
#! /bin/sh
# Scan serial number
serial=$1
if [ x$1 = x"" ]; then
echo -n "Please scan CERN serial number bar-code, then press [ENTER]: "
read serial
fi
if [ x$serial = x"" ]; then
echo -n "Serial numer cannot be empty!!"
exit
fi
if [ -e ../serial.txt ]; then
sudo rm -f ../serial.txt
fi
echo $serial >> ../serial.txt
# Load bitstream
sudo ./test00.py
# Read eeprom, dump to eeprom_content.out
sudo ./test26.py
# Backup eeprom content
cp eeprom_content.out ../eeprom_bkp/eeprom_$serial.bin
# Save calibration data
sudo sdb-read -e 0x200 eeprom_content.out calib > sdbfs/calib
# Re-write eeprom (new ipmi, saved calibration data)
sudo ./test46.py
# Check eeprom content validity
sudo ./test47.py
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 shutdown -h now
fi
......@@ -27,13 +27,17 @@ test02: Test EEPROM access
Note: Requires test00.py to run first to load the gateware!
"""
def pattern_compare(fmc, pattern):
print "Write data pattern to EEPROM\n"
def pattern_compare(fmc, offset, pattern):
print "Write data pattern to EEPROM at offset 0x%4X\n" % offset
#print [hex(a) for a in pattern]
fmc.sys_i2c_eeprom_write(pattern)
#fmc.sys_i2c_eeprom_write(pattern)
fmc.eeprom_24aa64.wr_page(offset, pattern)
time.sleep(0.1)
print "Read back data from EEPROM\n"
rd_pattern = fmc.sys_i2c_eeprom_read(0x0, len(pattern))
#rd_pattern = fmc.sys_i2c_eeprom_read(0x0, len(pattern))
#print [hex(a) for a in rd_pattern]
rd_pattern = fmc.eeprom_24aa64.rd_seq(offset, len(pattern))
time.sleep(0.1)
print "Data comparison:"
print "written read => result"
mismatch = 0
......@@ -55,6 +59,7 @@ def main (default_directory='.'):
EEPROM_ADDR = 0x50
PATTERN_A = [0x55, 0xAA, 0x00, 0xFF]
PATTERN_B = [0xAA, 0x55, 0xFF, 0x00]
WRITE_OFFSET = 0x1000
start_test_time = time.time()
......@@ -91,11 +96,18 @@ def main (default_directory='.'):
if(EEPROM_ADDR != periph_addr[0]):
error = "Wrong device mounted on system management I2C bus or soldering issues, address is:0x%.2X expected:0x%.2X" % (periph_addr[0],EEPROM_ADDR)
# Save content of the area used for the test
print('Saving test area eeprom content.')
area_content = fmc.eeprom_24aa64.rd_seq(WRITE_OFFSET, len(PATTERN_A))
time.sleep(0.1)
print [("0x%02X"%a) for a in area_content]
print('')
# Write, read back and compare two different patterns
try:
mismatch = 0
mismatch += pattern_compare(fmc, PATTERN_A)
mismatch += pattern_compare(fmc, PATTERN_B)
mismatch += pattern_compare(fmc, WRITE_OFFSET, PATTERN_A)
mismatch += pattern_compare(fmc, WRITE_OFFSET, PATTERN_B)
except FmcAdc100mOperationError as e:
raise PtsError("EEPROM write/read/compare test failed: %s" % e)
......@@ -104,6 +116,10 @@ def main (default_directory='.'):
else:
print('Data comparison OK.')
# Restores the saved content to the area used for test
print('\nRestoring test area eeprom content.')
fmc.eeprom_24aa64.wr_page(WRITE_OFFSET, area_content)
time.sleep(0.1)
print ""
print "==> End of test%02d" % TEST_NB
......
......@@ -162,7 +162,7 @@ def main (default_directory='.'):
acq_data_mean = acq_mean(acq_data)
for i in range(len(acq_data_mean)):
print "ADC channel %d value:%d expected value:%d" % (i+1, acq_data_mean[i], ADC_POS)
if(ADC_POS != acq_data_mean[i]):
if(ADC_POS != int(acq_data_mean[i])):
print "Channel %d offset circuit is malfunctioning" % (i+1)
error += 1
# raise PtsError('Channel %d offset circuit is malfunctioning'%i)
......@@ -179,7 +179,7 @@ def main (default_directory='.'):
acq_data_mean = acq_mean(acq_data)
for i in range(len(acq_data_mean)):
print "ADC channel %d value:%d expected value:%d +/-%d" % (i+1, acq_data_mean[i], ADC_MID, ADC_TOL)
if((ADC_MID-ADC_TOL > acq_data_mean[i]) | (ADC_MID+ADC_TOL < acq_data_mean[i])):
if((ADC_MID-ADC_TOL > int(acq_data_mean[i])) | (ADC_MID+ADC_TOL < int(acq_data_mean[i]))):
print "Channel %d offset circuit is malfunctioning"%(i+1)
error += 1
# raise PtsError('Channel %d offset circuit is malfunctioning'%i)
......@@ -197,7 +197,7 @@ def main (default_directory='.'):
acq_data_mean = acq_mean(acq_data)
for i in range(len(acq_data_mean)):
print "ADC channel %d value:%d expected value:%d" % (i+1, acq_data_mean[i], ADC_NEG)
if(ADC_NEG != acq_data_mean[i]):
if(ADC_NEG != int(acq_data_mean[i])):
print "Channel %d offset circuit is malfunctioning"%(i+1)
error += 1
# raise PtsError('Channel %d offset circuit is malfunctioning'%i)
......
......@@ -12,15 +12,6 @@ import sys
import time
import os
# Add common modules and libraries location to path
sys.path.append('../../../')
sys.path.append('../../../gnurabbit/python/')
sys.path.append('../../../common/')
# Import common modules
from ptsexcept import *
import rr
# Import specific modules
from fmc_adc_spec import *
from fmc_adc import *
......@@ -31,6 +22,10 @@ import find_usb_tty
from PAGE.Agilent33250A import *
from PAGE.SineWaveform import *
# Import common modules
from ptsexcept import *
import rr
"""
test12: Takes an acquisition of each channels separately and print it to a file and on the screen
......
......@@ -12,15 +12,6 @@ import sys
import time
import os
# Add common modules and libraries location to path
sys.path.append('../../../')
sys.path.append('../../../gnurabbit/python/')
sys.path.append('../../../common/')
# Import common modules
import rr
from ptsexcept import *
# Import specific modules
from numpy import *
from pylab import *
......@@ -32,6 +23,10 @@ import find_usb_tty
from PAGE.Agilent33250A import *
from PAGE.SineWaveform import *
# Import common modules
import rr
from ptsexcept import *
"""
test17: Plot all channels
......
......@@ -12,15 +12,6 @@ import sys
import time
import os
# Add common modules and libraries location to path
sys.path.append('../../../')
sys.path.append('../../../gnurabbit/python/')
sys.path.append('../../../common/')
# Import common modules
from ptsexcept import *
import rr
# Import specific modules
from numpy import *
from pylab import *
......@@ -29,6 +20,10 @@ import find_usb_tty
from PAGE.Agilent33250A import *
from PAGE.SineWaveform import *
# Import common modules
from ptsexcept import *
import rr
"""
test18: Test calibration box
......
......@@ -12,17 +12,6 @@ import sys
import time
import os
# Add common modules and libraries location to path
sys.path.append('../../../')
sys.path.append('../../../gnurabbit/python/')
sys.path.append('../../../common/')
sys.path.append('../../fmceeprom/python/')
# Import common modules
from ptsexcept import *
from fmc_eeprom import *
import rr
# Import specific modules
from fmc_adc_spec import *
from fmc_adc import *
......@@ -35,6 +24,11 @@ from PAGE.Agilent33250A import *
from PAGE.SineWaveform import *
from ctypes import *
# Import common modules
from ptsexcept import *
from fmc_eeprom import *
import rr
"""
......
......@@ -13,18 +13,13 @@ import time
import os
import re
# Add common modules and libraries location to path
sys.path.append('../../../')
sys.path.append('../../../gnurabbit/python/')
sys.path.append('../../../common/')
# Import specific modules
from cp210x_eeprom import *
# Import common modules
from ptsexcept import *
import rr
# Import specific modules
from cp210x_eeprom import *
"""
test21: Store calibration data to CP2103 EEPROM
......
......@@ -308,7 +308,8 @@ P1 Bank A nb signal=%d, P1 Bank B nb signal=%d, P2 Bank A nb signal=%d, P2 Bank
fmc.sys_i2c_eeprom_write(eeprom_data)
#==================================================
# Read back EEPROM content via I2C
# Read back EEPROM content via I2C and compare with written data
print "Read EEPROM content and compare.\n"
eeprom_data_read = fmc.sys_i2c_eeprom_read(0, len(eeprom_data))
mismatch = 0
for i in range(len(eeprom_data)):
......@@ -327,6 +328,7 @@ P1 Bank A nb signal=%d, P1 Bank B nb signal=%d, P2 Bank A nb signal=%d, P2 Bank
else:
print "FAILED"
except FmcAdc100mOperationError as e:
raise PtsError("Test failed: %s" % e)
......
......@@ -13,20 +13,15 @@ import time
import os
import re
# Add common modules and libraries location to path
sys.path.append('../../../')
sys.path.append('../../../gnurabbit/python/')
sys.path.append('../../../common/')
# Import common modules
from ptsexcept import *
import rr
# Import specific modules
from cp210x_eeprom import *
from ctypes import *
import find_usb_tty
# Import common modules
from ptsexcept import *
import rr
"""
test24: Read calibration data from CP2103 EEPROM
......
......@@ -12,21 +12,15 @@ import sys
import time
import os
# Add common modules and libraries location to path
sys.path.append('../../../')
sys.path.append('../../../gnurabbit/python/')
sys.path.append('../../../common/')
sys.path.append('../../fmceeprom/python/')
# Import specific modules
from fmc_adc_spec import *
from fmc_adc import *
# Import common modules
from ptsexcept import *
from fmc_eeprom import *
import rr
# Import specific modules
from fmc_adc_spec import *
from fmc_adc import *
"""
test26: Read FMC EEPROM
......
......@@ -11,20 +11,15 @@ import sys
import time
import os
# Add common modules and libraries location to path
sys.path.append('../../../')
sys.path.append('../../../gnurabbit/python/')
sys.path.append('../../../common/')
# Import common modules
from ptsexcept import *
import rr
# Import specific modules
from fmc_adc_spec import *
from fmc_adc import *
from numpy import *
# Import common modules
from ptsexcept import *
import rr
"""
test27: Test DMA
......
......@@ -12,17 +12,7 @@ import os
import math
import random as rdm
# Add common modules and libraries location to path
sys.path.append('../../../')
sys.path.append('../../../gnurabbit/python/')
sys.path.append('../../../common/')
# Import common modules
from ptsexcept import *
import rr
# Import specific modules
from fmc_adc_spec import *
from fmc_adc import *
from numpy import *
......@@ -34,6 +24,10 @@ from find_usb_tty import *
from PAGE.Agilent33250A import *
from PAGE.SineWaveform import *
# Import common modules
from ptsexcept import *
import rr
"""
test28: Long term test
......
......@@ -12,21 +12,15 @@ import time
import datetime
import os
# Add common modules and libraries location to path
sys.path.append('../../../')
sys.path.append('../../../gnurabbit/python/')
sys.path.append('../../../common/')
sys.path.append('../../fmceeprom/python/')
# Import specific modules
from fmc_adc_spec import *
from fmc_adc import *
# Import common modules
from ptsexcept import *
from fmc_eeprom import *
import rr
# Import specific modules
from fmc_adc_spec import *
from fmc_adc import *
"""
test29: Checks FMC EEPROM for existing data
......
......@@ -12,15 +12,6 @@ import sys
import time
import os
# Add common modules and libraries location to path
sys.path.append('../../../')
sys.path.append('../../../gnurabbit/python/')
sys.path.append('../../../common/')
# Import common modules
from ptsexcept import *
import rr
# Import specific modules
from fmc_adc_spec import *
from fmc_adc import *
......@@ -31,6 +22,10 @@ import find_usb_tty
from PAGE.Agilent33250A import *
from PAGE.SineWaveform import *
# Import common modules
from ptsexcept import *
import rr
"""
test30: Test software reset.
......
......@@ -13,21 +13,15 @@ import time
import datetime
import os
# Add common modules and libraries location to path
sys.path.append('../../../')
sys.path.append('../../../gnurabbit/python/')
sys.path.append('../../../common/')
sys.path.append('../../fmceeprom/python/')
# Import specific modules
from fmc_adc_spec import *
from fmc_adc import *
# Import common modules
from ptsexcept import *
from fmc_eeprom import *
import rr
# Import specific modules
from fmc_adc_spec import *
from fmc_adc import *
"""
test31: Fix EEPROM content:
......
......@@ -12,15 +12,6 @@ import sys
import time
import os
# Add common modules and libraries location to path
sys.path.append('../../../')
sys.path.append('../../../gnurabbit/python/')
sys.path.append('../../../common/')
# Import common modules
from ptsexcept import *
import rr
# Import specific modules
from fmc_adc_spec import *
from fmc_adc import *
......@@ -33,6 +24,10 @@ from PAGE.SineWaveform import *
import scipy.optimize as optimize
import scipy.fftpack as fftpack
# Import common modules
from ptsexcept import *
import rr
"""
test32: Test decimation
......
......@@ -12,21 +12,15 @@ import sys
import time
import os
# Add common modules and libraries location to path
sys.path.append('../../../')
sys.path.append('../../../gnurabbit/python/')
sys.path.append('../../../common/')
sys.path.append('../../fmceeprom/python/')
# Import specific modules
from fmc_adc_spec import *
from fmc_adc import *
# Import common modules
from ptsexcept import *
from fmc_eeprom import *
import rr
# Import specific modules
from fmc_adc_spec import *
from fmc_adc import *
"""
test33: Write FMC EEPROM
......
......@@ -12,20 +12,14 @@ import sys
import time
import os
# Add common modules and libraries location to path
sys.path.append('../../../')
sys.path.append('../../../gnurabbit/python/')
sys.path.append('../../../common/')
# Import specific modules
from fmc_adc_spec import *
from fmc_adc import *
# Import common modules
from ptsexcept import *
import rr
# Import specific modules
from fmc_adc_spec import *
from fmc_adc import *
"""
test34: Test interrupts (EIC + VIC)
......
......@@ -12,18 +12,13 @@ import sys
import time
import os
# Add common modules and libraries location to path
sys.path.append('../../../')
sys.path.append('../../../gnurabbit/python/')
sys.path.append('../../../common/')
# Import specific modules
from fmc_adc_spec import *
# Import common modules
from ptsexcept import *
import rr
# Import specific modules
from fmc_adc_spec import *
"""
test35: Prints carrier CSR (without loading the gateware)
......
......@@ -12,19 +12,14 @@ import sys
import time
import os
# Add common modules and libraries location to path
sys.path.append('../../../')
sys.path.append('../../../gnurabbit/python/')
sys.path.append('../../../common/')
# Import specific modules
from fmc_adc_spec import *
from fmc_adc import *
# Import common modules
from ptsexcept import *
import rr
# Import specific modules
from fmc_adc_spec import *
from fmc_adc import *
"""
test36: Test SDB records
......
......@@ -12,15 +12,6 @@ import sys
import time
import os
# Add common modules and libraries location to path
sys.path.append('../../../')
sys.path.append('../../../gnurabbit/python/')
sys.path.append('../../../common/')
# Import common modules
from ptsexcept import *
import rr
# Import specific modules
from fmc_adc_spec import *
from fmc_adc import *
......@@ -31,6 +22,10 @@ import find_usb_tty
from PAGE.Agilent33250A import *
from PAGE.SineWaveform import *
# Import common modules
from ptsexcept import *
import rr
"""
test37: Test trigger timetags (single and multi shot modes)
......
......@@ -12,18 +12,13 @@ import sys
import time
import os
# Add common modules and libraries location to path
sys.path.append('../../../')
sys.path.append('../../../gnurabbit/python/')
sys.path.append('../../../common/')
# Import specific modules
from fmc_adc_spec import *
# Import common modules
from ptsexcept import *
import rr
# Import specific modules
from fmc_adc_spec import *
"""
test38: Load gateware, try to access to an un-mapped wishbone address -> the host shouldn't hang!
......
......@@ -12,15 +12,6 @@ import sys
import time
import os
# Add common modules and libraries location to path
sys.path.append('../../../')
sys.path.append('../../../gnurabbit/python/')
sys.path.append('../../../common/')
# Import common modules
from ptsexcept import *
import rr
# Import specific modules
from fmc_adc_spec import *
from fmc_adc import *
......@@ -31,6 +22,10 @@ import find_usb_tty
from PAGE.Agilent33250A import *
from PAGE.SineWaveform import *
# Import common modules
from ptsexcept import *
import rr
"""
test39: Tests saturation with/without gain/offset correction
......
......@@ -12,15 +12,6 @@ import sys
import time
import os
# Add common modules and libraries location to path
sys.path.append('../../../')
sys.path.append('../../../gnurabbit/python/')
sys.path.append('../../../common/')
# Import common modules
from ptsexcept import *
import rr
# Import specific modules
from fmc_adc_spec import *
from fmc_adc import *
......@@ -32,6 +23,10 @@ import find_usb_tty
from PAGE.Agilent33250A import *
from PAGE.SineWaveform import *
# Import common modules
from ptsexcept import *
import rr
"""
test40: Tests hardware internal trigger (threshold, deglitch)
......
......@@ -12,15 +12,6 @@ import sys
import time
import os
# Add common modules and libraries location to path
sys.path.append('../../../')
sys.path.append('../../../gnurabbit/python/')
sys.path.append('../../../common/')
# Import common modules
from ptsexcept import *
import rr
# Import specific modules
from fmc_adc_spec import *
from fmc_adc import *
......@@ -31,6 +22,10 @@ import find_usb_tty
from PAGE.Agilent33250A import *
from PAGE.SineWaveform import *
# Import common modules
from ptsexcept import *
import rr
"""
test41: Tests shots counter
......
......@@ -12,21 +12,17 @@ import sys
import time
import os
# Add common modules and libraries location to path
sys.path.append('../../../')
sys.path.append('../../../gnurabbit/python/')
sys.path.append('../../../common/')
# Import common modules
from ptsexcept import *
import rr