diff --git a/docs/how-to/finedelay-test.rst b/docs/how-to/finedelay-test.rst new file mode 100644 index 0000000..d6b44b6 --- /dev/null +++ b/docs/how-to/finedelay-test.rst @@ -0,0 +1,30 @@ +Test the finedelay +================== + +1. Plug two LVDSOUT pins to an oscilloscope and use rising edge of LVDSOUT1 + as trigger. + +2. Enable CLOCK1, set its period to the minimum(0.016us) and use it as input for + LVDSOUT1 and LVDSOUT2. + +.. image:: ../images/finedelay_test_layout.png + +3. Set oct delay and fine delay to 0 in both LVDSOUTs. + +4. For LVDSOUT2, set oct delay from 1 to 7 and verify in the oscilloscope that + you get delays from 1ns to 7ns respectively, then set oct delay back to 0. + +5. Read initial one ns of LVDSOUT2 and use it as a reference to test fine delay. + + 5.1 Set fine delay to half of initial one ns and verify in the oscilloscope + that the delay is around 500ps. + + 5.2 Set fine delay to a quarter of initial one ns and verify in the + oscilloscope that the delay is around 250ps. + + 5.3 .... Repeat halving until you reach the limit of your oscilloscope ... + +6. Run a script_ that sweeps all fine delay values for each oct delay value and + observe how LVDSOUT2 gets delayed very smoothly. + +.. _script: https://raw.githubusercontent.com/PandABlocks/PandABlocks.github.io/refs/heads/main/scripts/finedelay-sweep.py diff --git a/docs/images/finedelay_test_layout.png b/docs/images/finedelay_test_layout.png new file mode 100644 index 0000000..e151b3a Binary files /dev/null and b/docs/images/finedelay_test_layout.png differ diff --git a/scripts/finedelay-sweep.py b/scripts/finedelay-sweep.py new file mode 100755 index 0000000..18bce41 --- /dev/null +++ b/scripts/finedelay-sweep.py @@ -0,0 +1,37 @@ +#!/usr/bin/env python +import argparse +import socket +import time + + +def parse_args(): + parser = argparse.ArgumentParser() + parser.add_argument('host') + return parser.parse_args() + + +def main(): + args = parse_args() + s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + s.connect((args.host, 8888)) + for wide in range(8): + s.sendall(f'LVDSOUT2.OCT_DELAY={wide}\n'.encode()) + assert s.recv(32) == b'OK\n' + time.sleep(0.5) + + for wide in range(8): + s.sendall(f'LVDSOUT2.OCT_DELAY={wide}\n'.encode()) + assert s.recv(32) == b'OK\n' + for fine in range(512): + s.sendall(f'LVDSOUT2.FINE_DELAY={fine}\n'.encode()) + assert s.recv(32) == b'OK\n' + time.sleep(0.01) + + time.sleep(1) + s.sendall('LVDSOUT2.OCT_DELAY=0\n'.encode()) + s.sendall('LVDSOUT2.FINE_DELAY=0\n'.encode()) + s.close() + + +if __name__ == '__main__': + main()