DS Operations: Difference between revisions

From DaqWiki
Jump to navigation Jump to search
Line 255: Line 255:
|-
|-
! 0  
! 0  
|| The CDM does not receive anything from the VX. Check <code>vx_rx_delays_common</code> ||  The VX does not receive anything from the CDM. Check <code>vx_tx_delays_common</code> ||
|| The CDM does not receive anything from the VX. Check <code>vx_rx_delays_common</code> ||  The VX does not receive anything from the CDM. Check <code>vx_tx_delays_common</code>  
|-
|-
! 1  
! 1  

Revision as of 09:54, 2 December 2026

CDM and GDM

CDM ODB Keys

/Equipment/CDMxx/Settings/

When a change takes effect (frontend RPC names in parentheses):

  • [init] frontend start, begin of run, or "GDM init"/"CDM init" (gdm_init/cdm_init)
  • [trigger] begin of run, resume, or "enable trigger" (enable_trigger). The trigger registers are cleared on pause, end of run and "disable trigger".
  • [CC load] clock chip load: frontend start after power up, or "CC init" (cc_init)
  • [restart] frontend restart only

Note: the FIFO enable bits (fifo_*_enable) are cleared at end of run. On a CDM they are also cleared at pause and not restored at resume, so a paused-and-resumed run records no FIFO packets from that CDM.

Key Summary How to use
cc_count_N1 VX clock phase step count, N1 divider [CC load] Number of steps; negative values shift the other way, 0 means no shift. Applied once per clock chip load, so a change has no effect until "CC init" (which reloads the chip and interrupts the clocks). Use it to align the VX clock group driven by N1.
cc_count_N2 VX clock phase step count, N2 divider [CC load] As cc_count_N1, for the N2 divider.
cc_step_N1 VX clock phase step, N1 divider [CC load] Step size in VCO periods (71.43 ps); default 7 (0.5 ns). Total shift = cc_step_N1 × cc_count_N1 × 71.43 ps.
cc_step_N2 VX clock phase step, N2 divider [CC load] As cc_step_N1, for the N2 divider.
cdm_lvds_tx_mux CDM: VX LVDS TX signal selection [init] Keep 15 (production: TRG on LVDS pair 12, veto on pair 13, serial packets). Test values: 0 reg7 levels, 5 62.5 MHz clock, 6 125 MHz clock, 7 TRG + TSM + serial, 8 TRG + TSM + RX-to-TX loopback.
cdm_lvds_tx_rx_loopback CDM: VX LVDS RX-to-TX loopback [init] Keep n. y echoes VX RX data back on VX TX, for LVDS link tests only.
cdm_vx_mask CDM: enabled VX ports [init] Set bit n for each VX port n (0..11) with a VX connected, e.g. 0x3FF for ports 0..9. Only enabled ports contribute to CDM busy and are checked for "VX-ok". Leaving an unused port enabled gives a permanent "VX-bad".
dn_mux_sfp_rx_fifo_enable CDM: forward GDM packets to VX [init] Keep y on CDMs. Feeds packets received from the GDM (TRG, TSM, TRIG48) into the down packet mux, which sends them to the VX.
enable_cdm_hitmap CDM: local trigger on hitmap grand-OR [init] + [trigger] y on a CDM makes it trigger its own VX on any of their hitmap hits. Probably also needs bit 30 of reg107_conf_cdm_hitmap_trigger (conf_enable_grand_or).
enable_gdm_hitmap GDM: global trigger on hitmap grand-OR [trigger] y on the GDM triggers all VX on any VX hitmap hit. Needs the hitmap path enabled (CDM up_mux_vx_rx_enable = y, VX hitmaps on). Ignored if enable_gdm_trig48 = y.
enable_gdm_hitmap_grand_or GDM: TRIG48 group trigger on hitmap grand-OR [trigger] y on the GDM sends a TRIG48 packet when any VX hitmap hit occurs. Only VX modules whose TRIG48 mask matches the bitmap in gdm_trig48_bitmap48_low/high trigger.
enable_gdm_trig48 GDM: enable TRIG48 group triggers [trigger] y on the GDM to enable TRIG48 packets; turns off the global hitmap trigger (enable_gdm_hitmap). In the VX settings, set the TRIG48 mask of each VX (e.g. 1<<vxid) and enable "Trigger on TRIG48".
enable_lemo1 LEMO input 1 as trigger [trigger] y to trigger on LEMO input 1. The input must also be enabled in reg2_lemo_inputs (bit 0, plus bit 4 for NIM).
enable_lemo2 LEMO input 2 as trigger [trigger] As enable_lemo1; reg2_lemo_inputs bits 1 and 5.
enable_lemo3 LEMO input 3 as trigger [trigger] As enable_lemo1; reg2_lemo_inputs bits 2 and 6.
enable_lemo4 LEMO input 4 as trigger [trigger] As enable_lemo1; reg2_lemo_inputs bits 3 and 7.
enable_pulser Periodic trigger pulser [trigger] y generates TRG at pulser_freq_Hz. Normally used on the GDM. Ignored, with the pulser turned off, if any trigger_from_* key is y.
enable_sfp CDM: SFP link monitoring [restart] y on CDMs: monitors the SFP module (temperature, optical power) and the fiber link, and shows "SFP-ok/bad" in the status. n (status "SFP-off") for a CDM without a fiber link. No effect on the GDM.
enable_tsm Periodic time slice marker (TSM) [trigger] y generates TSM packets at tsm_freq_Hz. Normally used on the GDM. Ignored if any trigger_from_* key is y.
fifo_cdm_busy_enable Record CDM busy packets [init] y to record CDM busy packets: busy and veto transitions with timestamps (needs read_fifo).
fifo_cdm_hitmap_enable Record CDM hitmap packets [init] y to record CDM hitmap packets (needs read_fifo = y). Disable to reduce data rate.
fifo_cdm_trigger_enable Record CDM hitmap trigger packets [init] y to record CDM hitmap trigger packets (needs read_fifo).
fifo_gdm_busy_enable Record GDM busy packets [init] y on the GDM to record GDM busy/veto transitions with timestamps (needs read_fifo). Bit 30 of reg29 overrides n.
fifo_gdm_hitmap_enable Record GDM hitmap packets [init] y on the GDM to record GDM hitmap trigger packets (needs read_fifo).
fifo_tsm_enable Record TSM packets [init] y to record TSM packets (GDM and GPS timestamps; needs read_fifo).
gdm_qsfp_mask GDM: enabled QSFP (CDM) links [init] Set bit n for each QSFP link n (0..11) that has a CDM connected, e.g. 0x3 for links 0 and 1. Only enabled links contribute to GDM busy and are checked for "link good". Leaving a dead link enabled makes the frontend report the QSFP links as bad. A stuck busy on an enabled link blocks all triggers during a run (GDM veto is enabled at begin of run).
gdm_trig48_bitmap48_high GDM: TRIG48 bitmap, bits 32..47 [trigger] Upper 16 bits of the TRIG48 bitmap (0..0xFFFF). See gdm_trig48_bitmap48_low.
gdm_trig48_bitmap48_low GDM: TRIG48 bitmap, bits 0..31 [trigger] Selects which VX trigger: a VX fires if its TRIG48 mask shares a bit with this bitmap. 0xFFFFFFFF (with high = 0xFFFF) triggers all, 0x1 only VX with mask bit 0. 0 triggers none.
Grid display MIDAS equipment page layout y shows the equipment variables as one table (one row per array element), n lists them one after the other. Display only, no effect on the hardware.
pulser_freq_Hz Trigger pulser rate [Hz] [trigger] Must be > 0, e.g. 100. The period is truncated to a whole number of 8 ns clocks; the achieved rate is shown in Variables/trg_freq_Hz. Requires enable_pulser = y.
read_fifo Save FPGA FIFO packets to MIDAS [restart] y to record the busy, hitmap and TSM packets selected by the fifo_*_enable keys. They are saved in bank FGDM (GDM) or FCnn (CDM nn) during runs. With n the FIFO is never read: it fills up, packets are lost (counted in register 89), and end of run waits 10 s for the FIFO to empty. Set the fifo_*_enable keys to n as well.
reg107_conf_cdm_hitmap_trigger CDM: hitmap trigger configuration (register 107) [init] 0 normally. Bit 30 (0x40000000, conf_enable_grand_or) enables the grand-OR in the CDM hitmap trigger block; use it with enable_cdm_hitmap. Bit 31 inverts the cumulative hitmap.
reg16 CDM SFP TX control (register 16) [init] CDM only. Keep 0 (normal operation). Non-zero values are SFP link test and loopback modes.
reg23 GDM QSFP TX control (register 23) [init] GDM only. Keep 0 (normal packet mode). Bits 24/25 (TRG/TSM K-codes) are managed by the frontend at begin of run: TRG K-codes are sent only during the begin-of-run trigger sequence. Other non-zero values are link test modes, e.g. 0x40000000 sends TRG/TSM as raw data bits (legacy, paired with CDM trigger_from_sfp_rx_data).
reg29 Base value for packet routing (register 29) [init] Bits 0..11 set the packet routing: bits 0..3 down mux output (0 VX TX, 3 GDM QSFP TX), bits 4..7 up mux output (0 SFP TX to GDM), bits 8..11 CPU FIFO injection (debug). CDMs use 0. On the GDM, packets to the CDMs go through down mux output 3 (the wiki packet test uses 3), so check the GDM's existing value before changing it. Bits 16..31 are enable flags. The fifo_*_enable, dn_mux_*, up_mux_* and enable_cdm_hitmap keys are ORed in on top of this value, so they can set bits but never clear them. Keep bits 16..31 at 0 here so those keys control them; a bit set here overrides the matching key set to n. On the GDM, bits 16/17 (local TRG/TSM packets) are set by the frontend at begin of run.
reg2_lemo_inputs LEMO input/output configuration (register 2) [init] Bits 0..3 enable LEMO inputs 1..4; bits 4..7 invert them (set for NIM); bits 9..10 disable and bits 11..12 invert LEMO outputs 1..2. Use 0xFF for four NIM inputs and 0x0F for four TTL inputs. Also set the board switches SW3/SW4 (inputs) and SW2 (outputs) to match.
reg3_leds_mux Front panel LED signals (register 3) [init] One hex digit per LED, LED 1 in the lowest digit. Codes: 1 register 7, 2 PLL locked, 3 SFP/QSFP link good, 4..7 LEMO in 1..4, 8..9 LEMO out 1..2, A TRG, B TSM, C GDM busy, D CDM busy, E CDM veto, F always on. Bits 16..19 invert the LEDs. Default 0xBA32 shows PLL locked, link good, TRG, TSM.
reg4_lemo_mux LEMO output signals (register 4) [init] One hex digit per LEMO output, output 1 in the lowest digit. Codes: 1 register 7, 2 trigger pulser, 8 TRG, 9 TSM, A CDM busy, B GDM busy, C CDM veto, D VX-to-CDM serial data, F constant 1 (3..7 are debug signals). Example: 0x98 puts TRG on output 1 and TSM on output 2.
reg7 Manual LED, LEMO and VX TX levels (register 7) [init] Static levels for outputs whose mux selects "register 7": bits 0..3 LEDs (reg3_leds_mux code 1), bits 4..5 LEMO outputs (reg4_lemo_mux code 1), bits 8..14 VX1/VX2 TX lines (cdm_lvds_tx_mux = 0). Frontend default 0. Per the wiki, 0xFF00 drives the VX LVDS lines to logic 0 in that mode. Debug use only.
reg8 Not used Ignored by the frontend. Use cdm_lvds_tx_mux and cdm_lvds_tx_rx_loopback instead.
reg98 Not used Ignored by the frontend. Use gdm_trig48_bitmap48_low.
reg99 Not used Ignored by the frontend. Use gdm_trig48_bitmap48_high, enable_gdm_trig48 and enable_gdm_hitmap_grand_or.
trigger_from_gdm CDM: pass GDM packets through to VX [trigger] y on CDMs: forwards GDM packets to the VX (sets vx_tx_from_sfp) and clears the local TRG/TSM sources; enable_lemo* and the hitmap trigger keys still apply. This is the normal CDM mode. Last in the trigger_from_* priority order.
trigger_from_sfp CDM: TRG/TSM from GDM K-codes [trigger] y on a CDM takes TRG/TSM from the K-codes sent by the GDM. The GDM sends TRG K-codes only during the begin-of-run sequence (and no TSM K-codes), so this is not a normal running mode; use trigger_from_gdm. Only one trigger_from_* key is used, the first y in this priority order: trigger_from_sfp, trigger_from_sfp_rx_data, trigger_from_vx_tx_packet, trigger_from_gdm. Set all four to n on the GDM.
trigger_from_sfp_rx_data CDM: TRG/TSM from SFP data bits (legacy) [trigger] Legacy test mode; keep n. Pair with GDM reg23 = 0x40000000. Only used if trigger_from_sfp = n.
trigger_from_vx_tx_packet CDM: count TRG/TSM packets sent to VX [trigger] y makes the CDM trigger counters and LEDs follow the TRG/TSM packets forwarded to the VX (packet trigger mode). Third in the trigger_from_* priority order.
tsm_freq_Hz TSM rate [Hz] [trigger] Must be > 0; typically 1. The achieved rate is shown in Variables/tsm_freq_Hz. Requires enable_tsm = y.
up_mux_vx_rx_enable CDM: forward VX packets to GDM [init] Keep y on CDMs; without it, VX hitmaps do not reach the GDM, so GDM hitmap triggers stop.
vx_rx_delay_common CDM: default VX-to-CDM input delay [init] Used for every port whose vx_rx_delays entry is 0. Same encoding as vx_rx_delays.
vx_rx_delays CDM: per-port VX-to-CDM input delay (12 values) [init] One entry per VX port, 16-bit delay: bits 0..8 fine taps (~2 ps each, ~1.1 ns full range), bit 9 +1 ns, bits 10..15 2 ns steps. Larger values give more delay. 0 means use vx_rx_delay_common; if both are 0, the delay is reset to zero. Normally all 0.
vx_rx_hitmap_cumulative_period CDM: cumulative hitmap packet period [init] 0 disables the packets. Otherwise the period between CDM cumulative hitmap packets, presumably in 8 ns clocks (1250000 would be 10 ms). Smaller values give more data. Which fifo_*_enable key routes these packets to the CPU FIFO is not documented (probably fifo_cdm_hitmap_enable).
vx_tx_delay_common CDM: default CDM-to-VX phase [init] 0..3, used for every port whose vx_tx_delays entry is 0. Set this if all ports work with the same value.
vx_tx_delays CDM: per-port CDM-to-VX phase (12 values) [init] One entry per VX port, 0..3 selects one of four 90° phases of the 125 MHz clock. 0 means use vx_tx_delay_common, so phase 0 is only reachable when the common value is 0. If a port shows "VX-bad", try other values; typically two of the four work. Apply with "CDM init". Re-tune only after changing cables, modules or CDM firmware.

bad CDM or VX link status

GDM-CDM-VX status page shows some channels with bad link status

On the GDM-CDM-VX status page, ports in the CDM VX LVDS port table can have various link statuses.

Link status descriptions
cdm link status rx connection (transmitting to vx module)
vx link status tx connection (receiving from vx module)
vx link rx data 0x1c and 0xbc are idle characters. We expect these to flip flop.

The status codes are as follows:

Status codes
Code CDM Link Status VX Link Status
0 The CDM does not receive anything from the VX. Check vx_rx_delays_common The VX does not receive anything from the CDM. Check vx_tx_delays_common
1 The VX does not receive the CDM. Check vx_tx_delays_common The CDM does not receive the VX. Check vx_rx_delays_common
3 Link is good in both directions Link is good in both directions
8 No serial link No serial link

The link timings need to be adjusted. These are done in the ODB: /Equipment/CDMxx/Settings/vx_tx_delay_common and /Equipment/CDMxx/Settings/vx_rx_delay_common. This shifts the phase of all the links from the CDM. To find the correct settings ssh into the CDM as root. Then run the following, depending on which links is bad:

RX Phase Scan

root@cdm203:~# ./test_cdm.exe --vx-rx-phase-scan
dsdm_open: mapping /dev/mem at 0x80010000
dsdm_open: FPGA build: 0xc4b4a086
DS-DM firmware build 0xc4b4a086, board id 0x204d4443 (CDM), top level version 0x20260922
VX_RX delays phase scan...
VX-RX delays scan: tap   0, ddr 0, d:  0, vx link status 0x8833 0x33333111, all good: 1, good links: 10, delay 0x00000000 (0.000 ns)
VX-RX delays scan: tap 200, ddr 0, d:  0, vx link status 0x8833 0x33333111, all good: 1, good links: 10, delay 0x000000c8 (0.391 ns)
VX-RX delays scan: tap 400, ddr 0, d:  0, vx link status 0x8833 0x33333111, all good: 1, good links: 10, delay 0x00000190 (0.781 ns)
VX-RX delays scan: tap   0, ddr 1, d:  0, vx link status 0x8833 0x33333111, all good: 1, good links: 10, delay 0x00000200 (1.000 ns)

The rx phase scan should go up to 40 ns. While this runs look at the GDM-CDM-VX status page and wait until the CDM link statuses are all green. They may be green for a range of values, we want to pick the center of the range. Note that the delays will wrap at 8 ns, such that the actual delay is given by x%8. The value entered into the ODB (/Equipment/CDMxx/Settings/vx_rx_delay_common) is the delay hexidecimal value. In the above example, for 1.000 ns this is 0x00000200.

TX Phase Scan

The tx phase scan can only take options in the range [0, 3]. Similar to the rx phase scan, watch the GDM-CDM-VX status page and wait until the vx link statuses are all green, and pick the value corresponding to that to enter into /Equipment/CDMxx/Settings/vx_tx_delay_common. This sets the tx phase for all channels of that CDM.