# Lime Equaliser - The I/Q Imbalance Correction and Gain Flattening

## Mathematical Background of the Equaliser Design Procedure

In order to design FIR filter as an equalizer let us first define its desired frequency response. First step is actually to measure gain, IQ gain error and IQ phase error as below

where N_{m} is the number of frequency points we have chosen to measure at, while x is normalised frequency:

f_{clk} being the clock frequency the equaliser is going to operate at.
N_{m} is minimised in order to speed up the equaliser design procedure.

We define the IQ gain and phase errors as below:

If g_{err}(x)=1 and \({\phi}\)_{err}(x)=0, at least in the pass-band of interest,
then there is no issue with IQ imbalance. This is never the case. However,
for narrow-band modulations, the IQ imbalance could be tolerated or at least considered as frequency independent.

In case of 5G NR, where modulation bandwidth is +/-50MHz in baseband, 100MHz in RF, neither static nor dynamic IQ imbalance can be ignored. Hence, there is the need for the equaliser which should take care of both IQ imbalance components.

Based on measured data, next step forward is to build mathematical models of the gain g_{a}(x), the
IQ gain error g_{erra}(x) and IQ phase error \({\phi}\)_{erra}(x).

We use the following polynomial approximations:

Polynomial coefficients in the above equations are determined by minimising
mean square error (MSE) between measured data and the approximating polynomial at measured frequency points.
As it can be seen from equations above, each polynomial has three unknown coefficients.
Hence, minimum measured points is N_{m}=3. We used N_{m}=6.
In other words, looking at baseband frequencies, +/-f_{0}, +/-f_{mid}, +/-f_{p} are chosen,
where f_{0} is close to DC, f_{p} is the equaliser passband equal to 50 MHz while f_{mid} is in the middle.
In RF f_{0}, f_{mid}, f_{p} are in fact test tone offsets from LO frequency.

Any circuit with real valued components has positive symmetrical amplitude
and negative symmetrical phase response around DC. That is the reason why g_{a}(x) and g_{erra}(x)
use even orders while \({\phi}\)_{erra}(x) uses odd orders only polynomials
which inherently provide above-mentioned property.
This symmetry however is not guaranteed in RF due to the need to measure both sides around DC
(around LO in RF) in order to equalise both sides to the same extent.

Transmit chain equalisation is performed using two FIR filters, placed inside I and Q branches, respectively.

Using polynomial approximation their desired gain, i.e. amplitude response, are given as:

Both gain functions contain inverse of g_{a}(x) to equalise (flatten) the channel
gain, while EQUQ also corrects the IQ gain error.
On the other hand, phase error is corrected by EQUI.
Hence, desired phase responses are defined as:

a_{errg}[0] and a_{errp}[0] are in fact the static IQ gain and phase errors.
While static gain error is taken into account, static phase error is implemented by
static phase correction block.

Equations for desired gain and phase responses show that IQ imbalance correction is split into two available filters. Gain error is corrected by EQUQ while phase error is corrected by EQUI. This is done on purpose to relax the specification of the filters and consequently to reduce required number of filtering taps.

Having in mind equations for desired phase response, desired normalised group delays of the equaliser filters can be calculated as:

In order to design equaliser FIR filters, the same numerical optimization procedure is executed twice. Once with desired amplitude and group delay for EQUI:

and once more for EQUQ:

The advantage of using polynomial approximation rather than measured results is obvious. We can improve the process of equaliser coefficients calculation by calculating more points of the desired amplitude and group delay responses without actually measuring them. This saves a lot of time.

## The Amplitude Response, Phase Response and Group Delay of FIR Filter

Let us assume that the equaliser is implemented as N tap FIR filter. If its transfer function is given by:

then, the frequency response of the filter has the form:

where real and imaginary parts of previous equation are calculated as:

The amplitude and phase of the complex function are then:

Therefore, from last equations, the group delay can be calculated as below:

Finally, the normalised group delay is given as:

EQUI and EQUQ equalising FIR filter coefficients are designed complying two constraints:

FIR amplitude response A(x) should approximate desired functions g

_{dI}(x) for EQUI or g_{dQ}(x) for EQUQ,the FIR group delay \({\tau}\)(x) should be as close as possible to desired functions given in the equations for \({\tau}\)

_{dI}(x) for EQUI or \({\tau}\)_{dQ}(x) or EQUQ.