SNLA267A March 2019 – June 2019 DS90UB953-Q1 , DS90UB954-Q1 , DS90UB960-Q1
## TimeTillLock_953.py
##
## revision 1.0 6/13/17
##
########
#Note, run this script locally on 953 before powering on the 953. Then power on the 953 within 7 seconds
#Resolution of timing can be tweaked using the resolution variable (in number of seconds)
########################################################
# Variables
import time
UB953ID = 0x30
resolution = 0.1
temp = 0x00
count = 0
pwd = 0x00
temp2 = 0
print "\n"
########################################################
# This waits 7 seconds for 953 to be powered on until continuing with script
while ((pwd & 0x40) != 0x40):
pwd = board.ReadI2C(UB953ID, 0x51, 1)
time.sleep(resolution)
temp2 = temp2 + resolution
if temp2 > 7:
pwd = 0x40
print "Timed out"
#########################################################
# Reset can be used to simulate powering up the system
#time.sleep(1.5)
#board.WriteI2C(UB953ID,0x01,0x01) # Digital Reset without clearing registers
#board.WriteI2C(UB953ID,0x01,0x02) # Digital Reset with clearing registers
##############################################################
# Prints general status for 35 seconds or until lock occurs
while ((temp & 0x05) != 0x05):
temp = board.ReadI2C(UB953ID,0x52,1)
print "General Status = ", hex(temp)
time.sleep(resolution)
count = count + resolution
if count > 35:
temp = 0x05
print "time out waiting for lock"
print "Lock established in approximately ", count, " seconds."
print "\n"