Commit 7dabae5e authored by Marek Gumiński's avatar Marek Gumiński

Test04 has multiple short delays instead of one long one.

parent 3b003c9f
...@@ -13,7 +13,8 @@ import ptsexcept ...@@ -13,7 +13,8 @@ import ptsexcept
import time import time
REPETITIONS = 20
DELAY = 0.5
def main (card=None, default_directory='.',suite=None, serial=""): def main (card=None, default_directory='.',suite=None, serial=""):
...@@ -33,46 +34,52 @@ def main (card=None, default_directory='.',suite=None, serial=""): ...@@ -33,46 +34,52 @@ def main (card=None, default_directory='.',suite=None, serial=""):
# any error there causes critical error and test termination # any error there causes critical error and test termination
dut = fmc.fmcmasterfip(carrier, abspath, util.FIRMWARE_PATH) dut = fmc.fmcmasterfip(carrier, abspath, util.FIRMWARE_PATH)
time.sleep(10)
############################################################################### ###############################################################################
util.section_msg("Reading and verifying unique ID") util.section_msg("Reading and verifying unique ID")
id = dut.get_unique_id() # thermometer is read by gateware in some time intervals
if id != -1: # in order to avert using long sleep
util.info_msg("Unique ID read from DS18B20: %.12X" % id) # DS18B20 core is polled in small intervals
for i in xrange(REPETITIONS):
time.sleep(DELAY)
id = dut.get_unique_id()
if (id & 0xff) == 0x28:
util.info_msg("Unique IDs match pattern specified in datasheet")
test_results['DS18B20 ID verification'] = 1
break;
# if correct ID is not found in 10 repetitions
# it is assumed to be wrong
else: else:
util.info_msg("Failed to read unique ID from DS18B20" % id)
test_results['Get ID from DS18B20'] = 1 if id != -1 else 0
###############################################################################
if (id & 0xff) != 0x28:
util.info_msg("Unique IDs LSB: 0x%X is different then 0x28 as specified in datasheet" % (id & 0xff)) util.info_msg("Unique IDs LSB: 0x%X is different then 0x28 as specified in datasheet" % (id & 0xff))
else: test_results['DS18B20 ID verification'] = 0
util.info_msg("Unique IDs match pattern specified in datasheet")
test_results['DS18B20 ID verification'] = 1 if (id & 0xff) == 0x28 else 0
############################################################################### ###############################################################################
util.section_msg("Verification of temperature") util.section_msg("Verification of temperature")
temperature=dut.get_temp() for i in xrange(REPETITIONS):
util.info_msg("Read board temperature: %d" % temperature) time.sleep(DELAY)
temperature = dut.get_temp()
if temperature > util.maxtemp:
util.err_msg( "Temperature exceeds %d C" % util.maxtemp ) if (temperature >= util.mintemp) and (temperature <= util.maxtemp):
test_results['Temperature value'] = 0 util.info_msg("Read correct board temperature: %d" % temperature)
test_results['Temperature value'] = 1
elif temperature < util.mintemp: break
util.err_msg( "Temperature is lower then %d C" % util.mintemp ) else:
test_results['Temperature value'] = 0 test_results['Temperature value'] = 0
if temperature > util.maxtemp:
util.err_msg( "Temperature exceeds %d C" % util.maxtemp )
else :
util.err_msg( "Temperature is lower then %d C" % util.mintemp )
else:
test_results['Temperature value'] = 1
############################################################################### ###############################################################################
errors = util.summarise_test_results( testname, test_results) errors = util.summarise_test_results( testname, test_results)
......
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