Commit 225fa8d1 authored by Matthieu Cattin's avatar Matthieu Cattin

Add a max limit of retry (reload firmware) in test09.

parent c0fe7597
......@@ -38,6 +38,8 @@ SSR_SET_SLEEP = 0.05
ACQ_TIMEOUT = 10
MAX_FIRMWARE_RELOAD = 10
PRE_TRIG_SAMPLES = 1000
POST_TRIG_SAMPLES = 1000
NB_SHOTS = 1
......@@ -153,7 +155,7 @@ def acquisition(gnum, pages, fmc, channel_nb, channel_data):
page1_data = gnum.get_memory_page(1)
page_zeros = [0] * len(page1_data)
if((page1_data_before_dma == page1_data) or (page_zeros == page1_data)):
print('#################### Acquisition or DMA error.')
print('### Acquisition or DMA error. ###')
#raise PtsWarning('Acquisition or DMA error.')
return -1
for i in range(len(page1_data)):
......@@ -206,6 +208,7 @@ def main (default_directory='.'):
# Test frequency response of all channels
ch_diff = []
j = 0
error_cnt = 0
while(j < len(points)):
#print('begin loop j=%d')%(j)
set_awg_freq(gen, sine, points[j][0])
......@@ -214,7 +217,13 @@ def main (default_directory='.'):
time.sleep(SSR_SET_SLEEP)
channel_data = []
error = acquisition(gnum, pages, fmc, i, channel_data)
if(j==1):
error -= 1
if(error != 0):
error_cnt += 1
print('RETRY: %d')%(error_cnt)
if(MAX_FIRMWARE_RELOAD < error_cnt):
raise PtsError('Maximium of %d retry exceeded (channel:%d, freq:%2.3fMHz)'%(MAX_FIRMWARE_RELOAD, i, points[j][0]/1E6))
load_firmware(default_directory)
fmc_adc_init(spec, fmc)
#time.sleep(2)
......@@ -229,6 +238,7 @@ def main (default_directory='.'):
raise PtsError('Channel %d frequency response is out of range at freq:%2.3fMHz'%(i, points[j][0]/1E6))
if(error == 0):
j += 1
error_cnt = 0
#print('j++')
#print('end loop j=%d')%(j)
......
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