A portable NMR platform with arbitrary phase control and temperature compensation

Abstract In this paper, we present a custom-designed nuclear magnetic resonance (NMR) platform based on a broadband complementary metal–oxide–semiconductor (CMOS) NMR-on-a-chip transceiver and a synchronous reference signal generator, which features arbitrary phase control of the excitation pulse in combination with phase-coherent detection at a non-zero intermediate frequency (IF). Moreover, the presented direct digital synthesis (DDS)-based frequency generator enables a digital temperature compensation scheme similar to classical field locking without the need for additional hardware. NMR spectroscopy and relaxometry measurements verify the functionality of the proposed frequency reference and temperature compensation scheme as well as the overall state-of-the-art performance of the presented system.


Introduction
Nuclear magnetic resonance (NMR) is one of the most powerful analytical methods that allows for the direct measurement of molecular information. Due to its non-invasive nature and the possibility of measuring the NMR signal contactless, NMR is widely used in biomedicine (Peng et al., 2014;Chen et al., 2021), chemistry (Singh and Blumich, 2018), agriculture (Colnago et al., 2021), and industrial applications (Rudszuck et al., 2021). Over the last 10 to 15 years, with technology advancements in the fields of magnet design, pulse sequences, and electronics, NMR has seen two major areas of evolution. In high-field NMR, the increasing requirements for sensitivity and resolution lead to sophisticated and cumbersome NMR devices based on superconducting magnets with higher and higher magnetic field strength and very high field homogeneity (Gan et al., 2017). These devices are capable of chemical structure analysis and medical imaging with unprecedented spectral and spatial resolution. In low-field NMR, the development of chip-integrated CMOS-based NMR transceiver electronics (NMR-on-a-chip) (Sun et al., 2009;Ha et al., 2014;Grisi et al., 2015;Lei et al., 2016a;Handwerker et al., 2016;Bürkle et al., 2020) has led to portable NMR (pNMR) detection platforms based on permanent magnets, which are suitable for point-of-care applications Liong et al., 2013;Ha et al., 2014;Lei et al., 2015Lei et al., , 2017Lei et al., , 2020.
As detailed in two recent review articles (Anders and Lips, 2019;Anders et al., 2021), the NMR-on-a-chip approach allows for integrating the entire NMR console on a tiny footprint of a few square millimeters. To the best of our knowledge, the original idea of designing CMOS-based NMR electronics was presented by Boero et al. (1998). Since then, the idea of integrating planar on-chip microcoils with CMOS transceivers has been widely employed (Lei et al., 2016b;Grisi et al., 2017;Handwerker et al., 2020) to produce miniaturized NMR detectors with very small detection volumes and very good spin sensitivities. Initially, the NMR-on-a-chip detectors were designed for operation inside conventional superconducting NMR magnets, focusing on the miniaturization and parallelization of the NMR receiver (RX) (Boero et al., 2001;Anders and Boero, 2008;Kim et al., 2010;Anders et al., 2011). Later, with the advent of small-sized per-Q. Yang et al.: A portable NMR platform with arbitrary phase control and temperature compensation manent NMR magnets, fully-integrated NMR transceiveri.e., combined transmitter and receiver -chips were developed to realize portable, low-field NMR detection platforms (Liu et al., 2008;Sun et al., 2011;Ha et al., 2014). The transceivers were then also extended to high-field NMR by the use of on-chip wide-range frequency synthesizers (Kim et al., 2012;Grisi et al., 2015;Handwerker et al., 2016). More recent developments include improvements in the driving strength of the NMR-on-a-chip transceivers by the use of high-voltage CMOS technologies (Bürkle et al., 2020(Bürkle et al., , 2021 and the co-integration of electron spin resonance (EPR) electronics on a single chip to perform on-chip dynamic nuclear polarization (DNP) experiments (Solmaz et al., 2020). Very recently, Hong and Sun (2021) have presented an NMR-ona-chip transceiver that allows for phase-coherent detection at an arbitrary, non-zero intermediate frequency (IF) by using a dedicated design solution in the receiver path.
In this paper, we present a portable NMR system based on one of our NMR-on-a-chip transceiver application-specific integrated circuits (ASICs) with augmented functionalities. More specifically, the proposed NMR system provides the possibility of arbitrary phase modulation of the excitation pulse and, even for the case where the receiver local oscillator frequency is different from the excitation frequency, phasecoherent detection of the resulting NMR signal at a non-zero IF by the use of two commercially available direct digital synthesis (DDS) chips. Additionally, the presented system features an active, field-locking-based temperature compensation enabled by the DDS frequency synthesizers (Issadore et al., 2011;Lei et al., 2017).
The paper is organized as follows. Section 2 discusses some key design considerations of portable, low-field NMR platforms and introduces the proposed system architecture. Section 3 then describes the utilized transceiver chip and DDS-based reference signal generator as well as the signal processing unit and the utilized probe head. Finally, Sect. 4 provides measurement results of the proposed system that verify its functionality before the paper closes with a discussion and a brief outlook on future work in Sect. 5.

Design consideration and system architecture
Before introducing the proposed system architecture, we will discuss some critical design considerations of portable NMR detection systems. In contrast to high-field NMR inside superconducting magnets, low-field NMR based on permanent magnets and NMR-on-a-chip transceivers suffers from a low signal-to-noise ratio (SNR) and magnetic field drift. The former is mainly due to the low polarization levels, the low operating frequency, and the limited transmitter power of NMRon-a-chip transceivers. The latter is due to the large temperature coefficient of standard permanent magnet materials (up to 1200 ppm K −1 for NdFeB magnets and 500 ppm K −1 for SmCo magnets).

Phase control
According to the reciprocity principle, the SNR of the NMR signal in the time domain 1 can be written as (Hoult and Richards, 1976;Hoult, 2000) where ω 0 is the nuclear Larmor frequency (ω 0 = γ B 0 ), B u is the unitary magnetic field of the detection coil, M 0 ∝ ω 0 is the nuclear magnetization, V s is the sample volume, and R coil is the AC coil resistance, which is proportional to the square root of the operating frequency due to the skin effect without considering the proximity effect (Minard and Wind, 2001). k is Boltzmann's constant, T is absolute temperature, and f is the considered detection bandwidth. Thus, SNR decreases rapidly as the working frequency decreases SNR ∝ ω 7/4 0 , which is one of the main limitations of low-field NMR.
One standard method to improve the SNR is to repeat the NMR experiments many times and average the individual results in the time domain, introducing a strong trade-off between signal quality (SNR) and measurement time. Importantly, for time-domain averaging to work properly, the signal phase has to be constant across all individual NMR time traces and different excitation pulse lengths. In the following, we will refer to this property as "phase-coherent detection". Today, most modern NMR spectrometers make use of quadrature detection (Keeler, 2013), allowing for both a receiver local oscillator (LO) frequency that equals the excitation frequency (homodyne detection) as well as a (small) offset between the excitation and the receiver local oscillator frequencies (low-IF detection) (Bürkle et al., 2020;Issadore et al., 2011;Hong and Sun, 2021). The former benefits from the intrinsically coherent output phase across different scans but introduces a trade-off between excitation efficiency (onresonance vs. off-resonance excitation) and 1/f noise (for a single spectral line, on-resonance excitation results in zero IF, while off-resonance excitation produces an intrinsic nonzero IF). The latter allows for both on-resonance excitation and a non-zero IF to alleviate the influence of 1/f noise on the overall SNR. However, the low-IF approach also comes at the expense of an uncertain receiver phase if no dedicated countermeasures are taken. This is illustrated in Fig. 1. Here, we have, without loss of generality, assumed a simple sample containing a single homogeneously broadened line at a Larmor frequency of f L . In this case, on-resonance excitation corresponds to f TX = f L , where f TX is the frequency of the excitation pulse. Under these conditions, the rotating frame of reference during the pulse and during detection of the NMR signal after the pulse rotates with the same frequency of f L = f TX . As illustrated in the figure, when the frequency of the local oscillator in the receiver, f LO , is equal to the frequency of the rotating frame of reference, i.e., f LO = f TX = f L , the phase of the downconverted NMR signal is constant. By contrast, if the local oscillator frequency is different from the frequency of the rotating frame of reference, i.e., f LO = f TX,L , the downconverted NMR signal has a non-constant phase that depends on the offset frequency of the rotating frame of reference, f TX = f L = f TX,L , and the LO frequency, f LO , according to f = f IF = f TX,L − f LO , which is the inter-pulse distance and the pulse duration. Intuitively, for f = 0, the receiver observes the NMR signal at the wrong angular velocity, leading to a residual rotation of the NMR signal after down-conversion, which, in turn, leads to the non-constant phase of the downconverted NMR signal.
Recently, Hong and Sun (2021) proposed a customdesigned hardware solution for the phase coherence problem in low-IF receivers explained above. Their solution is based on delaying the transmit signal generated by the pulse controller until the phase of the excitation pulse is in phase with the LO signal in the receiver, resulting in a constant phase of the downconverted NMR signal across multiple scans. This is achieved by the use of a phase alignment detector (a phase-frequency detector followed by a resistor-capacitor (RC) low-pass filter and an inverting Schmitt trigger), which delays the software transmit signal from the pulse controller until the phase of the excitation pulse is in phase with the receiver LO signal. While this scheme works well for pulse schemes with fixed inter-pulse delays such as the CPMG (Carr-Purcell-Meiboom-Gill) sequences presented in Hong and Sun (2021), it is not suitable for experiments that require variable, arbitrarily and precisely definable time intervals between consecutive excitation pulses such as inversion recovery (IR) experiments. More specifically, the phase alignment circuit proposed in Hong and Sun (2021) introduces a nonconstant delay, T delay , between the software transmit signal from the pulse controller and the actual transmit pulse at the output of the hardware alignment circuit, which can be as large as T delay ≤ 1/f IF , where 1/f IF is the period corresponding to the utilized IF frequency. As an example, the IF of f IF = 50 kHz used in Hong and Sun (2021) introduces an uncertainty in the actual pulse occurrence of up to 20 µs. To avoid this problem, it has to be possible to synchronize the receiver LO signal to the transmitter waveform at will without introducing non-constant delays in the transmitter timing.
Moreover, the phase of the excitation pulse should also be adjustable at will to enlarge the range of possible pulse sequences, including, for example, phase cycling. Phase cycling is a very useful capability for low-field NMR-on-achip platforms, because it mitigates the effect of gain and phase mismatch between the in-phase and quadrature outputs of the on-chip and PCB-based electronics without the need for (expensive) calibration. Without proper countermeasures, the gain and phase mismatch cause an imperfect cancelation of the image frequency, i.e., the frequency at f IM = f LO ± f IF , when the desired signal is located at f NMR = f LO ∓ f IF , distorting the NMR spectrum. Phase cycling is an effective method to remove these artifacts (Rahman et al., 2016), which requires arbitrary phase control of the transmitter phase and, if a non-zero IF is used, measures to ensure a coherent phase of the receiver LO signal.
In this paper, we propose a solution for the abovementioned problem based on two commercially available DDS chips that allows for an arbitrary intermediate frequency, an arbitrary phase of the excitation pulse, and a phase-coherent receiver LO signal without compromising the pulse timing. The details of the proposed scheme are given in Sect. 3.2.

Temperature drift
In most state-of-the-art low-field NMR platforms, permanent magnets are used due to their small size and low power consumption (Alnajjar et al., 2021;Yang et al., 2021). One limitation of such systems is that temperature fluctuations can cause severe frequency drifts if no countermeasures are taken. For instance, considering a free induction decay (FID) signal with a full width at half maximum (FWHM) of 100 Hz in the frequency domain measured with a 0.5 T NdFeB permanent magnet, the temperature would need to be kept constant with a precision of around 0.004 • C to avoid artifacts in the spectrum. Fortunately, various methods can be used to stabilize the NMR spectrum against environmental temperature fluctuations. For example, keeping the magnet in a temperature-controlled box is the most common method (Yu et al., 2018). However, this approach requires the temperature control of a large volume and is, therefore, quite power hungry. Actively adjusting the static B 0 field by means of a field-frequency lock (FFL) is another common method to stabilize the field over time. This approach uses a feedback control based on real-time measurements of an NMR reference signal -frequently of a nucleus other than the one under observation in the main channel -in an auxiliary NMR channel that is operated in parallel with the main channel (Hoult et al., 1978;Kan et al., 1978;Chen et al., 2018). With this method, the magnetic field can be stabilized at sub-ppm levels of accuracy over several hours of measurement time (Takahashi et al., 2012). Alternatively, a high-precision Hall sensor can also be used to monitor the B 0 field over time (Lei et al., 2017). One drawback of the conventional FFL method is that it requires a dedicated lock channel, significantly increasing the hardware complexity, especially for low-cost portable NMR systems. As an alternative to adjusting the B 0 field, the feedback loop in the FFL method can also be closed by modifying the excitation frequency to follow the measured changes in the Larmor frequency (Issadore et al., 2011;Lei et al., 2015). Here, it should be noted that all FFLbased methods that use a single field probe to measure the B 0 field can only be used to control the average B 0 field but cannot compensate for temperature-induced changes of the field homogeneity, which can largely deteriorate the achievable frequency resolution when averaging over a long time. Therefore, several signal processing techniques based on the measured NMR signal can be used to complement the abovementioned hardware measures to improve system robustness against temperature fluctuations further (Morris et al., 1997;Ha et al., 2014). Among them, a compensation method based on reference deconvolution is widely used to obtain a highresolution NMR spectrum in the presence of spatially fluctuating B 0 fields (Morris, 1988;Barjat et al., 1995;Iijima and Takegoshi, 2008). In this approach, the ideal spectrum is reconstructed by deconvoluting the measured (main) NMR spectrum with the ratio of the measured and the ideal reference signals.
In this paper, we propose a field-locking-based solution for eliminating the effect of magnet temperature drift on the measurement results that uses a digital control loop to adjust the excitation frequency automatically based on the measured IF. The details of the proposed method are also given in Sect. 3.2.

Proposed system architecture
The architecture of the proposed portable NMR system is shown in Fig. 2. It comprises five main building blocks: (i) an RF coil for sample excitation and detection of the NMR signal, (ii) a CMOS NMR-on-a-chip transceiver containing all performance-critical analog transceiver electronics, (iii) a reference signal generator to generate frequency-and phaseadjustable excitation pulses and a phase-coherent receiver LO signal, (iv) a digital signal processing unit for system control and signal acquisition, and (v) a motherboard that integrates all required power management and further signal conditioning electronics such as anti-aliasing filters and level shifters.

NMR-on-a-chip transceiver and signal conditioning electronics
According to Fig. 3a, the custom-designed CMOS NMRon-a-chip transceiver consists of a programmable integer-N phase-locked loop (PLL), a quadrature (IQ) generator, a power amplifier (PA), a low noise amplifier (LNA), a quadrature down-conversion mixer, and two variable gain amplifiers (VGAs). Depending on the chip configuration, the on-chip PLL can be used to multiply the external reference frequency by a selectable scaling factor between 1 and 64. Alternatively, the PLL can be bypassed, and the external reference signal is divided by 2 to produce the required quadrature LO signals from the external reference. In the latter mode of operation, the chip can produce excitation frequencies down to DC, while the minimum detectable frequency in the receiver path is limited by an on-chip coupling capacitor between the LNA and the mixers. Since the on-chip PLL can operate with reference frequencies between 5.7 and 12.1 MHz, overall, the chip has an operating frequency range between 5 and 770 MHz. The H-bridge-based PA uses a separate supply voltage of 2.5 V and provides a maximum peak-to-peak output current of 180 mA into a 10 load.
In the receiver path, the NMR signal is first amplified by an LNA and then down-converted by a quadrature mixer to an intermediate frequency (IF). Although zero-IF operation is possible, we typically operate the chip with an IF between 50 and 200 kHz to avoid SNR degradation due to flicker noise. The LNA features a state-of-the-art input-referred voltage noise of 770 pV Hz − 1 2 . The measured maximum combined gain of the LNA and the mixer is 45 dB. The two digitally programmable VGAs provide a gain between 0 and 40 dB. The two VGAs are followed by a pair of off-chip PCB-based fourth-order Bessel low-pass filters (LPFs) with a fixed gain of 28 dB and a fixed cutoff frequency at 350 kHz. The maximum overall gain of the receiver chain is 113 dB. Figure 3b shows a micrograph of the NMR-on-a-chip transceiver. The chip is implemented in a 130 nm SiGe BiCMOS technology offered by STMicroelectronics.
At this point, it is worth mentioning that the NMR-on-achip transceiver of Fig. 3a uses a single PLL with a single reference frequency to generate both the excitation and the local oscillator signal for the quadrature down-conversion mixer.  In the following section, we will explain how it is still possible to provide both excitation pulses with an arbitrary phase and timing and a phase-coherent down-converted NMR signal at a non-zero IF.

Proposed phase-coherent reference signal generator with temperature compensation
Direct digital synthesis (DDS) is a common choice for providing accurate reference signals in modern commercial NMR spectrometers, because it can conveniently and rapidly change the frequency, phase, and amplitude of a waveform.
To allow for both phase coherence in the receiver path and phase adjustability of the excitation pulse, in this paper we propose a synchronous reference signal generator based on two commercially available DDS chips (AD9835, Analog Devices; AD9835, 2022), according to Fig. 4a. The two DDS chips (DDS1 and DDS2) utilize the same crystal oscillator (LFSPXO023414) with a clock frequency of 50 MHz to enable phase synchronicity between their two output signals. The 50 MHz reference frequency was selected to satisfy the Nyquist theorem with some margin for the largest NMR transceiver PLL reference frequency of 12.1 MHz. The AD9835 possesses two frequency registers, each of which can be programmed with a 32-bit frequency tuning word (FTW). A 1-bit frequency select input (FSELECT) then determines which FTW is used in the phase accumulator. Each AD9835 has two frequency registers that allow for fast switching between two different frequencies, e.g., to perform a frequency shift keying (FSK) modulation, where each frequency can be defined with a resolution of 11.6 mHz. Furthermore, there are four additional 12-bit phase tuning word (PTW) registers that allow for an arbitrary adjustment of the phase of the DDS output signal with a resolution of 1.53 mrad (0.088 • ). A 2-bit phase select input (PSEL0, PSEL1) determines which PTW is used for the phase accumulator. The output of each DDS chip is filtered and amplified by an active second-order Butterworth LPF with a cutoff frequency of 12.8 MHz and a gain of 6 dB. The current reference frequency for the CMOS transceiver, f ref , is selected with an analog switch (TS5A63157, Texas Instruments, Inc.), which displays a maximum delay of 5 ns and an isolation of 61 dB. The detailed method to generate a reference frequency f ref that allows for both an arbitrary adjustment of the phase of the excitation pulse and a phase-coherent receiver LO when operating at an arbitrary IF is as follows. First, the outputs of both DDS chips are deactivated, and their phase accumula- tors are set to zero. Then, two groups of FTWs are simultaneously loaded into the two frequency registers of each DDS, the first corresponding to the Larmor frequency of the nucleus of interest f L and the second to the desired receiver LO frequency (f RX = f L + f ). Additionally, four PTWs with N being the divider ratio of the PLL of the CMOS transceiver chip, are also loaded into the four phase registers of each DDS. Here, it should be noted that the FTWs are initially selected such that both DDS chips start with the same output frequency of f L /N . Although, in this configuration, the reference frequency of the PLL corresponds to the excitation frequency, the transceiver chip is in its receive (RX) mode until the chip's transmit (TX) signal is enabled. Setting both DDS values to a value of f L /N ensures that the phase of the receiver DDS is synchronous with the transmitter phase when the frequency of the NMR-on-a-chip transceiver is changed to f RX /N at the end of the transmitter pulse. We will explain this important point below in more detail. After that, both DDS outputs are activated. The digital control signal for the FSELECT port of DDS2 is triggered by the software transmit (TX) signal. More specifically, a falling edge of the transmit (TX) signal causes the output frequency of DDS2 to change from f L /N to f RX /N with a continuous phase. In this way, it is ensured that the receiver LO phase is synchronized to the phase of the latest excitation pulse, even when using different excitation pulse phases. Since the multiplexer switch is not toggled from DDS1 to DDS2 until the end of the excitation pulse, the PLL reference frequency f ref remains connected to the output of DDS1, which still operates at a frequency of f L /N , ensuring an excitation of the spin ensemble at a frequency of f L . After a delay of a few microseconds from the falling edge of the transmit (TX) sig-nal, the new reference frequency f ref = f RX /N is finally applied to the PLL of the NMR-on-a-chip transceiver, and the PLL locks to this new reference frequency and phase within a few microseconds. The PLL locking time is determined by its bandwidth of a few hundred kilohertz. Here, the on-chip PLL was designed to lock faster than the coil's/receiver's typical dead time. Overall, in this way, DDS1 is allowed to run continuously at a frequency of f L /N , preserving its phase, which is the key requirement for phase-coherent excitation pulses in multi-pulse NMR experiments, and DDS2 provides an LO signal for the NMR-on-a-chip transceiver that is coherent with the last excitation pulse. Figure 5a summarizes and illustrates the overall timing of the DDS output explained above for a single excitation pulse. The PSEL bit can be used to select between different phases for the excitation pulse, i.e., the output of DDS1, to perform, for example, phase cycling or generate a classical CPMG sequence. Figure 5b and c show how the PSEL bit is used to provide a phase change of ±90 • in the output of DDS1. Finally, it should be noted that, for multi-scan measurements with averaging, the phase accumulator must be set to zero after each scan.
In addition to providing a phase-coherent non-zero IF detection with an arbitrary excitation phase, the presented DDS-based frequency synthesizer can also be used to solve the temperature drift problem explained in Sect. 2.2. More specifically, to overcome this problem, our proposed NMR platform incorporates an automatic control loop, which automatically updates the FTW of each DDS to provide an on-resonance excitation at the Larmor frequency even in the presence of B 0 field drifts. The automatic control loop works as follows. After each excitation pulse, the frequency information is extracted from the acquired FID or spin-echo signal, respectively. This measured frequency is compared with the predefined (in the control software) intermediate frequency of a selected peak in the spectrum. The implemented algorithm then updates the FTW of both DDS1 and DDS2 to provide an on-resonance excitation and keep the measured IF constant.

Data acquisition and digital signal processing
For data acquisition and digital signal processing, we used a commercial multifunction I/O device (USB-6366, National Instruments). The USB-6366 offers eight differential 16-bit analog input ports with a sampling rate of 2 MS s −1 per channel and 24 digital I/O channels. Our system uses an 8-bit digital output bus to generate the required digital control waveforms with a maximum sample frequency of 1 MHz, e.g., to communicate with the NMR-on-a-chip transceiver and the DDS chips via SPI. The USB-6366 also offers four 32-bit counters/timers, which can be used for pulse generation and event counting. To orchestrate the experiments, we have developed a custom-made LabVIEW-based NMR control software. The software controls the communication with each DDS and the programmable NMR-on-a-chip transceiver; the generation of the NMR sequences, including phase control; and the analysis of the acquired NMR signals.

NMR probe head
The NMR probe heads for the experiments presented in this paper consist of an NMR coil and a tuning capacitor without matching to benefit from the intrinsic noise-free preamplification of the inductor-capacitor (LC) resonator formed by the coil and the tuning capacitor Handwerker et al., 2013). Impedance matching is not required due to the close spatial proximity of the LC resonator and the in-field NMR-on-a-chip transceiver.
To demonstrate the versatility of the proposed NMR platform, we have used two different solenoidal coils with largely different sizes, see the inset of Fig. 6. The first coil (spectroscopy probe) is optimized for spin sensitivity. It is implemented as a 10-turn solenoidal coil by winding tightly -i.e., leaving a spacing as small as possible between adjacent turns -a 50 µm enameled copper wire around a smalldiameter glass capillary (i.d.: 0.38 mm, o.d.: 0.4 mm). At 62 MHz, the coil displays a measured impedance of (0.6 + j 13.4) with an inductance of 34.25 nH. In combination with our NMR-on-a-chip transceiver, the spectroscopy probe produces 90 • pulse lengths of 5 µs, corresponding to an effective B 1 field of 1.2 mT. The second coil (relaxometry probe) was optimized towards improved concentration sensitivity for relaxometry measurements, taking into account the limited driving strength of the utilized broadband NMR-on-achip transceiver. It is implemented as a 10-turn solenoid by winding a 0.12 mm enameled copper wire around a larger glass tube (i.d.: 1.5 mm, o.d.: 2 mm) using the bifilar winding method (Wu et al., 1994). At 15.3 MHz, the coil displays a measured impedance of (1.0 + j 15.0) with an inductance of 156 nH. In combination with our NMR-on-achip transceiver, the relaxometry probe produces 90 and 180 • pulse lengths of 18 and 38 µs, respectively. The latter value is deduced from the best echo quality. The 90 • pulse length corresponds to an effective B 1 field of 330 µT.
Samples are inserted into the two coils by using capillary glass tubes with outer diameters of 0.3 and 1.3 mm.
For the following experiments, two different magnets with B 0 field strengths of 0.36 and 1.45 T were used. The first magnet (B 0 = 0.36 T), which was used for the relaxometry measurements, is a custom-designed H-shaped magnet that features a small volume of 26 × 9.9 × 5 cm 3 , a relatively low weight, and a moderate homogeneity of 20 ppm over the sample volume. The second one (B 0 = 1.45 T), which was used for the spectroscopy experiments below, is a strippeddown Bruker MiniSpec magnet, which provides better homogeneity at a larger form factor and weight.

Experimental results
In order to verify the performance of the proposed NMR platform, we have conducted a series of experiments. Here, we have first verified the phase coherence between multiple acquisitions in multi-scan experiments for efficient timedomain averaging. To this end, we compared the phase distribution of the actual FID signals when using dif- Table 1. Comparison of the phase distribution of the recorded FID signals for the proposed DDS-based frequency generator and commercial instruments for 10 consecutive scans.
Off-resonance On-resonance On-resonance ferent reference signal sources for the NMR transceiver chip. More specifically, a commercial waveform generator (Keysight 33600A) equipped with a frequency shift keying (FSK) option was used as an alternative reference signal source for our proposed DDS-based signal generator. The use of FSK for phase-coherent averaging in combination with NMR-on-a-chip transceivers and non-zero IFs was first proposed in Handwerker et al. (2020). This approach is sufficient for phase-coherent averaging in simple pulse-acquire experiments, because all standard FSK implementations switch the frequency phase coherently (typically at the zero crossings of the phase). However, the FSK approach does not allow for coherent control of the phase of the excitation pulse across multiple pulses. In these experiments, we compared both onresonance, i.e., f TX = f L , and off-resonance, i.e., f TX = f L , excitation. Here, off-resonance excitation allows for a nonzero IF of f IF = f TX − f L without the need to switch the reference frequency between transmit (TX) and receive (RX) at the expense of reduced excitation efficiency. To obtain statistics on the phase distribution of the individual FIDs, we recorded 10 consecutive FIDs for the commercial frequency generator and the proposed DDS-based solution using the relaxation probe filled with a vegetable oil sample.
The detailed steps of calculating the phase distributions are as follows. The original FID signal length was first extended by a factor of 3 using zero padding. Then, we Fourier transformed the extended FIDs and adjusted the phase to obtain a pure absorption spectrum in the real part of the spectrum.
Since there was only one line in the spectrum, it was sufficient to use a zero-order phase correction with a single correction phase 2 φ corr,i (Keeler, 2013) for each FID. We then computed the standard deviation of the correction phases of all 10 FIDs φ corr,i . The results are listed in Table 1. The data clearly show that the proposed DDS solution allows for phase-coherent time-domain averaging with a performance that is on par with a medium-priced commercial instrument.
Additionally, to test the system stability during a longterm averaging measurement, we also recorded 4000 consecutive FID signals over 4 h. In these experiments, the proposed field-locking-based temperature compensation scheme was enabled. Table 2 summarizes the results of this experiment. According to the table, there is a small (below 1 • ) in-  crease in the standard deviation of the measured correction phase over time. We attribute this to mainly two effects: first, the adjustment of the excitation frequency sometimes cannot keep up with the temperature drift rate, and, second, there is a drift of the field homogeneity vs. time. Importantly, the improvement factor due to averaging is close to the theoretically predicted value of √ N scans . Figure 7 shows the single scan and time-averaged FID signals using the proposed DDS-based signal generator, an IF of 100 kHz, and a repetition time of T R = 1.5 s.
Next, the FID of a 21.2 nL pure ethanol sample was measured using the spectroscopy probe (see Fig. 8a). Figure 8b shows the real part of the corresponding Fourier spectrum. The position and amplitude of the three peaks in the spectrum correspond to the expected chemical shifts and numbers of hydrogen nuclei in the hydroxyl (OH), methylene (CH 2 ), the methyl (CH 3 ) groups. Considering the time-domain SNR of the ethanol sample, the calculated time-domain spin sensitivity is 3.2 × 10 16 spins Hz − 1 2 (Anders et al., 2009). Having confirmed the functionality of the proposed scheme for coherent excitation and detection, we proceeded by measuring transverse relaxation (T 2 ) and longitudinal relaxation (T 1 ) times of sunflower oil, as an example of a homogeneous sample, with conventional CPMG and IR-FID sequences. The T 2 time was extracted with the following parameters for the CPMG sequence: number of echoes NE = 800, echo time TE = 1 ms, and an echo duration of 0.6 ms. The T 1 time was extracted with the following parameters for the IR-FID sequence: a minimum delay of 3 ms, a maximum delay of 701 ms, and a number of steps of 38. Here, the phase information of each FID (or echo when using IR-echo sequence) can be used to distinguish the sign of those signals whose amplitudes are close to zero. Relying on a variable pulse delay between the first 180 • pulse and the first 90 • pulse, the IR sequence requires precise timing of said two pulses and a phase-coherent detection of the FID or the echo. Therefore, the IR experiments for T 1 extraction serve as an excellent benchmark application for the proposed DDS-based reference generator. Example data of the CPMG and the IR measurements are shown in Fig. 9. The corresponding relaxation times derived from single exponential fitting were T 2 = 89 ms and T 1 = 95.4 ms, respectively.
Having verified the functionality of the proposed reference signal generator, we also tested the performance of the proposed field-locking-based temperature compensation scheme in relaxometry measurements. Frequency shifts caused by temperature fluctuations not only reduce frequency-domain resolution (see Sect. 2.2) but also have a significant influence on the accuracy of relaxation time measurements. More specifically, if uncompensated, the fixed excitation frequency 86 Q. Yang et al.: A portable NMR platform with arbitrary phase control and temperature compensation  will gradually deviate from the Larmor frequency over time. In this case, the B 0 field does not completely disappear in the rotating frame, and the effective rotation axis is therefore tilted out of the xy-plane (Korzhnev et al., 2000). In addition, due to a less efficient off-resonance excitation with increasing offset frequencies caused by the frequency drift, the predefined duration of the π pulses might no longer be able to flip the magnetization by 180 • , resulting in distorted CPMG signals. Here, two types of distortion are commonly encountered. The first one is an oscillation of the first few points of the CPMG signal (see Fig. 10a, left), and the second is an incomplete decay of the echo signal (see Fig. 10a, right). It should be mentioned that the correct attenuation line (dashed line in the figure) was obtained from a measurement with the field-locking-based temperature compensation scheme enabled. Figure 10b shows a series of CPMG experiments for a continuous measurement of the transverse relaxation time (T 2 ) over a total experimental time of nearly 100 min without temperature control of the magnet. According to the figure, the Larmor frequency drifted over almost 6 kHz, but thanks to the frequency control loop, the T 2 time was still extracted with high accuracy. More specifically, the mean and standard deviation of all recorded T 2 values in Fig. 10b are 88.5 and 0.4 ms, respectively, corresponding to a normalized standard deviation of 0.45 %.
To demonstrate that the presented platform is also capable of measuring the relaxation times of heterogeneous samples that contain materials with different relaxation times, we have analyzed samples containing copper sulfate solutions with two different concentrations per sample with concentrations ranging from 5 to 75 mM. These samples were used to emulate bound and unbound water samples since their distinction is a current application of NMR relaxometry (Stapf, 2010;Wu et al., 2021). More specifically, we inserted the higher concentration sample into a 0.8 mm capillary, which was then inserted into a 1.3 mm capillary filled with a lower doped copper sulfate solution to construct a sample with two distinct relaxation times. Figure 11a shows an example time-domain CPMG signal of such a sample. From the time domain data, we have extracted the relaxation times using double exponential fitting and cross-checked these results with the inverse Laplace transform data (see Fig. 11b), achieving an excellent matching between the two methods. The extracted T 2 and T 1 values are summarized in Table 3. In these experiments, the CPMG sequence parameters were the following: number of echoes NE = 2500, echo time TE = 0.4 ms, and an echo duration of 0.2 ms. The IR sequence parameters were the following: a minimum delay of 1 ms, a maximum delay of 801 ms (5 mM), 401 ms (10 mM), 201 ms (25 mM), and 81 ms (≥ 50 mM), and a number of steps of 25.

Conclusion and discussion
In this paper, we have presented a CMOS-based NMR platform featuring arbitrary phase control and coherent detec-  tion in a non-zero IF receiver architecture as well as active automatic temperature compensation. The proposed platform is centered around a custom-designed NMR-on-a-chip transceiver. Thanks to the on-chip broadband PLL, our system can operate between 5 and 770 MHz. As one of the main innovations, the presented system features a DDS-based reference signal generator for the on-chip PLL that enables precisely timed excitation pulses with an adjustable phase andat the same time -phase-coherent detection at a non-zero IF.
The proposed system achieves a phase stability well below 1 • in consecutive pulse acquire experiments, which is on par with commercial equipment. NMR spectroscopy and relaxometry experiments inside 1.45 and 0.36 T permanent magnets verified the versatility and excellent performance of the presented platform. Moreover, the proposed NMR platform includes an automatic control loop that effectively counteracts frequency changes due to thermal drifts of the utilized permanent magnet. The efficiency of the frequency control loop has been verified by T 2 measurements over 100 min, producing a normalized standard deviation in the measured T 2 values of 0.45 % in the presence of significant temperature fluctuations. Here, we would like to point out that, despite its overall good performance and usefulness for stabilizing the average B 0 field, the presented field-locking-based temperature compensation scheme cannot compensate for changes in the field homogeneity over time, which can lead to reduced frequency resolution in the averaged signal. Moreover, the proposed approach relies on sufficient SNR in a singleshot experiment to extract the current Larmor frequency with enough precision. Finally, the update rate for the estimation of the Larmor frequency is limited by the experiment's repetition rate, potentially leading to limitations in the presence of relatively fast temperature fluctuations. This being said, compared to prior state of the art, the architecture of the presented scheme is less complex, and it can be easily implemented in the digital domain together with the proposed DDS-based frequency synthesizer, rendering it a very suitable solution for CMOS-based NMR platforms. The total peak power of all custom-designed electronics is 2.9 W, which allows for battery operation for several hours from a modern power bank. In the future, we will extend the presented NMR platform by the possibility of performing Overhauser dynamic nuclear polarization (ODNP) using our recent EPR-on-a-chip transceivers (Chu et al., 2018;Hassan et al., 2021) for enhanced sensitivity in order to open up new application scenarios for portable NMR systems.