New digital low-level RF controls based on the Red Pitaya STEMlab for the TLS Linac system

The Linac system at Taiwan Light Source (TLS) has been in operation for almost a quarter of a century and requires upgrades to improve its reliability. To achieve this, some components of the control system have been replaced with new digital low-level RF control units that use emerging technologies. A new unit is based on the open-source hardware platform which is named “Red Pitaya STEMlab” and offers a compact size and low power consumption. The unit features DAC (Digital-to-Analog Converter) blocks for downloading arbitrary waveforms with external trigger play and ADC (Analog-to-Digital Converter) blocks for waveform acquisition, enabling the development of real-time diagnostic toolkits. The new low-level RF control interface has been fully integrated into the existing EPICS software framework for system integration. The new digital low-level RF control system supports I/Q (in-phase/quadra-ture-phase) data with online amplitude and phase set-tings, and a waveform digitizer for inspecting low-level RF signals from the klystron modulator. Specific graphical applications have been designed and integrated into the existing operation interfaces. The system has been successfully achieved during routine operations. This paper describes the details of these efforts.


Introduction
TLS is a third-generation synchrotron light source located at the National Synchrotron Radiation Research Center (NSRRC) in Taiwan.It has been in operation since 1993 and comprises a 50 MeV electron Linac, a 1.5 GeV booster synchrotron, and a storage ring capable of topup injection with a maximum current of 360 mA.The original control system for TLS was a proprietary design consisting of console level workstations and VME-based intelligent local controllers for interfacing with subsystems [1,2].The hardware and software on the console level workstations have been upgraded several times to keep up with the fast evolution of computer technology.Due to the well-designed structure of the original control software, it has been ported to a new Linux platform without difficulties.
It has been a good experience to apply EPICS as the control system framework for the TPS, and it has been functioning smoothly under routine operation.In order to adopt newer technology and reuse manpower expertise, it was decided to upgrade and maintain the TLS control system using the EPICS framework.As a result, newly installed and rejuvenated subsystems have been operating in the EPICS control environment.Integration of the existing TLS control system with the EPICS framework has been successful without significant issues.The quality of the beam produced by a 50 MeV Linac depends on the flatness of the RF field amplitude and phase, which are affected by the klystron modulator performance and beamloading effects.Tuning the pulse-forming network to achieve an effective microwave pulse can be a challenging task.Alternatively, the RF feedforward system can be used to improve the performance and eliminate tedious tuning.This system compensates for beam-loading effects and removes the effects of slow drift due to various causes [3,4].Recently, the feasibility of RF feed-forward control was studied at the linear accelerator of TLS, and further research and development efforts are underway to improve the con-trol algorithm and RF control hardware.To support top-up operation of TLS, further exploration is required to improve the operational performance of the injector.
The pre-injector of TLS comprises a 140 kV thermionic gun and a 50 MeV linear accelerator system of the traveling-wave type, as shown in Fig. 1.The microwave system includes a multiplier that generates 2998 MHz from 499.654 MHz, an 1 kW GaAs solid-state RF amplifier, and a high power klystron amplifier powered by an 80 MW modulator based on a pulseforming-network (PFN).The PFN is charged using a switching power supply.An analogue I/Q modulator is positioned in front of the GaAs amplifier to control the amplitude and phase of the RF field fed into the linear accelerator.To detect the RF signal from the outlet of the linear accelerator, an analogue I/Q demodulator is utilized.

Control hardware platform
A new digital low-level RF system has been implemented using a card-sized control module that allows for remote access to real-time adjustment and inspection of I/Q data during routine operation.This control module is based on FPGA (Field Programmable Gate Array) hardware architecture, called "Red Pitaya STEMlab" [5], and is designed as an open-source hardware with a card-sized layout, as shown in Fig. 3.It includes one dual-core processor, an editable FPGAbased SoC (System on Chip), two-channel DAC, two-channel ADC, external trigger functionality with a DI (Digital Input) pin, and one gigabit Ethernet port.The main hardware specifications are shown in Table 1, and the module consumes only 7.5 watts of power, which is much lower than the power consumption of traditional waveform generators.The module comes with an internal Linux operating system installed on a micro-SD card, which is used to set up the related software packages, compiled FPGA codes, and application programs.Based on signal testing of its outputs and inputs, this STEMlab module can replace traditional waveform generators and oscilloscopes for long-term low-level RF control systems [6].

Software system architecture and data processing
An EPICS support has been built into a card-size STEMlab module that operates on the Linux operating system.The compiled FPGA image file has been loaded to communicate with the device support via API (Application Interface) library.One of the EPICS database records is the waveform record, which stores the data array acquired from the acquisition device.Related record supports were created with a link to the device supports, and especially the waveform records are made basis array data processing.Then, waveform data is extracted for key characteristic parameters, such as I/Q, amplitude, and phase, to monitor real-time variation.Furthermore, complex array calculation is done by the Python program in the IOC.The software block diagram for establishing EPICS support for the digital low-level RF control unit is shown in Fig. 4. Operators can easily observe and analyse related low-level RF waveforms using the EPICS CA (Channel Access) mechanism.To improve the convenience of operation, the control process has been simplified.In addition to manually generating arbitrary I/Q waveforms using specific programs, functions related to setting parameters such as amplitude and phase have been deployed.This makes it convenient for online fine-tuning.The setting parameters of amplitude (A) and phase (θ) are immediately processed to produce the I/Q waveform data for downloading.The conversion equations are shown in Fig. 5.After the demodulation process, the I/Q waveform data can also be translated to waveform data of amplitude and phase to directly observe variations.

Operation interface
To operate the digital low-level RF system quickly, a graphical user interface (GUI) has been designed as shown in Fig. 6.It includes setting functions for amplitude, phase, and I/Q offset.According to the set parameters, the waveform data of I and Q are generated automatically (left side of GUI).After reviewing the generated waveform data, the user can manually execute the process of downloading it to the two DACs.Then, the stored data of two DACs can be confirmed (right side of GUI) and played back when an external trigger is received.The flowchart for operating the digital low-level control is shown in Fig. 7. Additionally, the GUI provides a setting function for amplitude shaping, which is intended for special-purpose use.To apply specific pattern data, the arbitrary waveform data of two DACs can also be manually designed through programming.The STEMlab module is equipped with a two-channel ADC and FPGA for waveform acquisition.Several STEMlab modules have been built to real-time observe and analyse the related waveform status of the Linac, as shown in Fig. 8.The acquired waveform data are extracted in real-time to obtain the information of I and Q.The waveform of amplitude and phase is then calculated and displayed on the GUI, such as the signal of klystron forward power.In addition, waveform data can be used to extract key characteristic parameters for long-term stability analysis [7].

Conclusion
A new digital low-level RF control unit, based on the Red Pitaya STEMlab module, has been developed and deployed for routine operation since 2020.The EPICS environment is embedded within the same module to facilitate easy maintenance.An integrated GUI supports online parameter adjustments, making operation more convenient.The STEMlab module also includes digitizer functionality for observing the Linac status waveform in real-time.Further advanced functionality with the FPGA module is planned for future development.

Figure 1 .
Figure 1.Schematic layout of the 50 MeV Linac system at TLS.

2 .
Digital low-level RF control for TLS Linac system 2.1.System overview A functional block diagram of the low-level RF system for the TLS Linac is shown in Fig.2.The system comprises a clock generator, an arbitrary waveform output module, an analogue-type I/Q modulator, a GaAs solid-state RF amplifier, a high-power klystron and klystron modulator, an analogue-type I/Q demodulator, and a digitizer.The output module is responsible for generating arbitrary waveform signals for the I/Q control signals that are used as inputs to the I/Q modulator.These signals are then used to drive the Linac output.The I/Q demodulator is used to detect the pickup RF signal and to obtain the

Figure 2 .
Figure 2. Block diagram of the updated low-level RF system for the 50 MeV linear accelerator; it is a feed-forward-enable system.

Figure 3 .
Figure 3. Photo of digital low-level RF control module with the STEMlab 125-14.

14thFigure 4 .
Figure 4. Software block diagram of EPICS-embedded STEMlab module for the digital lowlevel RF control.

Figure 6 .
Figure 6.GUI of digital LLRF control for TLS Linac.

Figure 7 .
Figure 7. Flowchart of operating digital low-level RF control with parameters of amplitude and phase.

Figure 8 .
Figure 8. Waveform digitizer of STEMlab module for observing the status of Linac related signal.