Commit 34ceef04 authored by Theodor-Adrian Stana's avatar Theodor-Adrian Stana

sw-fm: Updated TTL pulse test

The test now gives off better output and uses the new bit names in the CSR.
parent b7322e85
......@@ -122,6 +122,12 @@ class CPulseCounter:
def wr_reg(self, addr, val):
self.bus.vv_write(self.base + addr,val)
def wr_out_cnt(self, chan, val):
return self.wr_reg((chan-1)*8, val)
def wr_in_cnt(self, chan, val):
return self.wr_reg((chan-1)*8 + 4, val)
def rd_reg(self, addr):
return self.bus.vv_read(self.base + addr)
......@@ -144,17 +150,25 @@ def main(bus, tname, inf, log):
pel = PTS_ERROR_LOGGER(inf, log)
chans = ['1', '2', '3', '4', '5', '6', 'A', 'B', 'C', 'D']
try:
# Initialize a pulse counter object
pc = CPulseCounter(bus, PULSE_CNT_BASE)
# Enable pulse generation while keeping the status LEDs sequencing
val = (1 << CSR_TTL_EN_OFS)|(1 << CSR_STAT_LED_EN_OFS)
# Clear pulse counters for the TTL channels
for i in range(1, 11):
pc.wr_out_cnt(i, 0)
pc.wr_in_cnt(i, 0)
# Enable pulse generation
val = bus.vv_read(CSR)
val |= (1 << CSR_TTLPT_OFS)
bus.vv_write(CSR, val)
# wait one second, then disable pulse generation
time.sleep(1)
val = 1 << CSR_STAT_LED_EN_OFS
val &= ~(1 << CSR_TTLPT_OFS)
bus.vv_write(CSR, val)
# Read the channel registers
......@@ -166,17 +180,23 @@ def main(bus, tname, inf, log):
# First, check for all-zeroes in counters, indicating enable NAND gate failure
if all(ic == 0 for ic in ic_arr):
msg = "ERROR: No pulses received, check enable NAND gate IC10"
msg = "ERROR: No pulses received - check daisy-chain, or enable NAND gate IC10"
pel.set(msg)
# Then, check if the number of pulses sent on the previous channel has
# been received correctly on the current channel
for i in range(0,10):
if (ic_arr[i] != 0) and (ic_arr[i] == oc_arr[i-1]):
msg = "CH%d received %d pulses and sent %d pulses - good\n" % (i+1, ic_arr[i], oc_arr[i])
msg = "Ch%s received %d pulses and sent %d pulses - good\n" % (chans[i], ic_arr[i], oc_arr[i])
inf.write(msg)
else:
msg = "ERROR: CH%d received %d pulses and sent %d pulses" % (i+1, ic_arr[i], oc_arr[i])
msg = "ERROR: Ch%s received %d pulses and sent %d pulses - " % (chans[i], ic_arr[i], oc_arr[i])
if (i == 0):
msg += "check daisy-chain, IC6 or IC2, or IC3"
elif (i < 6):
msg += "check daisy-chain, IC6 or IC2"
else:
msg += "check daisy-chain, IC11 or IC3"
pel.set(msg)
# Switches test
......
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