=Paper= {{Paper |id=Vol-2023/217-220-paper-34 |storemode=property |title=Software implementation of usb 3.0 stack for upgraded data link interface on IBR-2 reactor spectrometers in FLNP |pdfUrl=https://ceur-ws.org/Vol-2023/217-220-paper-34.pdf |volume=Vol-2023 |authors=Vladimir Drozdov,Svetlana Murashkevich }} ==Software implementation of usb 3.0 stack for upgraded data link interface on IBR-2 reactor spectrometers in FLNP== https://ceur-ws.org/Vol-2023/217-220-paper-34.pdf
     Proceedings of the XXVI International Symposium on Nuclear Electronics & Computing (NEC’2017)
                           Becici, Budva, Montenegro, September 25 - 29, 2017



 SOFTWARE IMPLEMENTATION OF USB 3.0 STACK FOR
 UPGRADED DATA LINK INTERFACE ON IBR-2 REACTOR
            SPECTROMETERS IN FLNP
                          V.A. Drozdova, S.M. Murashkevichb
   Frank Laboratory of Neutron Physics, Joint Institute for Nuclear Research, 6 Joliot-Curie, Dubna,
                                   Moscow region, 141980, Russia


                            E-mail: a drozdov@jinr.ru, b svetlana@jinr.ru

         In this work software implementation of USB3.0 stack protocols for operating data acquisition
units of the IBR-2 spectrometric system with an upgraded communication adapter, is considered.
         The data acquisition system on De-Li-DAQ-2D and MPD blocks developed earlier in FLNP is
widely used on neutron spectrometers today. To connect the modules to the computer, a FLINK fiber
optic adapter with an USB2.0 interface was originally developed for this system.
         Modern trends towards increasing the number of detector channels and volume of the recorded
and accumulated information in real time in experiments on IBR-2 spectrometers in FLNP require
increasing the bandwidth and reliability of the communication channel.
         In addition to replacing the driver and using the FTD3XX library of the FT600 chip to provide
the USB Super Speed to FIFO bridge with a new communication adapter, improvement of software
for an advanced application communication protocol with DAQ blocks is also required.
         Upgrading of the adapter and improvement of software for a new application-layer protocol
resulted in an increase of the bandwidth and reliability of the communication channel.

Keywords: data acquisition, detectors, adaptor, data transmission protocol

                                                  © 2017 Vladimir A. Drozdov, Svetlana M. Murashkevich




                                                                                                     217
     Proceedings of the XXVI International Symposium on Nuclear Electronics & Computing (NEC’2017)
                           Becici, Budva, Montenegro, September 25 - 29, 2017



1. Introduction
         At present, data acquisition systems for all the IBR-2 spectrometers at the Laboratory of
Neutron Physics JINR include MPD electronic modules for processing and accumulating data from
point detectors (gas and scintillation counters). To collect data from one- or two-coordinate position-
sensitive detectors using the readout method with a delay line, a DAQ system with a De-Li-DAQ-2D
module [3] was created in our Department. A distinctive feature of MPD and De-Li-DAQ-2D modules
is the use of a unified fiber optic serial interface.
         The MPD modules are implemented using FPGA, which provides compatibility and flexibility
in the choice of system configuration. Up to 240 detector elements can be connected to the data
acquisition system, the maximum throughput being 8M events/s.
         The module De-Li-DAQ-2D includes: an 8-channel time-to-digit converter (TDC-GPX) with
a resolution of 80ps, a FPGA chip whose firmware executes logical operations, selects and filters
events, a histogram memory with a volume of 1GB, which allows accumulation of 3-dimensional
spectra X-Y-TOF measuring 512x512x1024 with 32-bit words. The actual counting rate (taking into
account data transmission and recording in PC) is not less than 1M events/s.
         Both modules are implemented in the NIM standard. All the functions and parameters of the
MPD and De-Li-DAQ-2D modules are programmable. The modules are controlled by programs
contained in the Sonix+ software complex for experiment control [2]. Basic modes of data acquisition
are a histogram mode (on-line sorting and collection of spectra in HM) and a list mode (“Raw” data).




        Figure1. In the photo on the left is an MPD board, on the right is a De-Li-DAQ-2D module

         Data transmission between the module and the computer is carried out via a serial fiber-optic
communication line and a specially developed adapter FLINK with USB2.0 interface. The optical
transceiver and serializer/deserializer located in the interface modules of adapters and DAQ modules
allow working at speeds up to 1.25 Gbit/s along the optical fiber link. The MPD and De-Li-DAQ-2D
modules have similar interfaces. Communication with the PC is carried out via the USB 2.0 port using
a communication adapter that contains the SX2 Cypress USB controller chip (CY7C68001). The USB
controller has 4 Endpoints that share the 4-KB FIFO space and presents an external FIFO interface
through which two Endpoints are used for transmitting commands and data and two for receiving data
from the memory of the modules along with the “Raw” data.
         A characteristic feature of the organization of communication protocols using such an adapter
was that it also performed conversion of various data transfer protocols for USB2.0 and for the fiber-
optic interface protocol. At the same time, transformation of protocols in this adapter did not ensure
transparent transmission and receiving of packets received and generated by modules. Also, the data
packet conversion version used in the adapter did not provide control over loss of data packets if the
data stream exceeded the bandwidth of the USB2.0 interface. In addition, using the USB2.0 interface
limited the maximum data transmission speed taking into account the fact that MPD and De-Li-DAQ-
2D modules have interface blocks that allow the speed through the optical channel up to 1.25 Gbit/s.



                                                                                                     218
     Proceedings of the XXVI International Symposium on Nuclear Electronics & Computing (NEC’2017)
                           Becici, Budva, Montenegro, September 25 - 29, 2017



2. Modernization of the Data acquisition systems on the IBR2
spectrometers
         Modernization of spectrometers at the IBR-2 reactor and development of new projects for
neutron detectors require an increase in the number of detector channels and in the amount of data
acquisition and storage in real time, which in turn requires an increase in the bandwidth and reliability
of the communication channel for data acquisition systems.
         First of all, to fully realize the capabilities of the De-Li-DAQ-2D and MPD-240 modules
already installed on spectrometers, it was necessary to upgrade the communication adapter and data
transfer protocols.
         The natural solution was transition to the USB3.0 standard and a new version of the FLINK
adapter was designed.
         In the new version of the adapter, instead of the USB2.0 controller CY7C68001, which
provides functioning of the interface USB2.0-FIFO bridge, the FT600 chip from FTDI is used, which
creates the USB3.0 – FIFO bridge.
         Like the previous adapter, the new USB controller has 4 Endpoints that provide an external
FIFO interface for transmitting commands and data from the host computer as well as for receiving
data from memory modules along with the measured raw data. The end points of the USB controller
are configured to the standard exchange "BULK" type.
         The USB 3.0 specification increases the maximum data transmission rate to 5 Gb / s, which is
an order of magnitude more than 480 Mbit / s that USB 2.0 can provide. Using the USB3.0 interface in
the Super Speed mode has a number of significant advantages over USB2.0:
- USB 2.0 does not have a Streaming capability while Super Speed supports Streaming for bulk
endpoints (important when receiving “raw”data);
- USB 2.0 is a half-duplex broadcast bus while Super Speed is a dual-simplex unicast bus which
allows concurrent IN and OUT transactions;
- USB 2.0 does not support bursting while Super Speed supports continuous bursting.
         Upgrading the adapter and switching to the USB3.0 interface required upgraded data
acquisition software. Due to the use of the FT600 chip, which provides the USB Super Speed FIFO
bridge in the new communication adapter, the USB2.0 CyUSB.SYS driver was replaced with the
FTDI D3XX driver, designed to work with the FT60x series chips.
         The new version of the software uses the API of the FTD3XX library, preserving previous
functionality, namely initializing the blocks, setting the necessary parameters and block modes,
starting and stopping the exposition, reading registers and histogram memory, obtaining raw data,
data storage on the hard disk, etc. The FTD3XX library provides all the necessary functions for
working with Endpoints. Principal functions of the library: read and write BULK Endpoint
FT_WritePipe and FT_ReadPipe for synchronous and FT_ReadPipe and FT_SetStreamPipe function
for asynchronous transmissions. When an FT_SetStreamPipe function is used the FT_ReadPipe no
longer sends a session command to the chip because the chip already knows how much data is
requested. Data acquisition programs use a synchronous method for transmitting commands and data
to and from Endpoints, and an asynchronous method for reading raw data.
         The new version of the adapter provide support of a single communication protocol and the
formats of packets used both in the optical channel and at the application level. In this case, the format
of data presentation sent to the USB driver at the application software level has been changed
according to the packet format and the protocol used in the fiber interface of the modules. This
communication protocol provides for data exchange with modules and transmission of commands in
the form of packets with a fixed structure enabling identification of the packet type, data integrity
control, transmission of service packets for acknowledgment of communication and diagnostics of the
state.
         When a command or data packet is generated by the control program, a corresponding header
identifier is added to the beginning of the command or data packet block, and the end is a checksum to
verify the integrity of the data. The packet in such a form is transmitted to the modules via the USB




                                                                                                     219
     Proceedings of the XXVI International Symposium on Nuclear Electronics & Computing (NEC’2017)
                           Becici, Budva, Montenegro, September 25 - 29, 2017


interface. To control the execution of commands, the response packets of the acknowledgment packets
(NACK, ACK) and the module state packets (BUSY, READY, ERR) generated by the module are
used.
         The adapter provides transparent transmission of these packets using the appropriate channels
- the streams associated with the dedicated addresses of the USB controller endpoints.
         The fiber-optic interface with data acquisition units in the new adapter remains unchanged,
which ensures compatibility of the previously developed units with the new adapter unit.
         This also ensures that the data acquisition applications previously developed for these blocks
are compatible at the function level. Transmission of packets from PC to modules and back is carried
out in a unified format. Packet checking is performed only on the side of the module and in the PC.


3. Conclusion
        The new software implementation of USB 3.0 stack protocol for DAQ blocks allows one to
monitor the integrity of packets and absence of lost packets and also, receive confirmation of package
delivery or information about problems when sending commands and data to the module. Depending
on the response one makes further decisions.
        As a result of upgrading the adapter and developing software for the new application-layer
protocol, the bandwidth and reliability of the communication channel have been improved.


References
 [1] S. A. Kulikov, V.I.Prikhodko. A new generation of data acquisition systems for the IBR-2 reactor
spectrometer complex. Particles and Nuclei, V.47, Issue 4, 2016 (in Russian).

[2] Sonix+, http://sonix.jinr.ru

[3] F. V. Levchanovskiy, S. M. Murashkevich . De-Li-DAQ-2D - a New Data Acquisition System for
Position-Sensitive Neutron Detectors with Delay-Line Readout. Physics of Particles and Nuclei
Letters, 2016, Vol. 13, No. 5, pp. 591–594




                                                                                                     220