Patent Publication Number: US-2022231717-A1

Title: Apparatus and methods for dc-offset estimation

Description:
BACKGROUND OF THE INVENTION 
     This invention relates to radio apparatus and methods for estimating a DC offset component in a down-mixed radio-frequency signal. 
     Radio receivers typically use a heterodyne architecture or a direct-conversion architecture. Heterodyne receivers mix a received radio signal with a locally-generated periodic signal that is offset from the carrier frequency of the received signal by an intermediate-frequency offset to generate a down-mixed signal centred on the intermediate frequency (IF). The mixing may be performed in the analog or digital domain. Direct-conversion receivers, also known as zero-IF receivers, instead mix a received signal with a local-oscillator signal that is substantially equal to the carrier frequency so that the received signal is shifted directly to baseband. 
     A challenge with direct conversion receivers is that the local oscillator (LO) signal commonly leaks into the radio-frequency port of the mixer input, where it self-mixes to produce a direct-current (DC) offset in the mixer output. The signal can also leak through the receiver&#39;s low noise amplifier (LNA) where it can be amplified. Additionally, the LO may leak to the environment and reflect back to the antenna, creating a time-varying offset. A DC offset may also be present due to internal offsets in the receiver circuitry of a device, that may exhibit variation due to process, voltage and/or temperature (PVT). A strong incoming interfering signal may also couple with the LO port of the mixer. These factors may all contribute to a DC offset that may be of a substantially higher amplitude than the received signal, which can make it difficult to process the baseband signal reliably. 
     DC offsets may also be exhibited on the radio transmitter. These can be caused by DC offsets within the baseband path of the radio, or due to LO leakage to the output of the mixer or later stages. The DC offset can therefore vary from device to device, and vary in time, on both sides of a wireless link. 
     Known zero-IF receivers seek to compensate for DC offset using techniques such as high-pass filtering or applying a correction signal in the analog domain. Analog solutions includes applying an offset cancellation signal at one or more points in the receive chain. However, this is complex and may require regular calibration, e.g., to cope with temperature changes. 
     In some situations it can be desirable to compensate for a DC offset when receiving a continuous-wave (CW) signal (e.g., a pure, unmodulated sine-wave carrier). One exemplary situation is when performing phase-based ranging to measure the distance between a radio transmitter and a radio receiver. In such cases, approaches that rely on receiving coded information, such as training symbols, or that require information to be encoded across a channel width, are not appropriate. When using a zero-IF receiver to receive a continuous-wave signal of the same frequency as the LO, the DC offset and the down-mixed received signal will be indistinguishable, as both are simply constant outputs. Using a high-pass filter is not possible as this would remove the desired signal. 
     A naïve approach to addressing this problem could be to measure the DC offset during a period of radio silence—i.e. when there is no incoming radio signal at the carrier frequency—and then to use the same measured DC offset value to compensate for DC offset in a later-received continuous-wave signal. However, this approach is not robust. First, it can be difficult to ensure that there is no incoming radio signal at the carrier frequency when calibrating the DC offset—for instance, even when the power amplifier of the associated radio transmitter is disabled, the transmitter device may still generate a periodic signal that leaks through its antenna and is received by the radio receiver. Secondly, the approach is not reliable in the presence of interference, or if the transmitter device changes the transmission power between the calibration and reception phases, or if the receiver device changes its amplification between the calibration and reception phases (e.g. by the action of an automatic gain control). 
     The present invention seeks to provide a more robust approach to compensating for DC offset when receiving a continuous-wave radio-frequency signal. 
     SUMMARY OF THE INVENTION 
     From a first aspect, the invention provides a radio-frequency reception method comprising:
         receiving a continuous-wave radio-frequency signal having a first frequency;   generating a periodic signal at a second frequency which differs from the first frequency by a frequency offset;   mixing the received radio-frequency signal with the periodic signal to generate a down-mixed signal;   processing the down-mixed signal to generate frequency-offset data representative of an estimate of the frequency offset; and   using the frequency-offset data to generate DC-offset data representative of an estimate of a DC offset component of the down-mixed signal.       

     From a second aspect, the invention provides a radio receiver apparatus comprising:
         an electrical input for receiving a continuous-wave radio-frequency signal having a first frequency;   a local oscillator for generating a periodic signal at a second frequency which differs from the first frequency by a frequency offset;   a mixer for mixing the received continuous-wave radio-frequency signal with the periodic signal to generate a down-mixed signal; and   a processor or other circuitry configured to generate frequency-offset data from the down-mixed signal, wherein the frequency-offset data is representative of an estimate of the frequency offset, and configured to use the frequency-offset data to generate DC-offset data representative of an estimate of a DC offset component of the down-mixed signal.       

     From a third aspect, the invention provides a radio system comprising a radio transmitter apparatus and a radio receiver apparatus, wherein the radio transmitter apparatus is configured to transmit a continuous-wave radio-frequency signal having a first frequency, and wherein the radio receiver apparatus comprises:
         an antenna for receiving the continuous-wave radio-frequency signal;   a local oscillator for generating a periodic signal at a second frequency which differs from the first frequency by a frequency offset;   a mixer for mixing the received continuous-wave radio-frequency signal with the periodic signal to generate a down-mixed signal; and   a processor or other circuitry configured to generate frequency-offset data from the down-mixed signal, wherein the frequency-offset data is representative of an estimate of the frequency offset, and configured to use the frequency-offset data to generate DC-offset data representative of an estimate of a DC offset component of the down-mixed signal.       

     Thus it will be seen that, in accordance with the invention, instead of using a zero-IF receiver to receive the continuous-wave signal, the continuous-wave signal is mixed with a local-oscillator signal that is offset by a frequency offset. 
     The frequency offset preferably comprises a predetermined intermediate-frequency component, which may be engineered by design. It may also comprise an error component—e.g., due to imperfect matching of the transmitter and receiver oscillator frequencies, or due to Doppler shift caused by relative movement of the transmitter and receiver. 
     Once the frequency offset has been estimated, this estimate is then used to estimate a DC offset in the mixed signal. This contrasts with the naïve approach described above, in which a DC offset is measured when no radio signal has been received. 
     The estimated DC offset may be used to adjust a received radio signal, or to modify sample data representing a received radio signal—e.g. to compensate for a DC offset component in a down-mixed received signal. In a preferred set of embodiments, this is the same down-mixed continuous-wave radio signal, but in other embodiments it may be a later-received down-mixed radio signal (which may be another continuous-wave signal, or which may carry modulated information). 
     Estimating the DC offset in this way allows a receiver to reduce or remove the DC offset in a continuous-wave signal, and therefore to sample a continuous-wave signal accurately even when heterodyning the received signal with a very small intermediate frequency (e.g. where the frequency offset is of the order of 10 kHz), where DC offset would typically make this very difficult. The radio receiver may be configured to subtract the DC offset component from the received down-mixed signal. 
     The use of a very small frequency offset may be advantageous in certain situations, such as when performing phase-based ranging. In particular, if the frequency offset is sufficiently small, the inventors have realised that it can be possible to perform phase-based ranging with acceptable accuracy without having to synchronise the transmitter and the receiver apparatuses. 
     Thus, the frequency offset is preferably less than 100 kHz, and may be less than 50 kHz or 20 kHz. However, the frequency offset is preferably greater than 1 kHz or 5 kHz. In some embodiments, it is in the range 5 kHz to 100 kHz—e.g., around 10 kHz. 
     By measuring the DC offset simultaneously with receiving the continuous-wave signal (rather than measuring it separately in a period of radio silence) the challenges of ensuring radio silence and dealing with interference, mentioned above, can be avoided. Moreover, the reception process can be performed quicker, which may be desirable in and of itself. A fast estimation of DC offset may also reduce the risks of errors arising due to time-varying effects, such as through the action of an automatic gain control (AGC) in the receiver, or due to the transmitter changing its transmission power, or because of changing channel conditions. 
     The continuous-wave radio-frequency (RF) signal may be a sine wave signal. The radio-frequency signal is preferably a radio signal—e.g., received through a radio antenna. However, in some embodiments the RF signal could be received over a wired link, such as a coaxial cable. References herein to a “radio signal”, “radio receiver”, “radio transmitter”, etc. should be understood as encompassing communications purely over wired links. 
     The radio-frequency signal may be of any duration. However, the applicant has recognised that, at least in some embodiments, estimating the DC offset based on a frequency-offset estimate can allow the DC offset to be estimated, with acceptable accuracy, within one full cycle period of the down-mixed signal, or less. Thus, in some embodiments, at most one cycle period of the down-mixed signal is processed to generate the frequency-offset data and/or the DC-offset data—e.g., at most half a cycle, or at most a quarter cycle, of the down-mixed signal. 
     As already noted, the frequency offset may comprise a predetermined frequency offset component (i.e., an offset component that is intentional) and may additionally comprise an error offset component. The transmitter and receiver apparatuses may comprise respective crystal oscillators that have respective nominal oscillator frequencies (which may be the same). The transmitter and receiver apparatuses may comprise respective local oscillator circuitry configured to derive the first and second frequencies from the crystal oscillators (e.g., using frequency-divider, frequency-multiplier and/or phase-locked-loop circuitry) such that there is a predetermined, non-zero frequency offset when the crystal oscillators are operating at their nominal oscillator frequencies. This predetermined frequency offset may be less than 100 kHz, 50 kHz or 20 kHz. In some embodiments, it is in the range 5 kHz to 20 kHz—e.g., around 10 kHz. 
     The predetermined frequency offset component may be selected to be larger than an expected error offset component, so as to ensure that there will always be a non-zero offset. For example, an error offset may be simulated or measured or calculated as being less than +/−5 kHz. The intentional IF offset may then be set as low as 10 kHz in this scenario. Increasing the predetermined frequency offset can result in higher accuracy, but places a greater requirement on the linearity of the tuning of the local oscillator frequency. 
     The radio transmitter and/or receiver apparatus may be configured to determine a distance between the transmitter apparatus and the receiver apparatus (e.g. to generate data representative of the distance). The distance may be estimated from the down-mixed signal using the DC-offset data—e.g., by processing the down-mixed signal after compensating the down-mixed signal for the estimated DC offset component. 
     The receiver apparatus may estimate a phase difference between the received continuous-wave radio-frequency signal and the generated periodic signal. It may generate phase-difference data representative of the phase difference. The estimated phase difference may be used when estimating a distance between the transmitter apparatus and the receiver apparatus. 
     Advantageously, a common portion of the down-mixed signal (e.g. a common set of complex sample values) may be used both for estimating the DC offset and for determining the distance between the transmitter and receiver apparatuses. The phase difference between the received continuous-wave radio-frequency signal and the generated periodic signal may be estimated from this common portion. In this way, the effects of any time-dependent interference are minimised. This approach also allows the phase difference and/or distance to be estimated more rapidly. 
     The radio receiver apparatus may be further configured to transmit a second continuous-wave radio-frequency signal having the second frequency. It may generate this second signal by amplifying an output of its local oscillator. The radio transmitter apparatus may comprise:
         an antenna for receiving the second continuous-wave radio-frequency signal;   a local oscillator for generating a second periodic signal at the first frequency;   a mixer for mixing the received second continuous-wave radio-frequency signal with the second periodic signal to generate a second down-mixed signal; and   a processor or other circuitry configured to generate second frequency-offset data from the second down-mixed signal, wherein the second frequency-offset data is representative of an estimate of the frequency offset, and configured to use the second frequency-offset data to generate second DC-offset data representative of an estimate of a DC offset component of the second down-mixed signal.       

     The radio transmitter apparatus may estimate a second phase difference, between the received second continuous-wave radio-frequency signal and the generated second periodic signal. The radio receiver may be configured to transmit data representative of the first phase difference to the radio transmitter apparatus, or may be configured to receive data representative of the second phase difference from the radio transmitter apparatus. One or both of the radio transmitter and the radio receiver may comprise a processor or other circuitry configured to calculate an estimate of the distance from the first and second phase differences. 
     In order to measure distances greater than one wavelength, the system may be further configured to determine a third phase difference for a continuous-wave radio-frequency signal transmitted from the transmitter apparatus at a third frequency, and a fourth phase difference for a continuous-wave radio-frequency signal transmitted from the receiver apparatus at a fourth frequency, wherein the third and fourth frequencies are different from the first and second frequencies. The third and fourth frequencies may be separated by a second frequency offset, which may be the same as the first frequency offset or within 10% or 50% of the first frequency offset. The first and third frequencies may be respective carrier frequencies of an orthogonal-frequency-division-multiplexing (OFDM) communication protocol that the radio system is configured to use for communicating data between the radio transmitter apparatus and the radio receiver apparatus. The system may determine the distance by calculating a gradient, over frequency, of the sum of the first and second phase differences, and the sum of the third and fourth phase differences (and optionally the sum of further pairs of phase differences). The second frequency offset, and respective DC offsets, may be estimated by the same methods as used with the first and second signals. 
     The receiver preferably comprises an analog-to-digital converter (ADC). The down-mixed signal may comprise a sequence of sample values. The mixing may be performed digitally (e.g., direct RF conversion), or on analog signals. 
     Generating the frequency-offset data may comprise generating difference data representative of a difference signal comprising a sequence of differences between pairs of sample values of the down-mixed samples, wherein the sample values of each pair are separated by a common distance. The frequency offset may be estimated from the difference signal using a Kay&#39;s frequency estimator, or any other appropriate technique. 
     The DC-offset data may represent a maximum-likelihood estimate of the DC offset component of the down-mixed signal. The DC offset may be estimated by evaluating a DC-offset estimation function of the down-mixed signal and the estimated frequency offset. Estimating the DC offset may comprise evaluating a complex exponential function of the estimated frequency offset. The complex exponential function may be a natural exponential function. The exponent may be entirely imaginary and may be a linear function of time. The complex exponential function may be a term within the DC-offset estimation function. 
     While, in one set of embodiments, the DC offset estimation is used to reduce or remove DC offset from the same portion of the received signal from which the DC offset estimation is obtained, this is not essential, and, in another set of embodiments, the DC offset data may be used to reduce or remove DC offset from a different portion of the continuous-wave radio-frequency signal, or from a different radio-frequency signal. In some embodiments, the receiver apparatus may receive a radio signal encoding data, and may use the DC-offset data to compensate for a DC offset in the down-mixed data signal. 
     The continuous-wave radio-frequency (RF) signal may be a portion of a longer RF signal—e.g., a preamble to a data packet. The longer RF signal may contain data modulated on a carrier having the first frequency. 
     The radio receiver apparatus may support a version of the Bluetooth™ Low Energy protocol. The first frequency may be in the 2.4 GHz band. 
     The radio receiver apparatus may comprise or may be an integrated-circuit radio receiver—e.g., a silicon chip. It may comprise, or be connectable to, one or more off-chip components, such as a power supply, antenna, crystal, discrete capacitors, discrete resistors, etc. The radio receiver apparatus may also comprise a radio transmitter. 
     The radio receiver apparatus and radio transmitter apparatus may each comprise one or more processors, DSPs, logic gates, amplifiers, filters, digital components, analog components, non-volatile memories (e.g., for storing software instructions), volatile memories, memory buses, peripherals, inputs, outputs, and any other relevant electronic components or features. 
     In particular, a processor configured to generate the frequency-offset data and the DC-offset data may be so configured by software instructions stored in a memory of the apparatus. The processor may comprise a DSP and/or a general purpose processor, such an Arm™ Cortex-M™ processor. Generating the frequency-offset data and the DC-offset data may be performed wholly in software, or wholly by hardwired circuitry (e.g., comprising digital logic gates), or by a combination or software and hardware. 
     The radio receiver apparatus may be any apparatus or device, and may have other functions in addition to receiving and processing radio-frequency signals. It may, for instance, be a vehicle, or a cell phone, or wireless sensor device. 
     Features of any aspect or embodiment described herein may, wherever appropriate, be applied to any other aspect or embodiment described herein. Where reference is made to different embodiments or sets of embodiments, it should be understood that these are not necessarily distinct but may overlap. 
    
    
     
       BRIEF DESCRIPTION OF THE DRAWINGS 
       Certain preferred embodiments of the invention will now be described, by way of example only, with reference to the accompanying drawings, in which: 
         FIG. 1  is a schematic diagram of a radio communication system embodying the invention; 
         FIG. 2  is a schematic diagram of a radio receiver embodying the invention; 
         FIG. 3  is a flow chart of a DC offset estimation process embodying the invention; and 
         FIG. 4  is an I-Q phase diagram showing outputs from a simulation of the DC offset estimation process. 
     
    
    
     DETAILED DESCRIPTION 
       FIG. 1  shows a first radio transceiver device  1  and a second radio transceiver device  2 . The devices  1 ,  2  could be any radio-equipped devices, such as smartphones, wireless sensors, household appliances, land vehicles, satellites, etc. In one set of embodiments, the devices  1 ,  2  are consumer electronics products, and can communicate with each other over a Bluetooth™ Low Energy communication link. 
     The devices  1 ,  2  are separated by a distance, d. This distance could be of the order of centimetres, metres, kilometres, tens of kilometres, hundreds of kilometres or more. 
     The devices  1 ,  2  are configured to measure the distance d using multicarrier phase-based ranging. Note that phase-based ranging is quite different from radar ranging, in which a radar device receives reflections of radio signals off a target. In phase-based ranging, radio waves are transmitted from a radio transmitter device and are received by a radio receiver device that is located away from the radio transmitter device. 
     The devices  1 ,  2  are not synchronized, but perform multicarrier phase-based ranging to estimate d. An initiator—e.g., the first device  1 —first sends a continuous-wave (CW) radio signal that is an amplified version of a sine wave, of frequency f i,LO , generated by its local oscillator (LO). This signal is then received by a responder—e.g., the second device  2 —that has its LO set to a similar frequency, f r,LO , (as explained in more detail below). The responder  2  measures a first phase difference between its LO and the incoming signal. 
     The initiator  1  and responder  2  then switch roles, and the responder  2  transmits a CW signal which is an amplified version of its local oscillator (LO)—i.e. a sine wave of frequency f r,LO . This is then received by the initiator  1 , which measures a second phase difference between the initiator&#39;s LO, set to the frequency f i,LO , and the incoming signal. The LOs of both devices  1 ,  2  are kept constant during the two phases of the procedure. 
     Assuming no multipath interference, noise or other impairments, the sum ψ ir  of the two phase differences is related to the distance, d, between the devices  1 ,  2  by 
     
       
         
           
             
               
                 
                   
                     ψ 
                     ir 
                   
                   ≈ 
                   
                     
                       
                         2 
                         ⁢ 
                         
                           π 
                           ⁡ 
                           
                             ( 
                             
                               
                                 f 
                                 
                                   i 
                                   , 
                                   LO 
                                 
                               
                               + 
                               
                                 f 
                                 
                                   r 
                                   , 
                                   LO 
                                 
                               
                             
                             ) 
                           
                         
                         ⁢ 
                         d 
                       
                       c 
                     
                     - 
                     
                       2 
                       ⁢ 
                       πΔ 
                       ⁢ 
                       
                           
                       
                       ⁢ 
                       f 
                       ⁢ 
                       
                           
                       
                       ⁢ 
                       T 
                     
                     + 
                     C 
                   
                 
               
               
                 
                   ( 
                   1 
                   ) 
                 
               
             
           
         
       
     
     where f i,LO  and f r,LO  are the LO frequencies of the initiator  1  and responder  2  respectively, T is the time between phase measurements, Δf is the offset between the two LO frequencies, and C is a constant. 
     The frequency offset Δf contains two components: a first component, f IF , is an intentional, predetermined offset (i.e. an intermediate mixing frequency), while a second component, f errOr , is an unknown offset due to oscillator inaccuracies between the two devices  1 ,  2 . I.e. 
     
       
         
           
             
               Δ 
               ⁢ 
               
                   
               
               ⁢ 
               f 
             
             = 
             
               
                 f 
                 IF 
               
               + 
               
                 
                   f 
                   error 
                 
                 . 
               
             
           
         
       
     
     The two LO frequencies are thus related by 
     
       
         
           
             
               f 
               
                 r 
                 , 
                 LO 
               
             
             = 
             
               
                 
                   f 
                   
                     i 
                     , 
                     LO 
                   
                 
                 - 
                 
                   Δ 
                   ⁢ 
                   
                       
                   
                   ⁢ 
                   f 
                 
               
               = 
               
                 
                   f 
                   
                     i 
                     , 
                     LO 
                   
                 
                 - 
                 
                   
                     ( 
                     
                       
                         f 
                         IF 
                       
                       + 
                       
                         f 
                         error 
                       
                     
                     ) 
                   
                   . 
                 
               
             
           
         
       
     
     By taking phase measurements over at least two different f i,LO  frequencies (e.g., over a set of two or more Bluetooth™ Low Energy carrier frequencies), and calculating the gradient of ψ ir  as a function of f i,LO , the distance, d, can be estimated. 
     The responder  2  may transmit its phase measurements to the initiator  1 , e.g., as data in one or more radio packets, and the initiator  1  may use these measurements to estimate the distance, d. Alternatively, the phase measurements could be sent to the responder  2 , or to a third device, such as a network server, for performing the distance estimation. 
     Note that, if Δf=0, the time dependence would disappear. Correcting precisely for the cases where f IF ≠0 and f error ≠0 requires knowledge of T. This may be difficult to achieve accurately in the absence of modulated data to provide timing information, because the devices  1 ,  2  are not synchronous. Therefore it is desirable to minimize Lf so that the time dependence is sufficiently small that it can be disregarded while preserving a desired level of accuracy in the distance estimation. 
     However, the negative impact of DC offset on the ability to measure the phase increases as Δf reduces. If Δf=0, the DC offset can completely mask the received signal. 
     The present embodiments address this by setting an intentional non-zero frequency offset, f IF , between the nominal frequencies of the receiver and transmitter local oscillators, and by seeking to minimise f error , so as to provide a small, but non-zero, frequency offset Δf. This frequency offset may be of the order of 10 kHz—e.g., around kHz, 10 kHz, 20 kHz or so. The devices  1 , 2  between them estimate the actual frequency offset, Δf, including an error, and use this to estimate the DC offset instantaneously—i.e. while receiving the constant-wave signal—rather than requiring a separate DC-offset calibration phase. This approach therefore doesn&#39;t rely on the accuracy of an earlier-measured estimate of the DC offset measurement, and may therefore provide more accurate distance estimates. 
       FIG. 2  provides more detail of some of the internal components of the initiator device  1  in an exemplary implementation. The responder device  2  may be similar. 
     The device  1  contains, within a housing  3 , a radio microcontroller chip  4  that supports Bluetooth™ Low Energy communications. It may additionally or instead support other radio protocols such as IEEE 802.11, 3GPP LTE Cat-M1, 3GPP LTE NB-IoT, IEEE 802.15.4, Zigbee™, Thread™, ANT™, etc. 
     The radio chip  4  contains a low-noise amplifier (LNA)  5 , a local oscillator (LO)  6 , a quadrature mixer  7  for mixing an incoming signal with a periodic LO signal, receive-path filtering  8 , an analog-to-digital converter (ADC)  9 , radio memory  10  and a radio processor  11 . On a transmit path, it contains a power amplifier (PA)  12 , which can also receive the periodic LO signal from the local oscillator  6 . The radio memory  10  may include volatile memory (e.g., RAM) and non-volatile memory (e.g., flash). The radio processor  11  may be a general purpose processor such as an Arm™ Cortex-M™ processor; it may also include one or more DSPs. 
     The device  1  may also contain a further system processor  13 , system memory  14 , peripherals  15  such as a temperature sensor or I/O modules, and a battery  16 . A radio antenna  17  may be within or external to the housing  3  and is connected to the radio chip  4  by appropriate components. Of course, it will be appreciated that the device  1  may contain other elements, such as buses, crystals, digital logic, analog circuitry, discrete active components, discrete passive components, further processors, user interface components, etc. which are not shown here for the sake of simplicity. Further details of the transmit path, e.g. as used when transmitting encoded data, are also omitted here for simplicity. The device  1  may be a component of a larger device, such as a car, or it may be a standalone device. 
     In use, software stored in the radio memory  10  is executed by the radio processor  11  to perform a distance estimation process as disclosed herein. The processor  11  is able to set the frequency of the local oscillator  6  to different frequencies as required. The second device  2  contains complementary software for carrying out its part of the process. In other embodiments, some or all of the process may be carried out by hard-wired logic in the radio devices  1 ,  2 . The resulting distance estimate, d, may be output to the system processor  13  for further use, or may be stored for use by the radio chip  4  itself. 
       FIG. 3  is a flowchart showing the main steps of the distance estimation process in one embodiment. 
     In a first phase, the initiator device  1  sets its local oscillator  6  to the frequency f i,LO1  and transmits  30  a sinusoidal continuous-wave radio signal of frequency f i,LO1 . The responder device  2  mixes  31  the incoming signal with a signal from its local oscillator having a frequency f r,LO1 . The devices  1 ,  2  may be configured for an intended frequency offset Δf=f i,LO1 −f r,LO1  of around 10 kHz. The responder device  2  estimates  32  the actual frequency offset, Δf, which may include an unknown error term, as explained in more detail below. It then estimates  33  a DC offset, as explained in more detail below. It then compensates  34  the sampled received signal to remove the estimated DC offset. Next, the responder device  2  measures  35  the phase difference ψ r,LO1  between the compensated received signal and the locally-generated signal. 
     In a second phase, the respond device  2  keeps its local oscillator at f r,LO1  and transmits  36  a sinusoidal continuous-wave radio signal of frequency f r,LO1 . The initiator device  1  mixes  37  the incoming signal with a signal from its local oscillator  6  which remains set at f i,LO1 . The initiator device  1  estimates  38  the frequency offset Δf=f i,LO1 −f r,LO1  as explained in more detail below. It then estimates  39  a DC offset, as explained in more detail below. It then compensates  40  the sampled received signal to remove the estimated DC offset. Next, the initiator device  1  measures  41  the phase difference ψ i,LO1  between the compensated received signal and the locally-generated signal. 
     These steps  30  to  41  are then repeated, in steps  30 ′ to  41 ′. Both phases are the same, except that a different pair of local oscillator values, f i,LO2 , f r,LO2 , is used. The same intended frequency offset, Δf, may be used. 
     Although only two instances are shown in  FIG. 3 , the steps  30  to  41  may be performed any number of times, n, using different f i,LO  values—e.g. n=2, 3, 5, 10 or more—depending on requirements. 
     Once sufficient phase differences have been collected, the responder device  2  transmits  42  all the phase differences it has measured, ψ r,LO1 , ψ r,LO2 , . . . , ψ r,LOn , to the initiator device  1 , as data encoded in a data packet. 
     The initiator device  1  then sums  43  the two ψ i,Lo , ψ r,LO  values for each frequency pair to get ψ r,LO1 , ψ r,LO2 , . . . , ψ i,r,LOn . It then estimates  44  the separation distance, d, from the gradient of ψ i,r  over frequency, according to equation (1) above. 
     Of course, many variations are possible. For example, the responder device  2  could transmit its frequency offset estimates to the initiator device  1 , instead of the initiator device  1  calculating these independently (although, if there is a significant time delay between the sine wave transmissions  30 ,  31 , it may be desirable for both devices  1 ,  2  to perform independent estimations). 
     The continuous-wave signals may be transmitted as elements within respective data packets, or they may be standalone transmissions. 
     Exemplary methods for estimating the frequency offset and the DC offset, according to some embodiments, will now be described. 
     System Model 
     Assume that a continuous wave is transmitted by the initiator  1  for a period of Tμs. Define c as the DC offset. The initial phase and amplitude of the incoming signal as seen at the output of an ADC of the responder  2  is a=b exp(iψ) where b&gt;0 and ψ∈[0,2π). The frequency offset is Δf. N samples are collected at a sample rate f s  with sampling period T s =1/f s . 
     The sampled down-mixed signal at the output of the ADC, y, is given by 
     
       
         
           
             y 
             = 
             
               
                 c 
                 ⁢ 
                 
                     
                 
                 ⁢ 
                 1 
               
               + 
               an 
               + 
               v 
             
           
         
       
     
     where 1 is the N×1 vector containing only 1&#39;s, v is an N×1 vector of random complex noise, and n is the frequency rotation vector with elements n k =exp(i2πΔfT s k). 
     Algorithm 
     The algorithm proceeds by first obtaining an estimate of the frequency offset, and then solving for the DC offset. 
     Frequency Offset Estimation A frequency estimate may be obtained in the following fashion. 
     First, a difference signal, z, is generated as 
     
       
         
           
             
               z 
               k 
             
             = 
             
               
                 y 
                 k 
               
               - 
               
                 y 
                 
                   k 
                   - 
                   
                     D 
                     1 
                   
                 
               
             
           
         
       
     
     where D 1  is a positive integer. 
     This gives 
     
       
         
           
             
               
                 
                   
                     z 
                     k 
                   
                   = 
                   
                     
                       an 
                       k 
                     
                     - 
                     
                       an 
                       
                         k 
                         - 
                         
                           D 
                           ⁢ 
                           
                               
                           
                           ⁢ 
                           1 
                         
                       
                     
                     + 
                     
                       v 
                       k 
                     
                     - 
                     
                       v 
                       
                         k 
                         - 
                         
                             
                         
                         ⁢ 
                         
                           D 
                           ⁢ 
                           
                               
                           
                           ⁢ 
                           1 
                         
                       
                     
                   
                 
               
             
             
               
                 
                   = 
                   
                     
                       a 
                       ⁢ 
                       
                           
                       
                       ⁢ 
                       
                         
                           exp 
                           ⁡ 
                           
                             ( 
                             
                               i 
                               ⁢ 
                               
                                   
                               
                               ⁢ 
                               2 
                               ⁢ 
                               πΔ 
                               ⁢ 
                               
                                   
                               
                               ⁢ 
                               
                                 fT 
                                 s 
                               
                               ⁢ 
                               k 
                             
                             ) 
                           
                         
                         ⁡ 
                         
                           [ 
                           
                             1 
                             - 
                             
                               exp 
                               ⁡ 
                               
                                 ( 
                                 
                                   
                                     - 
                                     i 
                                   
                                   ⁢ 
                                   
                                       
                                   
                                   ⁢ 
                                   2 
                                   ⁢ 
                                   πΔ 
                                   ⁢ 
                                   
                                       
                                   
                                   ⁢ 
                                   
                                     fT 
                                     s 
                                   
                                   ⁢ 
                                   
                                     D 
                                     1 
                                   
                                 
                                 ) 
                               
                             
                           
                           ] 
                         
                       
                     
                     + 
                     
                       v 
                       k 
                     
                     - 
                     
                       v 
                       
                         k 
                         - 
                         
                           D 
                           ⁢ 
                           
                               
                           
                           ⁢ 
                           1 
                         
                       
                     
                   
                 
               
             
           
         
       
     
     Note that the DC offset from the signal is removed in the difference signal, z, but the frequency offset is still present. 
     The frequency of this difference signal is measured by an appropriate method—for example, with a D-spaced Kay&#39;s frequency estimator. However, other options are possible, such as methods disclosed in “Frequency estimation by phase unwrapping”, R. G. McKilliam, B. G. Quinn, B. Moran et al., IEEE Transactions on Signal Processing, vol. 58, no. 6, pp. 2953-2963, 2010. 
     Using a spacing of D 2 , a series, w, is calculated as 
     
       
         
           
             
               w 
               k 
             
             = 
             
               
                 z 
                 k 
               
               ⁢ 
               
                 z 
                 
                   k 
                   - 
                   
                     D 
                     2 
                   
                 
                 * 
               
             
           
         
       
     
     Disregarding the noise term, W k  is equal to 
     
       
         
           
             
               
                 
                   
                     w 
                     k 
                   
                   ⁢ 
                     
                   = 
                 
               
               
                 
                     
                   ⁢ 
                   
                     
                       
                          
                         a 
                          
                       
                       2 
                     
                     ⁢ 
                     
                         
                     
                     ⁢ 
                     
                       
                         exp 
                         ⁡ 
                         
                           ( 
                           
                             i 
                             ⁢ 
                             
                                 
                             
                             ⁢ 
                             2 
                             ⁢ 
                             πΔ 
                             ⁢ 
                             
                                 
                             
                             ⁢ 
                             
                               fT 
                               s 
                             
                             ⁢ 
                             k 
                           
                           ) 
                         
                       
                       ⁡ 
                       
                         [ 
                         
                           1 
                           - 
                           
                             exp 
                             ⁡ 
                             
                               ( 
                               
                                 
                                   - 
                                   i 
                                 
                                 ⁢ 
                                 
                                     
                                 
                                 ⁢ 
                                 2 
                                 ⁢ 
                                 πΔ 
                                 ⁢ 
                                 
                                     
                                 
                                 ⁢ 
                                 
                                   fT 
                                   s 
                                 
                                 ⁢ 
                                 
                                   D 
                                   1 
                                 
                               
                               ) 
                             
                           
                         
                         ] 
                       
                     
                     ⁢ 
                     
                         
                     
                     ⁢ 
                     
                       exp 
                       ⁡ 
                       
                         ( 
                         
                           
                             - 
                             i 
                           
                           ⁢ 
                           
                               
                           
                           ⁢ 
                           2 
                           ⁢ 
                           πΔ 
                           ⁢ 
                           
                               
                           
                           ⁢ 
                           
                             
                               fT 
                               s 
                             
                             ⁡ 
                             
                               ( 
                               
                                 k 
                                 - 
                                 
                                   D 
                                   2 
                                 
                               
                               ) 
                             
                           
                         
                         ) 
                       
                     
                   
                 
               
             
             
               
                   
               
               
                 
                     
                   ⁢ 
                   
                     
                       [ 
                       
                         1 
                         - 
                         
                           exp 
                           ⁡ 
                           
                             ( 
                             
                               
                                 - 
                                 i 
                               
                               ⁢ 
                               
                                   
                               
                               ⁢ 
                               2 
                               ⁢ 
                               πΔ 
                               ⁢ 
                               
                                   
                               
                               ⁢ 
                               
                                 fT 
                                 s 
                               
                               ⁢ 
                               
                                 D 
                                 1 
                               
                             
                             ) 
                           
                         
                       
                       ] 
                     
                     * 
                   
                 
               
             
             
               
                 
                     
                   = 
                 
               
               
                 
                     
                   ⁢ 
                   
                     
                       
                          
                         a 
                          
                       
                       2 
                     
                     ⁢ 
                     
                        
                       
                         1 
                         - 
                         
                           exp 
                           ⁡ 
                           
                             ( 
                             
                               
                                 - 
                                 i 
                               
                               ⁢ 
                               
                                   
                               
                               ⁢ 
                               2 
                               ⁢ 
                               πΔ 
                               ⁢ 
                               
                                   
                               
                               ⁢ 
                               
                                 fT 
                                 s 
                               
                               ⁢ 
                               
                                 D 
                                 1 
                               
                             
                             ) 
                           
                         
                       
                        
                     
                     ⁢ 
                     
                         
                     
                     ⁢ 
                     
                       exp 
                       ⁡ 
                       
                         ( 
                         
                           i 
                           ⁢ 
                           
                               
                           
                           ⁢ 
                           2 
                           ⁢ 
                           πΔ 
                           ⁢ 
                           
                               
                           
                           ⁢ 
                           
                             fT 
                             s 
                           
                           ⁢ 
                           k 
                         
                         ) 
                       
                     
                     ⁢ 
                     
                         
                     
                     ⁢ 
                     
                       exp 
                       ⁡ 
                       
                         ( 
                         
                           
                             - 
                             i 
                           
                           ⁢ 
                           
                               
                           
                           ⁢ 
                           2 
                           ⁢ 
                           πΔ 
                           ⁢ 
                           
                               
                           
                           ⁢ 
                           
                             
                               fT 
                               s 
                             
                             ⁡ 
                             
                               ( 
                               
                                 k 
                                 - 
                                 
                                   D 
                                   2 
                                 
                               
                               ) 
                             
                           
                         
                         ) 
                       
                     
                   
                 
               
             
             
               
                 
                     
                   = 
                 
               
               
                 
                     
                   ⁢ 
                   
                     b 
                     ⁢ 
                     
                         
                     
                     ⁢ 
                     
                       exp 
                       ⁡ 
                       
                         ( 
                         
                           i 
                           ⁢ 
                           
                               
                           
                           ⁢ 
                           2 
                           ⁢ 
                           πΔ 
                           ⁢ 
                           
                               
                           
                           ⁢ 
                           
                             fT 
                             s 
                           
                           ⁢ 
                           
                             D 
                             2 
                           
                         
                         ) 
                       
                     
                   
                 
               
             
           
         
       
     
     where b is a constant. 
     Therefore, the frequency offset is estimated as 
     
       
         
           
             
               Δ 
               ⁢ 
               
                   
               
               ⁢ 
               
                 f 
                 ^ 
               
             
             = 
             
               
                 ∠ 
                 ⁡ 
                 
                   ( 
                   
                     Σ 
                     ⁢ 
                     
                         
                     
                     ⁢ 
                     
                       w 
                       k 
                     
                   
                   ) 
                 
               
               ⁢ 
               
                 / 
               
               ⁢ 
               
                 ( 
                 
                   2 
                   ⁢ 
                   π 
                   ⁢ 
                   
                       
                   
                   ⁢ 
                   
                     T 
                     s 
                   
                   ⁢ 
                   
                     D 
                     2 
                   
                 
                 ) 
               
             
           
         
       
     
     DC Offset Estimation 
     Assuming the noise v k  is circularly symmetric complex Gaussian white noise, the maximum likelihood estimate of the DC offset, c, can be obtained using the frequency offset estimate Δ{circumflex over (f)}. 
     Define {circumflex over (n)} k =exp(i2πΔfT s k). The log-likelihood function is given by 
     
       
         
           
             L 
             = 
             
               
                  
                 
                   y 
                   - 
                   
                     c 
                     ⁢ 
                     
                         
                     
                     ⁢ 
                     1 
                   
                   - 
                   
                     a 
                     ⁢ 
                     
                       n 
                       ^ 
                     
                   
                 
                  
               
               2 
             
           
         
       
     
     After some manipulation it can be shown that 
     
       
         
           
             
               
                 ∂ 
                 L 
               
               
                 ∂ 
                 
                   a 
                   * 
                 
               
             
             = 
             
               
                 - 
                 
                   
                     
                       n 
                       ^ 
                     
                     * 
                   
                   ⁡ 
                   
                     ( 
                     
                       y 
                       - 
                       
                         c 
                         ⁢ 
                         
                             
                         
                         ⁢ 
                         1 
                       
                     
                     ) 
                   
                 
               
               + 
               
                 a 
                 ⁢ 
                 
                   
                      
                     
                       n 
                       ^ 
                     
                      
                   
                   2 
                 
               
             
           
         
       
     
     Solving for 
     
       
         
           
             
               
                 
                   ∂ 
                   L 
                 
                 
                   ∂ 
                   
                     a 
                     * 
                   
                 
               
               = 
               0 
             
             , 
           
         
       
     
     gives me maximum-likelihood estimate of the initial phase and amplitude, a, as 
     
       
         
           
             
               a 
               ^ 
             
             = 
             
               
                 
                   
                     
                       n 
                       ^ 
                     
                     * 
                   
                   ⁡ 
                   
                     ( 
                     
                       y 
                       - 
                       
                         c 
                         ⁢ 
                         
                             
                         
                         ⁢ 
                         1 
                       
                     
                     ) 
                   
                 
                 
                   
                      
                     
                       n 
                       ^ 
                     
                      
                   
                   2 
                 
               
               = 
               
                 
                   
                     
                       n 
                       ^ 
                     
                     * 
                   
                   ⁡ 
                   
                     ( 
                     
                       y 
                       - 
                       
                         c 
                         ⁢ 
                         
                             
                         
                         ⁢ 
                         1 
                       
                     
                     ) 
                   
                 
                 N 
               
             
           
         
       
     
     Substituting â into L gives 
     
       
         
           
             L 
             = 
             
               
                 
                    
                   
                     y 
                     - 
                     
                       c 
                       ⁢ 
                       
                           
                       
                       ⁢ 
                       1 
                     
                     - 
                     
                       
                         
                           
                             
                               n 
                               ^ 
                             
                             * 
                           
                           ⁡ 
                           
                             ( 
                             
                               y 
                               - 
                               
                                 c 
                                 ⁢ 
                                 
                                     
                                 
                                 ⁢ 
                                 1 
                               
                             
                             ) 
                           
                         
                         N 
                       
                       ⁢ 
                       
                         n 
                         ^ 
                       
                     
                   
                    
                 
                 2 
               
               = 
               
                 
                   
                      
                     
                       
                         ( 
                         
                           I 
                           - 
                           
                             
                               
                                 n 
                                 ^ 
                               
                               ⁢ 
                               
                                 
                                   n 
                                   ^ 
                                 
                                 * 
                               
                             
                             N 
                           
                         
                         ) 
                       
                       ⁢ 
                       
                         ( 
                         
                           y 
                           - 
                           
                             c 
                             ⁢ 
                             
                                 
                             
                             ⁢ 
                             1 
                           
                         
                         ) 
                       
                     
                      
                   
                   2 
                 
                 = 
                 
                   
                      
                     
                       P 
                       ⁡ 
                       
                         ( 
                         
                           y 
                           - 
                           
                             c 
                             ⁢ 
                             
                                 
                             
                             ⁢ 
                             1 
                           
                         
                         ) 
                       
                     
                      
                   
                   2 
                 
               
             
           
         
       
     
     where I is the N×N identity matrix and 
     
       
         
           
             P 
             = 
             
               I 
               - 
               
                 
                   
                     n 
                     ^ 
                   
                   ⁢ 
                   
                     
                       n 
                       ^ 
                     
                     * 
                   
                 
                 N 
               
             
           
         
       
     
     is a projection matrix.
 
Define {tilde over (y)}=Py and {tilde over (1)}=P1.
 
     Then 
     
       
         
           
             
               
                 ∂ 
                 L 
               
               
                 ∂ 
                 
                   c 
                   * 
                 
               
             
             = 
             
               
                 
                   - 
                   
                     
                       1 
                       ~ 
                     
                     * 
                   
                 
                 ⁢ 
                 
                   y 
                   ~ 
                 
               
               + 
               
                 c 
                 ⁢ 
                 
                   
                      
                     
                       1 
                       ~ 
                     
                      
                   
                   2 
                 
               
             
           
         
       
     
     Solving for 
     
       
         
           
             
               
                 
                   ∂ 
                   L 
                 
                 
                   ∂ 
                   
                     c 
                     * 
                   
                 
               
               = 
               0 
             
             , 
           
         
       
     
     gives the maximum-likelihood estimate of the DC offset as 
     
       
         
           
             
               
                 
                   
                     c 
                     ^ 
                   
                   = 
                   
                     
                       
                         
                           1 
                           ~ 
                         
                         * 
                       
                       ⁢ 
                       
                         y 
                         ~ 
                       
                     
                     
                       
                          
                         
                           1 
                           ~ 
                         
                          
                       
                       2 
                     
                   
                 
               
               
                 
                   ( 
                   2 
                   ) 
                 
               
             
           
         
       
     
     Note that this does not require the devices  1 ,  2  to perform actual matrix computations involving P. 
     In practice the devices  1 ,  2  calculate {tilde over (y)} and {tilde over (1)} as 
     
       
         
           
             
               
                 y 
                 ˜ 
               
               = 
               
                 y 
                 - 
                 
                   
                     
                       
                         
                           n 
                           ^ 
                         
                         * 
                       
                       ⁢ 
                       
                         n 
                         ^ 
                       
                     
                     N 
                   
                   ⁢ 
                   y 
                 
               
             
             , 
             
               
 
             
             ⁢ 
             and 
           
         
       
       
         
           
             
               1 
               ~ 
             
             = 
             
               1 
               - 
               
                 
                   
                     
                       
                         n 
                         ^ 
                       
                       * 
                     
                     ⁢ 
                     
                       n 
                       ^ 
                     
                   
                   N 
                 
                 ⁢ 
                 1 
               
             
           
         
       
     
     which they input to equation (2), above, to determine an estimate, ĉ, of the DC offset. 
     Phase Estimation 
     Once the DC offset has been estimated, the device  1 ,  2  can simply subtract the contribution to the sampled signal, y k , arising from the device&#39;s own local oscillator, and can then determine the phase difference of the incoming signal. 
     This can be done by calculating ŷ using the formula 
     
       
         
           
             
               y 
               ^ 
             
             = 
             
               
                 y 
                 - 
                 
                   
                     c 
                     ^ 
                   
                   ⁢ 
                   1 
                 
               
               = 
               
                 
                   
                     ( 
                     
                       c 
                       - 
                       
                         c 
                         ^ 
                       
                     
                     ) 
                   
                   ⁢ 
                   1 
                 
                 + 
                 an 
                 + 
                 v 
               
             
           
         
       
     
     and obtaining a phase estimate, {circumflex over (ψ)}, by taking the complex argument of the average of the values of ŷ, i.e. 
     
       
         
           
             
               ψ 
               ^ 
             
             = 
             
               arg 
               ⁢ 
               
                 { 
                 
                   
                     1 
                     * 
                   
                   ⁢ 
                   
                     y 
                     ^ 
                   
                 
                 } 
               
             
           
         
       
     
     Simulations 
       FIG. 4  shows results of a simulation using the methodology for joint estimation of the DC offset and frequency offset as disclosed above. 
     In this simulation, a measurement of a received continuous-wave was made over a period of 32 μs. A sample rate of 8 MHz was employed (i.e., ˜256 samples in total). A value of D 1 =D 2 =64 was used, so that D 1 T=D 2  T=8 μs, where T is the sample period of 0.125 μs. The ADC range was −1023 to 1023. The received amplitude |a| was 511.5 (representing automatic gain control). The phase of a and the DC offset c were both randomly chosen from the range [0, 2π). The amplitude of the DC offset was chosen from a uniform distribution with amplitude [0, 511.5). Complex Gaussian noise was added with a real and imaginary standard deviation of ˜20. 
       FIG. 4  shows an example output of the algorithm under a simulated scenario in which the local oscillator is offset from the frequency of the received signal by 7.80 kHz. In this simulation run, the actual DC offset was randomly selected to equal −199-25i. This is represented in  FIG. 4  by a point  50 . 
     The graph also shows an arced cluster of points  51  which represent the received down-mixed signal, at the output of the ADC, at different sample times, under the presence of simulated Gaussian random noise. Over the 32 μs time frame, these samples cover a quarter rotation of the unit circle. 
     A further cluster of points  52  represents the difference signal, z k , calculted as described above, in which the DC offset has been removed but the frequency offset is still present. 
     The frequency offset estimate obtained from the difference signal in this simulation, using the algorithm described above, was 7.96 kHz. This represents an accuracy of approximately 160 Hz. 
     The graph also includes a point  53  representing the estimated DC offset, calculated as described above. This was estimated as having the value −211-22i using the algorithm disclosed above. This represents an accuracy of approximately 6% in the DC offset estimation. 
     Thus, with only a quarter cycle of the down-mixed signal, the DC offset can be estimated with an accuracy of ˜6%. This demonstrates that this method can enable rapid and accurate estimation of DC offset. 
     It will be appreciated by those skilled in the art that the invention has been illustrated by describing one or more specific embodiments thereof, but is not limited to these embodiments; many variations and modifications are possible, within the scope of the accompanying claims.