Skip to content

Commit 95a0dfd

Browse files
committed
Document using external gate; replace BC020 wiring example with GSECARS boxes
1 parent 73897fb commit 95a0dfd

File tree

1 file changed

+51
-131
lines changed

1 file changed

+51
-131
lines changed

docs/source/measCompUSBCTRDoc.rst

Lines changed: 51 additions & 131 deletions
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ This database is loaded once for each pulse generator.
261261
.. _ScalerSupport:
262262

263263
Scaler Record Support
264-
~~~~~~~~~~~~~~~~~~~~~
264+
---------------------
265265

266266
The USBCTR driver supports the EPICS scaler record via the
267267
devScalerAsyn.c device support originally from the
@@ -295,7 +295,7 @@ frequencies >1 MHz.
295295
.. _MCSSupport:
296296

297297
Multi-Channel Scaler (MCS) Support
298-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
298+
----------------------------------
299299

300300
The USBCTR driver provides multi-channel scaler support very similar to
301301
the SIS3820 driver in the synApps mca module. The support has the
@@ -500,10 +500,12 @@ The following record are defined in measCompMCS.template. This database is loade
500500
- MODEL
501501
- The model number of the counter module. 0="USB-CRT08", 1="USB-CTR04".
502502

503+
503504
Notes on external channel advance
504-
_________________________________
505+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
505506

506-
There are 2 problem with external channel advance that can cause the number channels collected (final value of CurrentChannel) to be less than that requested (NuseAll).
507+
There are 2 problem with external channel advance that can cause the number channels collected
508+
(final value of CurrentChannel) to be less than that requested (NuseAll).
507509

508510
The first problem only happens when all of the following 4 conditions are met:
509511

@@ -513,7 +515,8 @@ The first problem only happens when all of the following 4 conditions are met:
513515
3) Pulses are arriving on CLKI before the trigger condition is satisfied.
514516
4) The requested number of CLKI pulses (NuseAll) have not yet arrived when the trigger condition is satisfied.
515517

516-
The problem is clearly that the USBCTR should be ignoring any CLKI pulses that arrive before the trigger condition is met, but it does not.
518+
The problem is clearly that the USBCTR should be ignoring any CLKI pulses that arrive before the trigger condition is met,
519+
but it does not.
517520

518521
Consider the following conditions:
519522

@@ -524,7 +527,8 @@ Consider the following conditions:
524527
- If the trigger condition is satisfied at time=5.12 seconds, then it will only acquire 1526 channels.
525528
This is because it did not ignore the first 512 CLKI signals that arrived before the trigger condition was satisfied.
526529

527-
I believe this is a bug in the USBCTR firmware. I should report it to them, but I am not sure they will see it as a high enough priority to fix it.
530+
I believe this is a bug in the USBCTR firmware. I should report it to them,
531+
but I am not sure they will see it as a high enough priority to fix it.
528532
They will want to have a C test program to demonstrate the problem, which would be some work.
529533

530534
The second problem happens when the following 3 conditions are met:
@@ -565,17 +569,55 @@ The problem arises because the USB-CTR08 was told to collect 2048 dwell periods,
565569
It thus has a partially full buffer that it will push to the host when pulse 2048 is received.
566570
But because that final pulse is never received the final buffer is never sent, and CurrentChannel only gets to 2033.
567571

568-
This problem can be worked around by always setting Dwell to 0.01, forcing it to use SINGLEIO even for external pulse periods shorter than 0.01 seconds (100 Hz).
572+
This problem can be worked around by always setting Dwell to 0.01, forcing it to use SINGLEIO
573+
even for external pulse periods shorter than 0.01 seconds (100 Hz).
569574
Surprisingly I have found that SINGLEIO works reliably for dwell times as short as 10 microseconds, i.e. 100 kHz.
570575
This is true no matter how many counter channels are enabled, i.e. have CounterNEnable=1.
571-
However. above 100 kHz channel advance frequency SINGLEIO does not work, and one needs to decrease Dwell to switch to BLOCKIO.
576+
However, above 100 kHz channel advance frequency SINGLEIO does not work, and one needs to decrease Dwell to switch to BLOCKIO.
572577

573578
Note that this problem only occurs when the number of advance pulses received is less than NuseALL.
574579
If the number of pulses is at least NuseAll then CurrentChannel will always reach NuseAll.
575580
This is true whether it is running with SINGLEIO or BLOCKIO.
576581

582+
Using an external gate signal
583+
-----------------------------
584+
It is possible to use an external gate signal to inhibit counting in both scaler mode and MCS mode.
585+
However, this requires the installation of one external TTL chip containing an OR gate.
586+
This is needed because in scaler mode counters 1-7 need to be gated by either counter 0 out
587+
(C0O) or by the external gate. There is no way to do this without an external chip.
588+
To use an external gate the following wiring is required.
589+
590+
- Install an external chip with at least one OR gate (e.g. 74HC32N or equivalent).
591+
- Connect the external gate signal to the first input of the OR gate.
592+
- Connect channel 0 output (C0O) to the second input of the OR gate.
593+
- Connect the output of the OR gate to all counter gate inputs (C0GT-C7GT).
594+
595+
With these changes the external gate will inhibit counting in scaler mode.
596+
In MCS mode the external gate will inhibit counting but will not inhibit channel advance.
597+
598+
Packaging
599+
---------
600+
The photo below shows the USB-CTR08 mounted in a box with BNC connectors on the front
601+
and back for inputs and outputs. It also shows the 74HC32N chip mounted on top to
602+
implement the external gate as explained above.
603+
604+
.. figure:: USB-CTR08_box.jpg
605+
:width: 600
606+
:align: center
607+
608+
**USB-CTR08 box showing 74HC32N for external gate**
609+
610+
The photo below shows a box with the USB-CTR08 on the left, the USB-3114 in the middle,
611+
and the USB-1808X on the right. This box contains most of the analog input, analog output,
612+
digital I/O, and counter/timer functions required to run an experimental station at the APS.
613+
614+
.. figure:: 3ModuleBox.jpg
615+
:align: center
616+
617+
**Box with the USB-CTR08, USB-3114, and USB-1808X**
618+
577619
medm screens
578-
~~~~~~~~~~~~
620+
------------
579621

580622
The following is the main medm screen for controlling the USB-CTR04/08.
581623

@@ -605,128 +647,6 @@ USB-CTR04/08.
605647

606648
**USBCTR_MCS_plots.adl**
607649

608-
.. _Wiring:
609-
610-
Wiring to BCDA BC-020 LEMO Breakout Panels
611-
------------------------------------------
612-
613-
The following photos show the BCDA BC-020 LEMO breakout panels wired to
614-
the USB-CTR08. A BC-020 with a BC-087 daughter card (left) is used for
615-
the 8 counter signals, and a BC-020 with wire-wrapping (right) is used
616-
for digital I/O, timer output, clock I/O, etc. .
617-
618-
.. figure:: USBCTR_BC020.jpg
619-
:align: center
620-
621-
**BC-020 LEMO breakout panels with USBCTR-08**
622-
623-
.. figure:: USBCTR_Top.jpg
624-
:align: center
625-
626-
**Top view of USBCTR-08 with BC-020 LEMO breakout panels**
627-
628-
.. _USB-CTR08_wiring:
629-
630-
Wiring table
631-
~~~~~~~~~~~~
632-
633-
::
634-
635-
Digital I/O and other signals using wire-wrap connections
636-
637-
50-pin ribbon USB-1608GX BC-020 EPICS Function
638-
connector pin screw terminal connector
639-
1 DIO0 J1 Digital I/O bit 0
640-
2 GND J1 shell Ground
641-
3 DIO1 J2 Digital I/O bit 1
642-
4 GND J2 shell Ground
643-
5 DIO2 J3 Digital I/O bit 2
644-
6 GND J3 shell Ground
645-
7 DIO3 J4 Digital I/O bit 3
646-
8 GND J4 shell Ground
647-
9 DIO4 J5 Digital I/O bit 4
648-
10 GND J5 shell Ground
649-
11 DIO5 J6 Digital I/O bit 5
650-
12 GND J6 shell Ground
651-
13 DIO6 J7 Digital I/O bit 6
652-
14 GND J7 shell Ground
653-
15 DIO7 J8 Digital I/O bit 7
654-
16 GND J8 shell Ground
655-
17 TMR0 J9 Pulse generator 0 output
656-
18 GND J9 shell Ground
657-
19 TMR1 J10 Pulse generator 1 output
658-
20 GND J10 shell Ground
659-
21 TMR2 J11 Pulse generator 2 output
660-
22 GND J11 shell Ground
661-
23 TMR3 J12 Pulse generator 3 output
662-
24 GND J12 shell Ground
663-
25 TRIG J13 Trigger input for MCS
664-
26 GND J13 shell Ground
665-
27 CLKI J14 External channel advance input
666-
28 GND J14 shell Ground
667-
29 CLK0 J15 Clock output
668-
30 GND J15 shell Ground
669-
31 +VO J16 +5 volt output
670-
32 GND J16 shell Ground
671-
672-
673-
Counter I/O using wire-wrap connections
674-
675-
50-pin ribbon USB-CTR08 BC-020 EPICS Function
676-
connector pin screw terminal connector
677-
1 C0IN J1 Scaler 1 input
678-
2 GND J1 shell Ground
679-
3 C0GT J2 Scaler 1 gate input
680-
4 GND J2 shell Ground
681-
5 C0O J3 Scaler 1 output
682-
6 GND J3 shell Ground
683-
7 C1IN J4 Scaler 2 input
684-
8 GND J4 shell Ground
685-
9 C1GT J5 Scaler 2 gate input
686-
10 GND J5 shell Ground
687-
11 C1O J6 Scaler 2 output
688-
12 GND J6 shell Ground
689-
13 C2IN J7 Scaler 3 input
690-
14 GND J7 shell Ground
691-
15 C2GT J8 Scaler 3 gate input
692-
16 GND J8 shell Ground
693-
17 C2O J9 Scaler 3 output
694-
18 GND J9 shell Ground
695-
19 C3IN J10 Scaler 4 input
696-
20 GND J10 shell Ground
697-
21 C3GT J11 Scaler 4 gate input
698-
22 GND J11 shell Ground
699-
23 C4O J12 Scaler 4 output
700-
24 GND J12 shell Ground
701-
25 C4IN J13 Scaler 5 input
702-
26 GND J14 shell Ground
703-
27 C4GT J14 Scaler 5 gate input
704-
28 GND J14 shell Ground
705-
29 C4O J15 Scaler 5 output
706-
30 GND J15 shell Ground
707-
31 C5IN J16 Scaler 6 input
708-
32 GND J16 shell Ground
709-
33 C5GT J17 Scaler 6 gate input
710-
34 GND J17 shell Ground
711-
35 C5O J18 Scaler 6 output
712-
36 GND J18 shell Ground
713-
37 C6IN J19 Scaler 7 input
714-
38 GND J19 shell Ground
715-
39 C6GT J20 Scaler 7 gate input
716-
40 GND J20 shell Ground
717-
41 C6O J21 Scaler 7 output
718-
42 GND J21 shell Ground
719-
43 C7IN J22 Scaler 8 input
720-
44 GND J22 shell Ground
721-
45 C7GT J23 Scaler 8 gate input
722-
46 GND J23 shell Ground
723-
47 C7O J24 Scaler 8 output
724-
48 GND J24 shell Ground
725-
726-
In addition to these connections counter 0 output (C0O) was connected to the gate
727-
inputs of counters 1-7 (C1GT - C7GT) at the module screw terminals.
728-
This is cheaper and simpler than using LEMO tees and short cables on the BC-020 module.
729-
730650
.. _Performance_CTR:
731651

732652
Performance measurements

0 commit comments

Comments
 (0)