Commit c2979b67 authored by Matthieu Cattin's avatar Matthieu Cattin

Print read and expected values. In case of error raise exception at the end of the test.

parent 5f91417d
......@@ -20,7 +20,7 @@ test05: Test LTC2174 ADC
Note: Requires test00.py to run first to load the firmware!
"""
TEST_PATTERN = 0x3A5
TEST_PATTERN = 0x3FFF
NB_CHANNELS = 4
def main (default_directory='.'):
......@@ -47,6 +47,7 @@ def main (default_directory='.'):
# Read and check test pattern
pattern = fmc.get_testpat()
if(TEST_PATTERN != pattern):
print('pattern:%.4X read:%.4X')%(TEST_PATTERN, pattern)
raise PtsError('Cannot access LTC2174 ADC through SPI')
# Print LTC2174 configuration
......@@ -57,11 +58,16 @@ def main (default_directory='.'):
raise PtsError('SerDes are not synchronised')
# Read channels current data register
error=0
for i in range(1,NB_CHANNELS+1):
adc_value = fmc.get_current_adc_value(i)
print('ADC channel %d value:0x%.4X') % (i, (adc_value>>2))
if(TEST_PATTERN != (adc_value>>2)):
raise PtsError('Data read from LTC2174 ADC are wrong for channel %d'%i)
print('ADC channel %d value:0x%.4X expected:0x%.4X') % (i, adc_value, (TEST_PATTERN<<2))
if((TEST_PATTERN<<2) != adc_value):
print('Error: value mismatch!')
error += 1
if(error != 0):
raise PtsError('Data read from LTC2174 ADC are wrong for one or more channels.')
if __name__ == '__main__' :
......
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