From a pure mathematical description, a single sine wave has no phase, a phase can only develop between two different sine waves. The added complexity is that we do not have a single real signal (sine wave), we have a complex signal . Rotating this signal by 180° or radians, becomes , and this is the result we want to be able to find, and eventually correct for. If you are not sure why the math works this way, check out this explanation.
In a previous section, we talked about I/Q correction - phase shifting Q with respect to a fixed I, and making the magnitudes of I and Q equal. In the AD9361/AD9364 this is done inside the device automatically, and is know as “Quadrature correction”.
The first stage we will examine is measuring phase differences.
In the classical sense - measuring phase synchronization of a different signals, only the phase is important. No restriction on the amplitudes is imposed. Thus, the phase synchronization of coupled systems is defined as the appearance of relations between their phases, while the amplitudes can remain non-correlated. Many of the techniques below will measure both phase/frequency/amplitude differences, and others will simply measure phase only. Depending on the application, and signal, different schemes may provide better results.
Although Simulink may have a block to directly measure phase difference between two complex input signals, most other environments do not, and we will need to get a better understanding how to do this.
The exact method of measuring a phase difference between two RF signals depends on the signal, and application in question:
Depending on your answer to these questions, you could consider the following techniques:
Understanding what sort of issues we are trying to solve -- it's nice to understand the relationship between phase angle, and time lag/lead.
So for a 1MHz baseband sine wave, that is off by .5°, that is a . Like all electromagnetic waves, radio waves travel at the speed of light (~0.299792458 meter / ns). In this case 0.5°, means we could be ~41.64cm off any relative distance measurement (if that is what you are doing).
This is why we need to be sure we don't think about baseband.
For a 1MHz baseband sine wave, that we are modulating to 2.4GHz (2.401MHz wave), it's . This turns into a relative distance measurement of ~0.173 mm.
Needless to say - we want to be as precise as possible, and make sure we reference things to the air/RF interface, not the baseband signals.
When a single Continuous Wave (CW) RF tone is mixed to baseband, it creates two signals (in-phase and quadrature) should be orthogonal to each other with the same amplitude. Without loss of generality, we normalize the magnitude and the phase, then the two signals can be expressed as:
As mentioned above, we want to rotate these signal around the same point, which is the same as providing a constant phase shift.
where is the baseband frequency of the tone, and is the desired phase shift, which will cause a fixed rotation around the origin (in a constellation, or I vs Q plot).
We can use the trigonometric sum/difference identities to re-write that as:
and substitute our original uncorrected values, (and swap the order of , so we can see the matrix a little easier…
translating that into a 2 x 4 matrix multiply is quite easy.
And while the coefficients are much different than adjusting Q with respect to I, the same hardware (the 2 by 2 multiplier) can be used.
This is well and good - but since we are dealing with fixed point math inside of an FPGA, we need to be careful of overflow. If we determine that we want to rotate something is 45°, (or radians), since ,
If you are just investigating continuous tones, this would be fine. However, since simple CW tones don't really represent complex (I/Q) radio signals like QPSK, it's possible that the I/Q may be close to the max of the resolution, for the AD9361 that would be 12 bits, or 1.11 bits (1 sign bit, 11 magnitude bits) result. For example: If I and Q are both at +1638 (about 80% of full scale), the results of the corrected I' and Q' would be I' = 0 and Q' = 2317. Q' will overflow an 1.11 bit representation.
There are two solutions:
To scale, it's just a matter to dividing by the gain, (). It's important to take the absolute value, to ensure that (which would happen otherwise at +135 degrees (+3/4π radians) or +315 (-45) degrees (-π/4 radians)). This translates into:
Which makes the matrix:
The above can be used directly, depending on what sort of functions your math library has available (sin, cos, tan) and the amount of rotation that you will allow (the above is for ±180 degrees). You can re-write in terms of other trig functions, but care must be taken to ensure that denominator never approaches zero.