Commit 8a8b58fc authored by Projects's avatar Projects

getsr.py: Display ERR register contents

parent 69efcbe8
......@@ -134,4 +134,27 @@ if __name__ == "__main__":
wrpres = (v & 0x04000000) >> 8
print("White Rabbit : %s" % ("present" if wrpres else "absent"))
# Get error register value and print
v = testelma.read(slot, regs.ERR)
print("Error register : 0x%08x" % v)
print("===============================")
print("I2C timeout error : %s" % ("{0:#01b}".format(int(bool(v & (1 << 0))))[2]))
print("I2C address error : %s" % ("{0:#01b}".format(int(bool(v & (1 << 1))))[2]))
print("Pulse frequency limit error : 0x%02x" % ((v & 0x000000fc) >> 2))
print(" CH1 : %s" % ("{0:#01b}".format(int(bool(v & (1 << 2))))[2]))
print(" CH2 : %s" % ("{0:#01b}".format(int(bool(v & (1 << 3))))[2]))
print(" CH3 : %s" % ("{0:#01b}".format(int(bool(v & (1 << 4))))[2]))
print(" CH4 : %s" % ("{0:#01b}".format(int(bool(v & (1 << 5))))[2]))
print(" CH5 : %s" % ("{0:#01b}".format(int(bool(v & (1 << 6))))[2]))
print(" CH6 : %s" % ("{0:#01b}".format(int(bool(v & (1 << 7))))[2]))
print("Pulse watchdog error : 0x%02x" % ((v & 0x00003f00) >> 8))
print(" CH1 : %s" % ("{0:#01b}".format(int(bool(v & (1 << 8))))[2]))
print(" CH2 : %s" % ("{0:#01b}".format(int(bool(v & (1 << 9))))[2]))
print(" CH3 : %s" % ("{0:#01b}".format(int(bool(v & (1 << 10))))[2]))
print(" CH4 : %s" % ("{0:#01b}".format(int(bool(v & (1 << 11))))[2]))
print(" CH5 : %s" % ("{0:#01b}".format(int(bool(v & (1 << 12))))[2]))
print(" CH6 : %s" % ("{0:#01b}".format(int(bool(v & (1 << 13))))[2]))
testelma.close()
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