Using the MOLLERADC with CODA

Table of Contents

1. Firmware and OS Installation

1.1. Downloads

1.1.1. molleradc-distirbution

Download options

  1. clone with git
    git clone --branch rev2 --depth 1 https://code.jlab.org/fedaq/fw/molleradc-distribution.git
    
  2. Use one of the other gitlab download options

    Code ˇ pulldown menu : zip, tar, …

    https://code.jlab.org/fedaq/fw/molleradc-distribution

1.1.2. CentOS7 Distribution for MOLLERADC

Choose if the root filesystem will reside on an NFS server, or on a local disk (microSD or onboard eMMC)

  1. diskless
  2. local disk
    • root filesystem (tgz)

1.2. Installation

1.2.1. Diskless

1.2.2. microSD

Determine which device was recognized as the microSD. The script, by default, will use

SD_DEV=/dev/sda

Update the variable SD_DEV in the makeSD.sh script to match the device used by your linux system.

Execute the script as root to write the boot files to the microSD

cd molleradc-distribution
sudo ./makeSD.sh

1.2.3. eMMC

The script must be executed on an MOLLERADC that is already booted with microSD or Diskless OS.

Execute the script as root to write the boot files to the eMMC

cd molleradc-distribution
sudo ./makeMMC.sh

1.3. Update firmware after installation on eMMC

To update the firmware to a more recent version

  • login to the molleradc using an account with sudo privileges
  • download the updated distribution from the source above
  • copy the updated distribution to the eMMC

    cd molleradc-distribution
    sudo cp -a BOOT.BIN BUILD Image extlinux rootfs.cpio.gz.u-boot system.dtb /media/mmcblk0p1/
    sudo sync
    
  • reboot to load the new firmware

    sudo reboot
    

1.4. Update boot targets

From a connected terminal using the USB-B connection on the front panel, modify the uboot environment by interrupting the boot process just after power-up.

The prompt will look like:

Hit any key to stop autoboot

Update the boot targets (for example, check PXE, then eMMC, then SD for boot images):

env set boot_targets "pxe mmc0 mmc1"
env save

2. Software Configuration

2.1. CODA environment and configuration

2.1.1. EXPID

The CODA environment variable EXPID is defined in

/home/coda/coda_setup.sh

The coda_roc will need to be restarted if it is changed. By default,

EXPID=daqlab

2.1.2. ROC name

by default, the name used for the MOLLERADC CODA ROC component is it's hostname. For example,

hostname = damolleradc1.jlab.org
CODA ROC name = damolleradc1

the hostname and CODA ROC name defintions are done in

/home/coda/bin/startRoc.sh ->
     /usr/local/coda/3.10_arm/systemd/procServ_coda_roc.sh

2.2. Run Configuration files and Readout Lists

2.2.1. Streaming Mode

/home/coda/cfg/molleradc-stream.cfg
/home/coda/rol/molleradc_stream_list.so

2.2.2. TI Triggered

/home/coda/cfg/molleradc.cfg
/home/coda/rol/molleradc_list.so

2.3. Restart / Reboot

For the first two solutions, use ssh to connect remotely. For example

ssh coda@damolleradc1.jlab.org

2.3.1. coda_roc

  • restart with systemd

    sudo systemctl restart coda_roc
    
  • restart with killall command

    killall -9 coda_roc
    
  • restart with Control-X in procServ terminal
    • connect with

      connectRoc.sh
      

2.3.2. soft reboot

sudo reboot

2.3.3. front panel TTL signal

2.4. jcedit examples

2.4.1. Streaming Mode

Run Type Configuration

molleradc_jcedit_streaming0.png

MOLLERADC ROC Component

molleradc_jcedit_streaming1.png

2.4.2. TI Triggered

Run Type Configuration

molleradc_jcedit0.png

MOLLERADC ROC Component

molleradc_jcedit1.png

2.5. Readout

2.5.1. Streaming Mode example evio event

<!-- ===================== Buffer 3 contains 16398 words (65592 bytes) ===================== -->

   <!-- header words: 16397, 0xff501001 -->
   <event format="evio" count="3" content="bank" data_type="0x10" tag="65360" padding="0" num="1" length="16397" ndata="16396">

      <!-- header words: 7, 0xff202001 -->
      <bank content="segment" data_type="0x20" tag="65312" padding="0" num="1" length="7" ndata="6">

         <!-- header word: 0x10a0002 -->
         <uint64 data_type="0xa" tag="1" padding="0" length="2" ndata="1">
            0x0000000000000001  
         </uint64>

         <!-- header word: 0x1850001 -->
         <uint16 data_type="0x5" tag="1" padding="2" length="1" ndata="1">
            0x00fe  
         </uint16>

         <!-- header word: 0x18010000 -->
         <uint32 data_type="0x1" tag="24" padding="0" length="0" ndata="0">
         </uint32>
      </bank>

      <!-- header words: 16387, 0x181001 -->
      <bank content="bank" data_type="0x10" tag="24" padding="0" num="1" length="16387" ndata="16386">

         <!-- header words: 16385, 0x4d0a01 -->
         <uint64 data_type="0xa" tag="77" padding="0" num="1" length="16385" ndata="8192">
            0xff1f0600000000dd  0xc9d814a007000000  
            0x4040fcff41c0ffff  0x4000fdff4100ffff  
            0x4080fcff41c0ffff  0x40c0fcff4100ffff  

2.5.2. TI Triggered Mode example event

<!-- ===================== Buffer 3 contains 29 words (116 bytes) ===================== -->

   <!-- header words: 28, 0xff501001 -->
   <event format="evio" count="3" content="bank" data_type="0x10" tag="65360" padding="0" num="1" length="28" ndata="27">

      <!-- header words: 16, 0xff212002 -->
      <bank content="segment" data_type="0x20" tag="65313" padding="0" num="2" length="16" ndata="15">

         <!-- header word: 0x10a0004 -->
         <uint64 data_type="0xa" tag="1" padding="0" length="4" ndata="2">
            0x0000000000000001  0x000000009a077eff  
         </uint64>

         <!-- header word: 0x1850001 -->
         <uint16 data_type="0x5" tag="1" padding="2" length="1" ndata="1">
            0x000a  
         </uint16>

         <!-- header word: 0x12010003 -->
         <uint32 data_type="0x1" tag="18" padding="0" length="3" ndata="3">
            0x9a077eff  0x09c00000  0xda560000  
         </uint32>

         <!-- header word: 0x18010003 -->
         <uint32 data_type="0x1" tag="24" padding="0" length="3" ndata="3">
            0x9a077eff  0x09c00000  0xda560000  
         </uint32>
      </bank>

      <!-- header words: 7, 0x121001 -->
      <bank content="bank" data_type="0x10" tag="18" padding="0" num="1" length="7" ndata="6">

         <!-- header words: 5, 0x50101 -->
         <uint32 data_type="0x1" tag="5" padding="0" num="1" length="5" ndata="4">
            0x01000000  0xadde0000  0x11f1bace  0x22f2bace  
         </uint32>
      </bank>

      <!-- header words: 1, 0x181001 -->
      <bank content="bank" data_type="0x10" tag="24" padding="0" num="1" length="1" ndata="0">
      </bank>
   </event>

   <!-- end buffer 3 -->

3. MOLLERADC Data Format

3.1. Integrating

  • data is presented with 4 64bit header words followed by the measured integration parameters for each channel

3.1.1. Header Words

integrating_header.png

  1. id

    header.png

    • [63...56] id : 0xAA
    • [47...16] num_pkt : region number
    • [15... 0] num_words : number of 64bit words in this region
  2. timestamp
    • [63... 0] timestamp : timestamp of last sample of region
  3. packet count

    blockid.png

    • [63...60] block : region number
    • [59... 0] pcktCnt : number of regions acquired since reset
  4. tSamples
    • [63... 0] tSamples : number of samples in this region

3.1.2. Measured Integration Parameters

  • 7 64bit words are presented for each channel

integrating_channel_data.png

  1. ch_misc

    integrating_ch_misc.png

    • [39...20] ch_max : maximum sample value (signed integer) in region
    • [19... 0] ch_min : minimum sample value (signed integer) in region
  2. ch_sample_count_win
    • [63... 0] ch_sample_count_win : number of samples in block (all regions) for this channel
  3. ch_sum_win
    • [63... 0] ch_sum_win : sum of samples in block (all regions) for this channel
  4. ch_sum_of_squares_win
    • [63... 0] ch_sum_of_squares_win : sum of squares of samples in block (all regions) for this channel
  5. ch_sample_count
    • [63... 0] ch_sample_count : number of samples within region for this channel
  6. ch_sum
    • [63... 0] ch_sum : sum of samples within region for this channel
  7. ch_sum_of_squares
    • [63... 0] ch_sum_of_squares : sum of square of samples within region for this channel

3.1.3. Example data

  • MOLLERADC data within the Bank of 8 byte integers is Big Endian, and must be byteswapped for decoding with the scheme above.
<!-- header words: 233, 0x4d0a00 -->
<uint64 data_type="0xa" tag="77" padding="0" num="0" length="233" ndata="116">
  0x73000000000000aa  0x04f9c49701000000  
  0x0802000000000000  0x5897070000000000  
  0xeaf9bf9dff000000  0xf1f91f9eff000000  
  0xe8f98f9dff000000  0xd9f99f9cff000000  
  0xe3f93f9dff000000  0xe4f95f9dff000000  
  0xf5f94f9eff000000  0xd6f95f9cff000000  
  0xe054ef4cf5000000  0x04564f5ff5000000  
  0x69569f65f5000000  0xfc55cf5ef5000000  
  0xc4553f5bf5000000  0x69558f55f5000000  
  0x8a55af57f5000000  0xfe55df5ef5000000  
  0xe5a7490203000000  0xe5a7490203000000  
  0xe5a7490203000000  0xe5a7490203000000  
  0x6ca6340203000000  0xe5a7490203000000  
  0xe5a7490203000000  0xe5a7490203000000  
  0xe5a7490203000000  0xe5a7490203000000  
  0xe5a7490203000000  0xe5a7490203000000  
  0xe5a7490203000000  0xe5a7490203000000  
  0xe5a7490203000000  0xe5a7490203000000  
  0xe14173a66a87ffff  0xa5b25e5a67ebffff  
  0xa2360a6853ebffff  0x96ceded025ebffff  
  0xfe324d4353ebffff  0x2a930f0d4bebffff  
  0x317e8caa78ebffff  0xfca327e21cebffff  
  0xaeede2c599fcfdff  0xaa9d67e70600feff  
  0x3db0b2043401feff  0x5a5a67efedfffdff  
  0xe5e099db45fffdff  0x45df67fe34fefdff  
  0xd354a1de97fefdff  0xb6416429f0fffdff  
  0xa1fff656d36c1a47  0x3772f1d747a24d02  
  0xd2b24f5525964e02  0x1074e83271c75002  
  0x8645571af3f34202  0x3ab8372a9bfc4e02  
  0xd946f9a56fcf4c02  0xbe40e0a00d365102  
  0xecefd784b9cde858  0xac0c612ac1da5754  
  0x8bf353dac65dc852  0x4c77290fa0057954  
  0xe521420743745855  0x49a45f0dc7cbc356  
  0xd94a291df70b4056  0x88dfec949f137654  
  0x5897070000000000  0x5897070000000000  
  0x5897070000000000  0x5897070000000000  
  0x5897070000000000  0x5897070000000000  
  0x5897070000000000  0x5897070000000000  
  0x5897070000000000  0x5897070000000000  
  0x5897070000000000  0x5897070000000000  
  0x5897070000000000  0x5897070000000000  
  0x5897070000000000  0x5897070000000000  
  0xbbcc94d1ffffffff  0x39b1bed1ffffffff  
  0xf2317fd1ffffffff  0x8bfe0ad1ffffffff  
  0x08d456d1ffffffff  0x05a667d1ffffffff  
  0xef63ddd1ffffffff  0x73d8f4d0ffffffff  
  0xfa4cb6ecfaffffff  0x37c061f5faffffff  
  0x453b62f8faffffff  0x8ec422f5faffffff  
  0x61827bf3faffffff  0x9371c9f0faffffff  
  0x100dc5f1faffffff  0x85ba2df5faffffff  
  0x9334bcd71b010000  0x31964ed819010000  
  0xf0d831e01c010000  0x1dddd27622010000  
  0x46479acf1e010000  0x15c6f7001e010000  
  0xf552b16218010000  0x5b2a1a8923010000  
  0x42a4d4c2ae640300  0x1d79e4e220590300  
  0xaf0bc55725550300  0x74ab1a8d74590300  
  0xd3e59935a75b0300  0x87ee71173e5f0300  
  0xde6033d5ee5d0300  0x653f71fd65590300  
</uint64>

3.2. Streaming

  • data is presented with 4 64bit header words followed by the sample data for each channel

3.2.1. Header Words

integrating_header.png

  1. id

    header.png

    • [63...56] id : 0xDD
    • [47...16] num_pkt : region number
    • [15... 0] num_words : number of 64bit words in this region
  2. timestamp
    • [63... 0] timestamp : timestamp of last sample of region
  3. packet count

    blockid.png

    • [63...60] block : region number
    • [59... 0] pcktCnt : number of regions acquired since reset
  4. tSamples
    • [63... 0] tSamples : number of samples in this region

3.2.2. 2-Channel Data

  • Data for 1 sample from 2 channels is presented in 1 64byte word
  • this is repeated for all tSamples
  • Data for each sample is an 18bit signed integer

streaming_2channel_data.png

  • [ 3... 0] ch0_num : channel0 selected in hardware
  • [11... 4] prescale : rate prescale
  • [12] gate0 : level state of gate0 input
  • [13] gate1 : level state of gate1 input
  • [31...14] ch0_data : sample data from channel0
  • [35...32] ch1_num : channel1 selected in hardware
  • [63...46] ch1_data : sample data from channel1

3.2.3. All Channel Data

  • Data for 1 sample from 16 channels is presented in 5 64byte words
  • this is repeated for all tSamples
  • Data for each sample is an 18bit signed integer
  1. Data Word 1

    streaming_allchannel_data1.png

  2. Data Word 2

    streaming_allchannel_data2.png

  3. Data Word 3

    streaming_allchannel_data3.png

  4. Data Word 4

    streaming_allchannel_data4.png

  5. Data Word 5

    streaming_allchannel_data5.png

4. MOLLERADC Software

4.1. Directory Structure

/home/coda/
      |
      ├── bin/
      |   ├── connectRoc.sh
      |   ├── startRoc.sh
      |
      ├── cfg/
      |   ├── molleradc.cfg
      |   ├── molleradc-stream.cfg
      |
      ├── rol/ -> /home/coda/src/molleradc/rol/
      |   ├── CODA Readout lists (softlink to library rol/)
      |
      ├── lib/
      |   ├── Software Libraries for CODA (molleradc, dalma)
      |
      ├── include/
      |   ├── Software Headers for compiling readout lists / libraries
      |
      ├── src/
          ├── Source code for installed libraries
          

4.2. MOLLERADC Library

4.3. moller Service

4.4. CODA ROC

4.4.1. CODA installation

The MOLLERADC uses a CODA installation at

CODA=/usr/local/coda/3.10_arm

Despite the name, this CODA verison is compiled for aarch64.

4.4.2. systemd + procServ

The coda_roc program is executed with procServ as a systemd service

/usr/local/coda/3.10_arm/systemd/coda_roc.service

This service is enabled to start at boot, and should restart automatically if killed.

procServ executes the coda_roc through the shell script

/usr/local/coda/3.10_arm/systemd/procServ_coda_roc.sh

4.4.3. ROC terminal access

It is not necessary to be connected to the MOLLERADC ROC terminal for CODA operation. Though, it may be useful to monitor it's output. Access to the coda_roc prompt and output is through a local telnet port 20000 (hosted by procServ)

telnet localhost 20000

or with the shell script

connectRoc.sh

4.5. Streaming Mode decoder

Here's a quick EVIO decoder made to emulate that from Michael Gerieke's MOLLERADC readout software:

coda3-decoder : molleradc_streaming branch

5. This Document

5.1. org-file

Author: Bryan Moffit <moffit@jlab.org>

Created: 2025-12-12 Fri 16:10

Validate