Commit fa72b27e authored by Theodor-Adrian Stana's avatar Theodor-Adrian Stana

Changes in diagnostics scripts, accounting for new memory map

parent fab59cbd
......@@ -75,11 +75,11 @@ if __name__ == "__main__":
# Strip SWITCHES and print
switches = (v & 0xff00) >> 8
print("Switches : 0x%02x" % switches)
if not (switches & 0x80):
if (switches & 0x80):
print(" TTL repetition : on")
else:
print(" TTL repetition : off")
if not (switches & 0x01):
if (switches & 0x01):
print(" Glitch filter : on")
else:
print(" Glitch filter : off")
......@@ -89,13 +89,19 @@ if __name__ == "__main__":
rtmm = rtm & 0x7
rtmp = (rtm & 0x3f) >> 3
print("RTM detection : 0x%02x" % rtm)
print(" RTMM[2:0] : %s" % ("{0:#03b}".format(rtmm)[2:]))
print(" RTMP[2:0] : %s" % ("{0:#03b}".format(rtmp)[2:]))
print(" RTMM[2:0] : %s" % ("{0:#05b}".format(rtmm)[2:]))
print(" RTMP[2:0] : %s" % ("{0:#05b}".format(rtmp)[2:]))
# Strip the other status bits and print
print("I2C timeout error : %s" % ("{0:#01b}".format(int(bool(v & (1 << 22))))[2]))
print("White Rabbit pres. : %s" % ("{0:#01b}".format(int(bool(v & (1 << 23))))[2]))
print("I2C address error : %s" % ("{0:#01b}".format(int(bool(v & (1 << 24))))[2]))
print("Pulse miss error : %s" % ("{0:#01b}".format(int(bool(v & (1 << 25))))[2]))
print("Pulse miss error : 0x%02x" % ((v & 0x7e000000) >> 24))
print(" CH1 : %s" % ("{0:#01b}".format(int(bool(v & (1 << 25))))[2]))
print(" CH2 : %s" % ("{0:#01b}".format(int(bool(v & (1 << 26))))[2]))
print(" CH3 : %s" % ("{0:#01b}".format(int(bool(v & (1 << 27))))[2]))
print(" CH4 : %s" % ("{0:#01b}".format(int(bool(v & (1 << 28))))[2]))
print(" CH5 : %s" % ("{0:#01b}".format(int(bool(v & (1 << 29))))[2]))
print(" CH6 : %s" % ("{0:#01b}".format(int(bool(v & (1 << 30))))[2]))
testelma.close()
......@@ -244,7 +244,7 @@ if __name__ == "__main__":
print("Unexpected error: ", sys.exc_info()[0])
# Create onewire and thermometer objects
onewire = COpenCoresOneWire(testelma, 1, 0x80, 99, 19)
onewire = COpenCoresOneWire(testelma, 1, 0x200, 99, 19)
ds18b20 = CDS18B20(onewire, 0)
# Reading of unique ID
......
......@@ -3,6 +3,7 @@ Scripts for the time-tagging logic
On the time-tagging side, the following scripts exist:
getlatestts.py -- Read the latest timestamp registers (CHxLTS*R)
rdtb.py -- Read samples of the tag buffer while they exist
tsdiff.py -- Output the difference between two time-stamps from the buffer
tsset.py -- set TAI time stamp value, clearing the cycles counter in the
......
#!/usr/bin/python
#===============================================================================
# CERN (BE-CO-HT)
# EI2C global definitions file
# Get latest timestamp
#===============================================================================
# author: Theodor Stana (t.stana@cern.ch)
#
# date of creation: 2014-03-05
# date of creation: 2014-08-18
#
# version: 1.0
#
# description:
#
# This module defines some global constants that are used by other scripts in
# the software suite. The constants and their definitions are in the code
# below.
# dependencies:
#
# references:
#===============================================================================
# GNU LESSER GENERAL PUBLIC LICENSE
#===============================================================================
......@@ -28,16 +28,49 @@
# source; if not, download it from http://www.gnu.org/licenses/lgpl-2.1.html
#===============================================================================
# last changes:
# 2014-03-05 Theodor Stana File created
# 2014-08-18 Theodor Stana File created
#===============================================================================
# TODO: -
#===============================================================================
import sys
sys.path.append("../../ei2c")
from ei2c import *
import ei2cdefine
# Hostname, username and password
HNAME = ""
USER = ""
PWD = ""
if __name__ == "__main__":
# Get the IP, user and password for the ELMA crate from ei2cdefine.py
ip = ei2cdefine.HNAME
user = ei2cdefine.USER
pwd = ei2cdefine.PWD
testelma = EI2C(ip, user, pwd)
testelma.open()
# Ask for slot number
while 1:
try:
slot = raw_input("Slot no.: ")
slot = int(slot)
break
except TypeError as e:
print("Please input a decimal slot number.")
except SlotError as e:
print(e.strerror)
except KeyboardInterrupt:
sys.exit();
except:
print("Unexpected error: ", sys.exc_info()[0])
# Get and print latest timestamps
addr = 0x40
for i in range(6):
cyc = testelma.read(slot, addr)
tail = testelma.read(slot, addr + 4)
taih = testelma.read(slot, addr + 8) & 0x000000ff
ns = cyc * 8
s = (taih << 32) | tail
print("CH%d: %d.%09d sec" % (i+1, s, ns))
addr += 0x0c
testelma.close()
# Boolean to tell the ei2c.py module whether to create a dump file for the ELMA
# command replies
DUMP = False
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