Skip to content
Christian Angelsen edited this page Jun 22, 2022 · 13 revisions

Preparing the source code for Hexitec 2x6

HTTP requestable information

Preamble

Odin's Web server is capable of handling HTTP requests, such as GET and PUT. Its parameter tree can be accessed from a shell:

curl -s <http://host/and/path/> | python -m json.tool

Where the argument to -s is substituted as appropriate. Odin's parameter tree can be accessed at multi points, so the above invocation may return a single value or a nested structure. By post-pending json.tool, the output becomes more readable.

Information that can be requested from ODIN via HTTP

The Colour Detector Software Integration v2_1.docx document states:

STFC will include the following in http commands and document how to:

  1. Detector status: Ready/Collecting Data
  2. Detector health: All voltages and temperatures are correct (not each value)
  3. Remaining Time: Collection time/frames remaining
  4. Check of collection time: Readback set collection time
  5. Check of filename and location: Readback set filename and location
  6. Check frame rate: Readback current frame rate
  7. Check if dark levels: Report when last collected
  8. Check HV bias: Report that HV bias is Off/On (not set value)

These can be accessed with the commands below, where the # denotes which of the above each line corresponds to:

curl -s http://localhost:8888/api/0.1/hexitec/detector/daq/status/daq_ready # 1.
curl -s http://localhost:8888/api/0.1/hexitec/detector/daq/status/in_progress # 1.
curl -s http://localhost:8888/api/0.1/hexitec/detector/status/system_health # 2.
curl -s http://localhost:8888/api/0.1/hexitec/detector/fem/duration_remaining # 3. (Collection time remaining)
curl -s http://localhost:8888/api/0.1/hexitec/detector/daq/status/received_remaining # 3. (Collection frames remaining)
curl -s http://localhost:8888/api/0.1/hexitec/detector/daq/status/processed_remaining # (Additionally tracks frames left to be processed)
curl -s http://localhost:8888/api/0.1/hexitec/detector/acquisition/duration # 4.
curl -s http://localhost:8888/api/0.1/hexitec/detector/acquisition/duration_enable # 4. Must be True, or number of frames specified (_not_ duration)
curl -s http://localhost:8888/api/0.1/hexitec/detector/daq/file_info # 5. file_name, file_dir respectively
curl -s http://localhost:8888/api/0.1/hexitec/detector/fem/frame_rate # 6.
curl -s http://localhost:8888/api/0.1/hexitec/detector/fem/offsets_timestamp # 7.
curl -s http://localhost:8888/api/0.1/hexitec/detector/fem/hv_bias_enabled # 8. Placeholder, dummy value until Hardware available

The Hexitec 2x2 Deployment Guide

This guide outlines the details for deploying the system in terms of the fibre connections and network configuration requirements. It excludes the deeper details of configuring the network card on the PC itself.

The required fibre-optic equipment

In order to connect up the PC and the FEM board, the corresponding port on the FEM and the PC needs to be connected together using a multimode fibre optic cable. On the FEM end, it needs to be fitted with an optical transceiver module. To connect the Data port on the PC with the Data port on the FEM, and the Control ports together, these items were ordered from FS.com:

  • 10m (33ft) MTP® Female 12 Fibres Type B Plenum (OFNP) OM4 50/125 Multimode Elite Trunk Cable
  • Intel E40GQSFPSR Compatible 40GBASE-SR4 QSFP+ 850nm 150m MTP/MPO DOM Optical Transceiver Module

Connecting the fibre-optic cables to the PC

No transceiver module is required on the PC side, ensure that each fibre is connected to the correct network card. Relevant network card information can be obtained using /sbin/ifconfig/, /sbin/ethtool/, and dmesg. If the FEM is powered up, connecting a fibre to a given network card will change its link status to up.

Connecting the fibre-optic cables to the FEM

With the supporting PCBs connected to the FEM, it can only lie comfortably on one side. In this orientation, the topmost port is the Control path. The bottom port is the Data path. The fibre-optic cables are labelled Data and Control respectively at both ends. There will be a clicking noise when a fibre has been pushed all the way into a transceiver.

Configuring Network interface in Linux

This part is beyond the scope of the guide.

Configuring network interface in the FEM

Configuring Addresses in the Software

Setting the Control and Data IP addresses is done using the Python software. The configuration file (.cfg) fed to odin_server has a section for configuring the IP addresses for the FEM(s):

[adapter.hexitec]
module = hexitec.adapter.HexitecAdapter

FEM_0 =
    ip_addr = 192.168.0.122,
    port = 8070,
    id = 0,
    server_ctrl_ip = 10.0.2.2,
    camera_ctrl_ip = 10.0.2.1,
    server_data_ip = 10.0.4.2,
    camera_data_ip = 10.0.4.1

As is implied by the above, this config file will set the IP addresses for both the PC and the FEM.

Configuring Addresses in the FEM

Setting the correct MAC addresses within the FEM are crucial, otherwise any packets sent by a FEM will be discarded at the network layer by the receiving PC. The ambition is to make this configurable using Python scripting in the same way that it's possible in the QemII project. The hardware register values for the Data path look as follows:

0x00000000 = 00000062		# FEM MAC [MSB]
0x00000001 = 699c0400		# PC MAC [MSB], FEM MAC [LSB]
0x00000002 = acba60b4		# PC MAC [LSB]
...
0x00000006 = 000a77b8		# PC IP [MSB], (77b8 is unrelated)
0x00000007 = 000a0204		# FEM IP [MSB], PC IP [LSB] 
0x00000008 = d2f00104		# TX Port, FEM IP [LSB]
0x00000009 = 0008d3f0		# RX Port

Registers 0x00000000 through 0x00000002 configure the FEM and PC MAC adresses, in reverse double hex order. What does this mean? If the FEM's MAC address is 62:00:00:00:00:04, that becomes xxxx0400 (matches half of 0x00000001) and 00000063 (0x00000000). The PC's 9c:69:b4:60:ba:ac becomes acba60b4 (0x00000002) and 699cxxx (0x00000001). So the order in all of the registers is Least to Most. Whereas the same information on Linux is generally presented in the order of Most to Least, such as the output of the ifconfig command below. The PC IP address (10.0.4.2, hex: 0a.00.04.02) becomes 000a (half of 0x00000006) and 0204 (half of 0x00000007). Beware that several of these values span more than one address. For example, if the PC IP address would be contained in register address 0x000000XX, that would appear as 000a0204. The TX (61,650, hex: f0d2) and RX (61,651, hex: f0d3) ports are also in reverse order. Hence addresses 0x00000008 and 0x00000009 contain the values d2f0 and d3f0 respectively.

NIC1: flags=4099<UP,BROADCAST,MULTICAST>  mtu 9216
CTRL    inet 10.0.2.2  netmask 255.255.255.0  broadcast 10.0.2.255
        ether MS:DD:CC:BB:AA:LS  txqueuelen 1000  (Ethernet)

NIC2: flags=4099<UP,BROADCAST,MULTICAST>  mtu 9216
DATA    inet 10.0.4.2  netmask 255.255.255.0  broadcast 10.0.4.255
        ether MS:33:22:11:00:LS  txqueuelen 1000  (Ethernet)

To streamline the configuration of the UDP parameters in the FEM, the Python script set_udp_registers.py takes a json configuration file. This Python script resides in /control/src/hexitec/test_ui/ along with a suitable json file, fem_addresses.json. The structure of the configuration file looks like:

{
  "fem_0":
  {
    "fem":
    {
      "mac": "62:00:00:00:00:04",
      "ip": "10.0.4.1",
      "port": 61651
    },
    "pc":
    {
      "mac": "9c:69:b4:60:ba:ac",
      "ip": "10.0.4.2",
      "port": 61650
    }
  },
  "fem_1":
  {
    "fem":
    {
      "mac": "88:00:00:10:00:11",
      "ip": "225.205.3.101",
      "port": 6551
    },
    "pc":
    {
      "mac": "FF:01:02:03:04:22",
      "ip": "225.205.3.102",
      "port": 6550
    }
  }
}

It can be invoked in this way:

set_udp_registers.py <json_file> <fem_id>

i.e.

set_udp_registers.py /path/to/hexitec/test_ui/fem_addresses.json 0

Here <fem_id> represents which of the fem_N blocks are accessed in the configuration file. So the above example with <fem_id> set to 0 corresponds to fem_0.


J-tag connection

In order to update the firmware, the relevant USB cable needs to be connected to the correct port on the side of the FEM. Of the two ports available, use the one furthest away from the side with the fibres connected to it. See picture below.


Miscellaneous

VSR Firmware Registers

The VSR Firmware has three different registers containing the following information:

Name    No.  Description               Value
Reg128 0x80 Firmware Customer ID 01
Reg129 0x81 Firmware Project ID     17
Reg130 0x82 Firmware Version ID     04

Values current as of 2021/01/29

Register 0x24

Register 36, hexadecimal 0x24 controls the settings for Dark Correction. Spectroscopic is a legacy term from an older project where there was also a Counting Mode. While the documentation still refers to Spectroscopic Mode, think of it instead of as "Normal" mode as there is no Counting mode (and bit 2 is redundant) in this project.

Default value is 0x28 (bits 5 & 3 set - i.e. VCAL is Disabled, SpectroscopicNormal mode selected)

0 - DC: overwrite average picture
1 - DC: capture average picture
2 - DC: enable DC Counting Mode
3 - DC: enable DC SpectroscopicNormal Mode
4 - DC: send average picture
5 - DC: disable VCAL Pulse
6 - DC: TestMode
7 - DC: en triggered Frame in Counting Mode