Commit 2cf50e56 authored by Denia Bouhired-Ferrag's avatar Denia Bouhired-Ferrag

Merge branch 'DB-dev'

parents 987fa158 cdf54c7d
*.bit
*.bin
*.pdf
\ No newline at end of file
......@@ -9,7 +9,7 @@
\noindent \rule{\textwidth}{.1cm}
\hfill January 15, 2015
\hfill July 13, 2018
\vspace*{3cm}
......@@ -24,7 +24,7 @@
%---------------------------------------------------------------
% name
%---------------------------------------------------------------
\noindent {\Large \textbf{Theodor-Adrian Stana (CERN/BE-CO-HT)}}
\noindent {\Large \textbf{CERN/BE-CO-HT}}
\noindent \rule{\textwidth}{.05cm}
......
......@@ -194,6 +194,9 @@ system to gain remote access to the laptop, the installation of the system can a
on the laptop directly. However, the steps related to network drivers and configuration
should be followed in order to have a properly working PTS system.
Also note that the admin account should be named \verb=pts-administrator=. This account
name is important as it is embedded in the PTS scripts (Password \verb=pts-admin=).
The guide should be followed until \textbf{step 17} of section \textbf{Set up the PTS user account}.
After this step, the guide is SVEC-related and need not be followed. We will continue with
the details in the next section to test our system and network was properly installed.
......@@ -215,6 +218,7 @@ the details in the next section to test our system and network was properly inst
login:admin
password: ADMIN
%>
$
\end{verbatim}
\vspace{11pt}
\item Make sure the ELMA crate has gateware version 2.31 or higher on it. In the SysMon Telnet prompt:
......@@ -263,7 +267,7 @@ We will detail here the simplest of the two, downloading the ready-made archive.
See Appendix~\ref{app:build} for details on the second.
\begin{enumerate}
\item Log in to the \verb=pts= user on the laptop
\item Log in to the \verb=pts-administrator= user on the laptop
\item Open up a terminal window, download the PTS folder structure tarball from OHWR
to the home folder of the \verb=pts= user and extract the archive:
\begin{verbatim}
......@@ -329,9 +333,9 @@ See Appendix~\ref{app:build} for details on the second.
\begin{verbatim}
cd ~
cp .bashrc .bashrc.old
cp /home/pts/ubuntu/t485/config/bashrc.pts .bashrc
cp /home/pts-administrator/ubuntu/t485/config/bashrc.pts .bashrc
cd ~/Desktop/
cp /home/pts/ubuntu/t485/config/*.desktop .
cp /home/pts-administrator/ubuntu/t485/config/*.desktop .
\end{verbatim}
\item Right-click on the terminal icon in the launcher bar at the left and click \textbf{Lock to Launcher}
\item Close the terminal window
......@@ -341,7 +345,7 @@ See Appendix~\ref{app:build} for details on the second.
\begin{itemize}
\item on the Desktop, right-click and select \textbf{Change Desktop Background}
\item hit the \textbf{+} under Wallpapers
\item navigate to \verb=/home/pts/ubuntu/t485/config/=
\item navigate to \verb=/home/pts-administrator/ubuntu/t485/config/=
\item select \verb=t485-background.png= as the background image
\item make sure the scaling of the image is set to \textbf{Zoom}
\end{itemize}
......@@ -404,6 +408,10 @@ In order to build a test system from scratch, follow these steps:
cd conv-ttl-rs485-tst/pts-fm/
make # ... set options here ...
\end{verbatim}
\item Copy the entire \verb=./ubuntu= folder to the \verb=pts-administrator= home directory. Type:
\begin{verbatim}
cp -r ./ubuntu /home/pts-administrator/
\end{verbatim}
\end{enumerate}
This will generate an archive similar to that downloaded in Section~\ref{sec:environment},
......
This diff is collapsed.
This diff is collapsed.
......@@ -3,7 +3,7 @@
---------------------------------------------------------------------------------------
-- File : pts_regs.vhd
-- Author : auto-generated by wbgen2 from pts_regs.wb
-- Created : Thu Dec 4 10:03:35 2014
-- Created : 01/26/18 11:51:31
-- Standard : VHDL'87
---------------------------------------------------------------------------------------
-- THIS FILE WAS GENERATED BY wbgen2 FROM SOURCE FILE pts_regs.wb
......@@ -51,13 +51,13 @@ entity pts_regs is
pts_csr_rst_unlock_o : out std_logic;
pts_csr_rst_unlock_i : in std_logic;
pts_csr_rst_unlock_load_o : out std_logic;
-- Ports for BIT field: 'Reset bit' in reg: 'CSR'
-- Ports for BIT field: 'Reset bit -- active only if RST_UNLOCK is 1' in reg: 'CSR'
pts_csr_rst_o : out std_logic;
pts_csr_rst_i : in std_logic;
pts_csr_rst_load_o : out std_logic;
-- Port for std_logic_vector field: 'switches' in reg: 'CSR'
pts_csr_switch_i : in std_logic_vector(7 downto 0);
-- Port for std_logic_vector field: 'RTM' in reg: 'CSR'
-- Port for std_logic_vector field: 'RTM detection lines' in reg: 'CSR'
pts_csr_rtm_i : in std_logic_vector(5 downto 0);
-- Ports for BIT field: 'I2C communication error' in reg: 'CSR'
pts_csr_i2c_err_o : out std_logic;
......@@ -82,7 +82,9 @@ entity pts_regs is
-- Port for std_logic_vector field: 'Input termination enable' in reg: 'TER'
pts_ter_iterm_o : out std_logic_vector(5 downto 0);
-- Port for std_logic_vector field: 'Output termination enable' in reg: 'TER'
pts_ter_oterm_o : out std_logic_vector(5 downto 0)
pts_ter_oterm_o : out std_logic_vector(5 downto 0);
-- Port for std_logic_vector field: 'PCB version number' in reg: 'TER'
pts_ter_hwvers_i : in std_logic_vector(5 downto 0)
);
end pts_regs;
......@@ -223,16 +225,11 @@ begin
end if;
rddata_reg(5 downto 0) <= pts_ter_iterm_int;
rddata_reg(11 downto 6) <= pts_ter_oterm_int;
rddata_reg(21 downto 16) <= pts_ter_hwvers_i;
rddata_reg(12) <= 'X';
rddata_reg(13) <= 'X';
rddata_reg(14) <= 'X';
rddata_reg(15) <= 'X';
rddata_reg(16) <= 'X';
rddata_reg(17) <= 'X';
rddata_reg(18) <= 'X';
rddata_reg(19) <= 'X';
rddata_reg(20) <= 'X';
rddata_reg(21) <= 'X';
rddata_reg(22) <= 'X';
rddata_reg(23) <= 'X';
rddata_reg(24) <= 'X';
......@@ -279,10 +276,10 @@ begin
pts_csr_tstcs1_o <= pts_csr_tstcs1_int;
-- Reset unlock bit
pts_csr_rst_unlock_o <= wrdata_reg(14);
-- Reset bit
-- Reset bit -- active only if RST_UNLOCK is 1
pts_csr_rst_o <= wrdata_reg(15);
-- switches
-- RTM
-- RTM detection lines
-- I2C communication error
pts_csr_i2c_err_o <= wrdata_reg(30);
-- I2C communication watchdog timeout error
......@@ -297,6 +294,7 @@ begin
pts_ter_iterm_o <= pts_ter_iterm_int;
-- Output termination enable
pts_ter_oterm_o <= pts_ter_oterm_int;
-- PCB version number
rwaddr_reg <= wb_adr_i;
wb_stall_o <= (not ack_sreg(0)) and (wb_stb_i and wb_cyc_i);
-- ACK signal generation. Just pass the LSB of ACK counter.
......
......@@ -326,7 +326,21 @@ peripheral {
size = 6;
access_dev = READ_ONLY;
access_bus = READ_WRITE;
};
field {
name = "PCB version number";
description = "6 bits representing HW/PCB version number \
4 MSB represent HW version number \
2 LSB represent number of execution \
Eg: value 010010 represents PCB version 4.2";
prefix = "hwvers";
align = 16;
type = SLV;
size = 6;
access_dev = WRITE_ONLY;
access_bus = READ_ONLY;
};
};
};
};
---------------------------------------------------------------------------------------
-- Title : Wishbone slave core for Pulse counter registers
---------------------------------------------------------------------------------------
-- File : pulse_cnt_wb.vhd
-- Author : auto-generated by wbgen2 from pulse_cnt_wb.wb
-- Created : Mon Nov 3 09:56:02 2014
-- File : .\pulse_cnt_wb.vhd
-- Author : auto-generated by wbgen2 from .\pulse_cnt_wb.wb
-- Created : 01/26/18 11:52:56
-- Standard : VHDL'87
---------------------------------------------------------------------------------------
-- THIS FILE WAS GENERATED BY wbgen2 FROM SOURCE FILE pulse_cnt_wb.wb
-- THIS FILE WAS GENERATED BY wbgen2 FROM SOURCE FILE .\pulse_cnt_wb.wb
-- DO NOT HAND-EDIT UNLESS IT'S ABSOLUTELY NECESSARY!
---------------------------------------------------------------------------------------
......
This diff is collapsed.
......@@ -103,27 +103,27 @@ NET "inv_o[3]" IOSTANDARD = LVCMOS33;
#------------------------------------------------------------------------------
# Channel LEDs
#------------------------------------------------------------------------------
NET "led_front_o[0]" LOC = H3;
NET "led_front_o[0]" IOSTANDARD = LVCMOS33;
NET "led_front_o[1]" LOC = J4;
NET "led_front_o[1]" IOSTANDARD = LVCMOS33;
NET "led_front_o[2]" LOC = J3;
NET "led_front_o[2]" IOSTANDARD = LVCMOS33;
NET "led_front_o[3]" LOC = K3;
NET "led_front_o[3]" IOSTANDARD = LVCMOS33;
NET "led_front_o[4]" LOC = L4;
NET "led_front_o[4]" IOSTANDARD = LVCMOS33;
NET "led_front_o[5]" LOC = L3;
NET "led_front_o[5]" IOSTANDARD = LVCMOS33;
NET "led_inv_o[0]" LOC = AA4;
NET "led_inv_o[0]" IOSTANDARD = LVCMOS33;
NET "led_inv_o[1]" LOC = AB4;
NET "led_inv_o[1]" IOSTANDARD = LVCMOS33;
NET "led_inv_o[2]" LOC = AB5;
NET "led_inv_o[2]" IOSTANDARD = LVCMOS33;
NET "led_inv_o[3]" LOC = Y5;
NET "led_inv_o[3]" IOSTANDARD = LVCMOS33;
NET "led_front_n_o[0]" LOC = H3;
NET "led_front_n_o[0]" IOSTANDARD = LVCMOS33;
NET "led_front_n_o[1]" LOC = J4;
NET "led_front_n_o[1]" IOSTANDARD = LVCMOS33;
NET "led_front_n_o[2]" LOC = J3;
NET "led_front_n_o[2]" IOSTANDARD = LVCMOS33;
NET "led_front_n_o[3]" LOC = K3;
NET "led_front_n_o[3]" IOSTANDARD = LVCMOS33;
NET "led_front_n_o[4]" LOC = L4;
NET "led_front_n_o[4]" IOSTANDARD = LVCMOS33;
NET "led_front_n_o[5]" LOC = L3;
NET "led_front_n_o[5]" IOSTANDARD = LVCMOS33;
NET "led_front_inv_n_o[0]" LOC = AA4;
NET "led_front_inv_n_o[0]" IOSTANDARD = LVCMOS33;
NET "led_front_inv_n_o[1]" LOC = AB4;
NET "led_front_inv_n_o[1]" IOSTANDARD = LVCMOS33;
NET "led_front_inv_n_o[2]" LOC = AB5;
NET "led_front_inv_n_o[2]" IOSTANDARD = LVCMOS33;
NET "led_front_inv_n_o[3]" LOC = Y5;
NET "led_front_inv_n_o[3]" IOSTANDARD = LVCMOS33;
#------------------------------------------------------------------------------
# Status LEDs
......@@ -158,6 +158,23 @@ NET "led_gf_syspw_o" IOSTANDARD = LVCMOS33;
NET "led_ttl_i2c_o" LOC = E6;
NET "led_ttl_i2c_o" IOSTANDARD = LVCMOS33;
#------------------------------------------------------------------------------
# PCB version pins
#------------------------------------------------------------------------------
NET "pcbrev_i[0]" LOC = A3;
NET "pcbrev_i[0]" IOSTANDARD = LVCMOS33;
NET "pcbrev_i[1]" LOC = A4;
NET "pcbrev_i[1]" IOSTANDARD = LVCMOS33;
NET "pcbrev_i[2]" LOC = R4;
NET "pcbrev_i[2]" IOSTANDARD = LVCMOS33;
NET "pcbrev_i[3]" LOC = P4;
NET "pcbrev_i[3]" IOSTANDARD = LVCMOS33;
NET "pcbrev_i[4]" LOC = V5;
NET "pcbrev_i[4]" IOSTANDARD = LVCMOS33;
NET "pcbrev_i[5]" LOC = Y3;
NET "pcbrev_i[5]" IOSTANDARD = LVCMOS33;
#=============================================================================
# Rear panel signals
#=============================================================================
......
This diff is collapsed.
......@@ -20,6 +20,7 @@ all:
cp ubuntu/$(BOARD)/pyts/pts.py ubuntu/$(BOARD)/pts
cp ubuntu/$(BOARD)/pyts/jpts.py ubuntu/$(BOARD)/jpts
cp ubuntu/$(BOARD)/pyts/one.py ubuntu/$(BOARD)/one
ln -s pyts/hwvertest.py ubuntu/$(BOARD)/hwvertest.py
ln -s pyts/dac_vcxo_pll.py ubuntu/$(BOARD)/test01.py
ln -s pyts/leds.py ubuntu/$(BOARD)/test02.py
ln -s pyts/ttl_pulse_switch.py ubuntu/$(BOARD)/test03.py
......@@ -32,10 +33,9 @@ all:
mkdir -p ubuntu/$(BOARD)/boot
mv ubuntu/$(BOARD)/shell/program ubuntu/$(BOARD)/boot
mv ubuntu/$(BOARD)/shell/flash ubuntu/$(BOARD)/boot
wget -P ubuntu/$(BOARD)/boot http://www.ohwr.org/attachments/download/3738/pts.bit
wget -P ubuntu/$(BOARD)/boot https://www.ohwr.org/attachments/5853/pts.bit
wget -P ubuntu/$(BOARD)/boot http://www.ohwr.org/attachments/download/3710/flash_load.bit
wget -P ubuntu/$(BOARD)/boot http://www.ohwr.org/attachments/download/3733/golden-v0.0_release-v1.0.bin
wget -P ubuntu/$(BOARD)/boot https://www.ohwr.org/attachments/5860/golden-v0.1_release-v2.0.bin
chmod a+x ubuntu/$(BOARD)/shell/*
chmod a+x ubuntu/$(BOARD)/boot/*
chmod a+x ubuntu/$(BOARD)/jpts
......
......@@ -3,7 +3,7 @@
Version=1.0
Name=Copy Log to USB
Comment=Copy log and info files to USB key
Exec=gnome-terminal --title "Copy to USB Key" -e "bash -c 'cp /home/pts/ubuntu/t485/log/t485* /media/pts/log'"
Exec=gnome-terminal --title "Copy to USB Key" -e "bash -c 'cp /home/pts-administrator/ubuntu/t485/log/t485* /media/pts-administrator/log'"
Icon=/usr/share/icons/Humanity/apps/48/gnome-session-switch.svg
Terminal=false
Type=Application
......
......@@ -3,7 +3,7 @@
Version=1.0
Name=VME OFF
Comment=Switch off crate
Exec=/home/pts/ubuntu/t485/shell/men-off
Exec=/home/pts-administrator/ubuntu/t485/shell/men-off
Icon=/usr/share/icons/LoginIcons/apps/48/system-shutdown.svg
Terminal=true
Type=Application
......
......@@ -3,7 +3,7 @@
Version=1.0
Name=VME ON
Comment=Switch on crate
Exec=/home/pts/ubuntu/t485/shell/men-on
Exec=/home/pts-administrator/ubuntu/t485/shell/men-on
Icon=/usr/share/icons/LoginIcons/apps/48/view-refresh.svg
Terminal=true
Type=Application
......
......@@ -3,8 +3,8 @@
Version=1.0
Name=Run One PTS CONV-TTL-RS485 Test
Comment=Automated testing for the CONV-TTL-RS485 board
Exec=gnome-terminal --geometry 81x32+0+0 --title "PTS Run One Window" -e "bash -c 'cd /home/pts/ubuntu/t485/;./one'"
Icon=/home/pts/ubuntu/t485/config/pts-ico-2.png
Exec=gnome-terminal --geometry 81x32+0+0 --title "PTS Run One Window" -e "bash -c 'cd /home/pts-administrator/ubuntu/t485/;./one'"
Icon=/home/pts-administrator/ubuntu/t485/config/pts-ico-2.png
Terminal=false
Type=Application
Categories=Utility;Application;
......
......@@ -3,7 +3,7 @@
Version=1.0
Name=Make log.tar.gz USB zip
Comment=Make tarball from log data on USB key
Exec=/home/pts/ubuntu/t485/shell/tar-log
Exec=/home/pts-administrator/ubuntu/t485/shell/tar-log
Icon=/usr/share/icons/Humanity/devices/48/gnome-dev-zipdisk.svg
Terminal=true
Type=Application
......
......@@ -3,7 +3,7 @@
Version=1.0
Name=PTS Expert Tools
Comment=PTS Utilities
Exec=/usr/bin/nautilus /home/pts/ubuntu/t485/config/ExpertTools/
Exec=/usr/bin/nautilus /home/pts-administrator/ubuntu/t485/config/ExpertTools/
Icon=/usr/share/icons/Humanity/apps/48/gconf-editor.svg
Terminal=false
Type=Application
......
......@@ -3,8 +3,8 @@
Version=1.0
Name=Run PTS CONV-TTL-RS485
Comment=Automated testing for the CONV-TTL-RS485 board
Exec=gnome-terminal --geometry 81x32+0+0 --title "PTS Main Window" -e "bash -c 'cd /home/pts/ubuntu/t485/; ./pts'"
Icon=/home/pts/ubuntu/t485/config/pts-ico-2.png
Exec=gnome-terminal --geometry 81x32+0+0 --title "PTS Main Window" -e "bash -c 'cd /home/pts-administrator/ubuntu/t485/; ./pts'"
Icon=/home/pts-administrator/ubuntu/t485/config/pts-ico-2.png
Terminal=false
Type=Application
Categories=Utility;Application;
......
......@@ -3,7 +3,7 @@
Version=1.0
Name=Show PTS Info
Comment=Show PTS info
Exec=bash -c "cd /home/pts/ubuntu/t485/shell/; ./show-info"
Exec=bash -c "cd /home/pts-administrator/ubuntu/t485/shell/; ./show-info"
Icon=/usr/share/icons/Humanity/apps/48/xfce-system-info.svg
Terminal=false
Type=Application
......
......@@ -3,7 +3,7 @@
Version=1.0
Name=Show PTS Log
Comment=Show PTS log
Exec=bash -c "cd /home/pts/ubuntu/t485/shell/; ./show-log"
Exec=bash -c "cd /home/pts-administrator/ubuntu/t485/shell/; ./show-log"
Icon=/usr/share/icons/Humanity/apps/48/xfce-man.svg
Terminal=false
Type=Application
......
......@@ -66,11 +66,11 @@ def main(bus,tname,inf,log):
"""
tests : Flash chip IC62
uses : golden-v0.0_release-v1.0.bin and flashtest.py
uses : golden-v0.1_release-v2.0.bin and flashtest.py
"""
GWVERS_RELEASE = 1.0
GWVERS_GOLDEN = 0.0
GWVERS_RELEASE = 2.0
GWVERS_GOLDEN = 0.1
# Set the precision of gateware versions based on the number of digits the
# fractional part thereof has; this is done to avoid exceptions in the
......
##_______________________________________________________________________________________________
##
## CONV-TTL-RS485 PTS
##
## CERN,BE/CO-HT
##_______________________________________________________________________________________________
##
##-----------------------------------------------------------------------------------------------
##
## CONV-TTL-RS485 pcb version
##
##-----------------------------------------------------------------------------------------------
##
## Description Test whether the version of PCB is the expected one
##
##
## Authors Maciej Lipinski (maciej.lipinski@cern.ch)
## Website http://www.ohwr.org/projects/pts
## Date 17/08/2017
##-----------------------------------------------------------------------------------------------
##
##------------------------------------------------------------------------------------------------
## GNU LESSER GENERAL PUBLIC LICENSE
## ------------------------------------
## This source file is free software; you can redistribute it and/or modify it under the terms of
## the GNU Lesser General Public License as published by the Free Software Foundation; either
## version 2.1 of the License, or (at your option) any later version.
## This source is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
## without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
## See the GNU Lesser General Public License for more details.
## You should have received a copy of the GNU Lesser General Public License along with this
## source; if not, download it from http://www.gnu.org/licenses/lgpl-2.1.html
##-------------------------------------------------------------------------------------------------
##-------------------------------------------------------------------------------------------------
## Import
##-------------------------------------------------------------------------------------------------
# Import system modules
import sys
sys.path.append("log/")
import time
import os, errno, re, sys, struct
import os.path
import traceback
import glob
import binascii
# Import common modules
from ctypes import *
from ptsexcept import *
from vv_pts import *
from ptsdefine import *
##-------------------------------------------------------------------------------------------------
## main --
##-------------------------------------------------------------------------------------------------
def main(bus,tname,inf,log):
"""
tests : Hardware version
uses : pts.bit and hwvertest.py
"""
HWVERS_target = 4.0
pel = PTS_ERROR_LOGGER(inf,log)
try:
# Read PCB version: a 6 bits representing HW/PCB version number
# 4 MSB represent HW version number (major)
# 2 LSB represent number of execution (minor)
# Eg: value 010010 represents PCB version 4.2
hwvers = (bus.vv_read(TER) & 0x3F0000) >> TER_HWVERS_OFS
maj = int(hwvers >> 2)
min = float(hwvers & 0x03)
min /= 10
hwvers = maj + min
# and now check if appropriate
if (hwvers == HWVERS_target):
msg = "HW/PCB version correct: %2.1f\n" % (hwvers)
inf.write(msg)
else:
msg = "ERROR: HW/PCBe version (%2.1f) incorrect - expected %2.1f" % (hwvers, HWVERS_target)
pel.set(msg)
print "-->%s" % msg
return pel.get()
except BusException, e:
raise PtsError("SKT Exception: %s" % (e))
except BusWarning, e:
raise PtsError("SKT Warning: %s" % (e))
......@@ -48,7 +48,7 @@
## Import
##------------------------------------------------------------------------------------------------
import sys
sys.path.append('.')
sys.path.append(".")
sys.path.append("pyts")
import ptsexcept
import ptsdefine
......@@ -193,65 +193,99 @@ if __name__ == '__main__':
except BusWarning, e:
print "Warning:Bus Exception: %s" % (e)
# Start running the tests.
for t in tns:
# Test version of HW/PCB before running any other tests
tname = "hwvertest"
try:
# First load a firmware and read back a register to confirm correct load.
if bus.vv_load() == 0:
msg = "INFO: Found CONV-TTL-RS485 board in slot %d\n" % (lun)
inf.write(msg + '\n')
# The test is passed the test name, the log and info files and the
# bus object. The test program returns the number of errors that
# occured. If no errors occur, the test PASSes, otherwise it FAILs.
cc = run_test(tname,bus,inf,log)
if cc == 0:
msg = "PASS: %s" % (tname)
log.write(msg + '\n')
inf.write(msg + '\n')
print msg
else:
msg = "FAIL: %s->%s" % (tname, lnk_ptr(tname))
log.write(msg + '\n')
inf.write(msg + '\n')
print msg
tname = "test%02d" % t[0]
pyt = "%s/%s.py" % (dir, tname)
except Exception, e:
if options.debug:
print e
traceback.print_exc()
if path.exists(pyt) and path.isfile(pyt) and access(pyt, R_OK):
msg = "FAIL: %s->%s (%s)" % (tname, lnk_ptr(tname), e)
log.write(msg + '\n')
inf.write(msg + '\n')
print msg
for n in range(t[1]):
# Start running the tests, only if the HW/PCB version is OK
if cc == 0:
for t in tns:
if n == 10:
msg = "Printing suppresses after 10 runs"
print msg
log.write('\n' + msg + '\n')
inf.write('\n' + msg + '\n')
tname = "test%02d" % t[0]
pyt = "%s/%s.py" % (dir, tname)
if n < 10:
msg = "Run:%d Begin:%s" % (n+1,tname)
print msg
log.write('\n' + msg + '\n')
inf.write('\n' + msg + '\n')
if path.exists(pyt) and path.isfile(pyt) and access(pyt, R_OK):
try:
# First load a firmware and read back a register to confirm correct load.
if bus.vv_load() == 0:
msg = "INFO: Found CONV-TTL-RS485 board in slot %d\n" % (lun)
inf.write(msg + '\n')
for n in range(t[1]):
# Each test is passed the test name, the log and info files and the
# bus object. The test program is expected to return the number of
# errors that occured. If no errors occur, the test PASSes, otherwise
# it FAILs.
cc = run_test(tname,bus,inf,log)
if cc == 0:
msg = "PASS: %s" % (tname)
log.write(msg + '\n')
inf.write(msg + '\n')
if n == 10:
msg = "Printing suppresses after 10 runs"
print msg
log.write('\n' + msg + '\n')
inf.write('\n' + msg + '\n')
if n < 10:
msg = "Run:%d Begin:%s" % (n+1,tname)
print msg
else:
msg = "FAIL: %s->%s" % (tname, lnk_ptr(tname))
log.write('\n' + msg + '\n')
inf.write('\n' + msg + '\n')
try:
# First load a firmware and read back a register to confirm correct load.
if bus.vv_load() == 0:
msg = "INFO: Found CONV-TTL-RS485 board in slot %d\n" % (lun)
inf.write(msg + '\n')
# Each test is passed the test name, the log and info files and the
# bus object. The test program is expected to return the number of
# errors that occured. If no errors occur, the test PASSes, otherwise
# it FAILs.
cc = run_test(tname,bus,inf,log)
if cc == 0:
msg = "PASS: %s" % (tname)
log.write(msg + '\n')
inf.write(msg + '\n')
print msg
else:
msg = "FAIL: %s->%s" % (tname, lnk_ptr(tname))
log.write(msg + '\n')
inf.write(msg + '\n')
print msg
except Exception, e:
if options.debug:
print e
traceback.print_exc()
msg = "FAIL: %s->%s (%s)" % (tname, lnk_ptr(tname), e)
log.write(msg + '\n')
inf.write(msg + '\n')
print msg
except Exception, e:
if options.debug:
print e
traceback.print_exc()
msg = "FAIL: %s->%s (%s)" % (tname, lnk_ptr(tname), e)
log.write(msg + '\n')
inf.write(msg + '\n')
print msg
if n < 10:
msg = "Run:%d End:%s\n" % (n+1,tname)
print msg
log.write(msg + '\n')
inf.write(msg + '\n')
if n < 10:
msg = "Run:%d End:%s\n" % (n+1,tname)
print msg
log.write(msg + '\n')
inf.write(msg + '\n')
# Close the bus and the files
bus.vv_close()
......
......@@ -32,6 +32,7 @@
##
## Authors Julian Lewis (Julian.Lewis@cern.ch)
## Theodor Stana (t.stana@cern.ch)
## Denia Bouhired (denia.bouhired@gmail.com)
## Website http://www.ohwr.org/projects/conv-ttl-rs485
## Date 30/10/2014
##-------------------------------------------------------------------------------------------------
......@@ -64,6 +65,8 @@ import subprocess
import re
# Import ptsdefine module to avoid wrong `make's
from ptsexcept import *
from vv_pts import *
from ptsdefine import *
##-------------------------------------------------------------------------------------------------
......@@ -104,6 +107,7 @@ if __name__ == '__main__':
# Turn off the VME crate
men_off()
bus = SKT(ELMASLOT)
# Scan the first barcode
while True:
sn1 = raw_input("--> Scan the 1st barcode: ")
......@@ -182,16 +186,58 @@ if __name__ == '__main__':
subprocess.call("grep PASS log/*.log", shell=True, stdout=sys.stdout, stderr=sys.stderr)
subprocess.call("grep FAIL log/*.log", shell=True, stdout=sys.stdout, stderr=sys.stderr)
# Save results on USB key...
print "\nSaving test results on USB key"
# Save results on local folder...
print "\nSaving test results in /home/pts-administrator/pts/log/t485"
try:
subprocess.call("mkdir -p /media/pts/log", shell=True, stdout=sys.stdout, stderr=sys.stderr)
subprocess.call("cp log/*.log /media/pts/log", shell=True, stdout=sys.stdout, stderr=sys.stderr)
subprocess.call("cp log/*.inf /media/pts/log", shell=True, stdout=sys.stdout, stderr=sys.stderr)
subprocess.call("mkdir -p /home/pts-administrator/pts/log/t485", shell=True, stdout=sys.stdout, stderr=sys.stderr)
subprocess.call("cp log/*.log /home/pts-administrator/pts/log/t485", shell=True, stdout=sys.stdout, stderr=sys.stderr)
subprocess.call("cp log/*.inf /home/pts-administrator/pts/log/t485", shell=True, stdout=sys.stdout, stderr=sys.stderr)
except e:
print "ERROR: No access to USB key at /media/pts"
print "ERROR: No access to directory /home/pts-administrator/pts/t485"
print e
#-------------------------------------------------------------------------------
# Reading board unique ID and storing to separate log file
#-------------------------------------------------------------------------------
# ... power-cycle the crate
print "VME Crate power-cycle..."
men_off()
time.sleep(3)
men_on()
time.sleep(10)
#Read unique board ID
IDMS = bus.vv_read(UIDREGMS)
IDLS = bus.vv_read(UIDREGLS)
#Generate log file
# Generate output file named according to current time
fname = time.strftime("serial-num-CTDAP-%Y-%m-%d", time.localtime()) + ".txt"