DSPRelated.com
Forums

Code for I/Q mismatch calibration

Started by Peter Mairhofer July 14, 2016
> Steve Pope wrote: > No, what you ask is impossible.
Of course it is. It's not only the number of mixers but the number of LOs and filters which = add to the cost not to mention power consumption and size. So I think we can now agree that when cost is king then IQ imbalance is som= ething we need to deal with. And while it's fun to talk about other archit= ectures the reality for today and the foreseeable future is the direct-conv= ersion receiver with all its warts.
<lito844@gmail.com> wrote:

>> Steve Pope wrote:
>> No, what you ask is impossible.
>Of course it is.
>It's not only the number of mixers but the number of LOs and filters >which add to the cost not to mention power consumption and size. > >So I think we can now agree that when cost is king then IQ imbalance is >something we need to deal with. And while it's fun to talk about other >architectures the reality for today and the foreseeable future is the >direct-conversion receiver with all its warts.
Let me more accurately phrase my original comment: At some point in the receiver chain, the analog signal gets converted to analog. In my experience this point is usefull one of the following: 1) A quadrature signal that has been mixed down to baseband. 2) A single-ended signal at a low IF. You are describing a third alternative, a quadrature signal at low IF, and I do not immediately see the usefulness of this. Although, anything is possible. Steve
On Saturday, July 16, 2016 at 7:35:32 PM UTC-4, Steve Pope wrote:
> <lito844@gmail.com> wrote: >=20 > >> Steve Pope wrote: >=20 > >> No, what you ask is impossible. >=20 > >Of course it is. >=20 > >It's not only the number of mixers but the number of LOs and filters > >which add to the cost not to mention power consumption and size. > > > >So I think we can now agree that when cost is king then IQ imbalance is > >something we need to deal with. And while it's fun to talk about other > >architectures the reality for today and the foreseeable future is the > >direct-conversion receiver with all its warts. >=20 > Let me more accurately phrase my original comment: >=20 > At some point in the receiver chain, the analog signal gets=20 > converted to analog. >=20 > In my experience this point is usefull one of the following: >=20 > 1) A quadrature signal that has been mixed down to baseband. >=20 > 2) A single-ended signal at a low IF. >=20 > You are describing a third alternative, a quadrature signal at > low IF, and I do not immediately see the usefulness of this. > Although, anything is possible. >=20 > Steve
I must confess I don't understand most of your question. However regarding quadrature mix to low-IF, I previously made the point tha= t if the IF is larger than the passband bandwidth then interference due to = IQ imbalance can be circumvented without implementing an IQ imbalance equal= izer. Hence such an architecture represents yet another way to deal with I= Q imbalance. I referenced it only because this is the architecture described by the OP. Oftentimes an architecture is chosen for reasons which may not be evident b= y considering just one subsystem in isolation. I can accept that the OP's = system (which quad mixed from 1.84 GHz to 122.88 MHz) did so to meet a requ= irement of the system. Perhaps the OP can comment further on this question= . I've only dealt with this architecture once. It was chosen to cost reduce = a cell phone receiver from 2 chips to 1. The requirement was to minimize c= hanges to the DSP software which was designed to process an IQ stream. The= chip which was eliminated received single-ended analog IF and quad mixed t= o baseband. The new receiver chip integrated a quad mix and a pair of A/Ds= but could not mix to baseband due several issues with the silicon technolo= gy used. Instead it quad-mixed to an IF of 455 kHz and the only change nee= ded in the DSP was a small modification to the complex mix used in its AFC. So here was another example where a practical, cost related reason required= an architectural choice that from a purely technical view may not make the= best sense.
<lito844@gmail.com> wrote:

>On Saturday, July 16, 2016 at 7:35:32 PM UTC-4, Steve Pope wrote:
>> Let me more accurately phrase my original comment: >> >> At some point in the receiver chain, the analog signal gets >> converted to analog. >> >> In my experience this point is usefull one of the following: >> >> 1) A quadrature signal that has been mixed down to baseband. >> >> 2) A single-ended signal at a low IF. >> >> You are describing a third alternative, a quadrature signal at >> low IF, and I do not immediately see the usefulness of this. >> Although, anything is possible.
>I must confess I don't understand most of your question.
It's a comment, not a question.
>However regarding quadrature mix to low-IF, I previously made the point >that if the IF is larger than the passband bandwidth then interference >due to IQ imbalance can be circumvented without implementing an IQ >imbalance equalizer. Hence such an architecture represents yet another >way to deal with IQ imbalance.
I'll agree with that. Steve
On Thursday, July 14, 2016 at 10:39:11 PM UTC-4, Peter Mairhofer wrote:
> Hi, > > Does anyone have some code for I/Q mismatch calibration/compensation for > a direct conversion receiver which I may use? > > So far I used a spectrum analyzer as capturing device which can do I/Q > calibration automatically ... but now I use an RF board and I have an > image at -30dBc ... and NMSE=-30 dB only. > > I was told I should just filter out the image but this makes it even > worse. I don't think it makes sense because isn't also crap from the > image on top of the wanted signal? > > Then I followed [1]. But since I just want to understand if the error is > indeed caused by I/Q mismatch, I don't want to bother implementing an > algorithm but just use Eq (13) while sweeping over possible values of > alpha and phi: > > for k1=1:length(alphas) > for k2=1:length(phis) > alpha = alphas(k1); > phi = phis(k2); > A = alpha^-1; > C = -sin(phi)/(alpha*cos(phi)); > D = 1/cos(phi); > ycorr = real(yrx)*A + 1i*(real(yrx)*C + imag(yrx)*C); > > % in order to check for NMSE, need to time align > ycorr = ycorr/std(ycorr)*std(x); > [~,ycorr] = fitSignal_120825(x, ycorr); > NMSE(k1,k2) = 20*log10(norm(ycorr-x)/norm(x)); > end > end > > ... but the NMSE is stuck at -30dB with alpha~1 and phi~0. > > Maybe doing something wrong. > > I wonder that I could not find a single sample code in google or matlab > file exchange ... > > Thank you! > > Peter > > > > > > [1] http://www.faculty.ece.vt.edu/swe/argus/iqbal.pdf
Look up SDR1000 it was in QST it is a low cost design using a Multiplexer as a switching mixer, which had many spurs in its Base-band.
On Thursday, July 14, 2016 at 10:39:11 PM UTC-4, Peter Mairhofer wrote:
> Hi, > > Does anyone have some code for I/Q mismatch calibration/compensation for > a direct conversion receiver which I may use? > > So far I used a spectrum analyzer as capturing device which can do I/Q > calibration automatically ... but now I use an RF board and I have an > image at -30dBc ... and NMSE=-30 dB only. > > I was told I should just filter out the image but this makes it even > worse. I don't think it makes sense because isn't also crap from the > image on top of the wanted signal? > > Then I followed [1]. But since I just want to understand if the error is > indeed caused by I/Q mismatch, I don't want to bother implementing an > algorithm but just use Eq (13) while sweeping over possible values of > alpha and phi: > > for k1=1:length(alphas) > for k2=1:length(phis) > alpha = alphas(k1); > phi = phis(k2); > A = alpha^-1; > C = -sin(phi)/(alpha*cos(phi)); > D = 1/cos(phi); > ycorr = real(yrx)*A + 1i*(real(yrx)*C + imag(yrx)*C); > > % in order to check for NMSE, need to time align > ycorr = ycorr/std(ycorr)*std(x); > [~,ycorr] = fitSignal_120825(x, ycorr); > NMSE(k1,k2) = 20*log10(norm(ycorr-x)/norm(x)); > end > end > > ... but the NMSE is stuck at -30dB with alpha~1 and phi~0. > > Maybe doing something wrong. > > I wonder that I could not find a single sample code in google or matlab > file exchange ... > > Thank you! > > Peter > > > > > > [1] http://www.faculty.ece.vt.edu/swe/argus/iqbal.pdf
Also this is a common SDR architecture, it allows multiple channels to be digitized all at once.
On Thursday, July 14, 2016 at 10:39:11 PM UTC-4, Peter Mairhofer wrote:
> Hi, > > Does anyone have some code for I/Q mismatch calibration/compensation for > a direct conversion receiver which I may use? > > So far I used a spectrum analyzer as capturing device which can do I/Q > calibration automatically ... but now I use an RF board and I have an > image at -30dBc ... and NMSE=-30 dB only. > > I was told I should just filter out the image but this makes it even > worse. I don't think it makes sense because isn't also crap from the > image on top of the wanted signal? > > Then I followed [1]. But since I just want to understand if the error is > indeed caused by I/Q mismatch, I don't want to bother implementing an > algorithm but just use Eq (13) while sweeping over possible values of > alpha and phi: > > for k1=1:length(alphas) > for k2=1:length(phis) > alpha = alphas(k1); > phi = phis(k2); > A = alpha^-1; > C = -sin(phi)/(alpha*cos(phi)); > D = 1/cos(phi); > ycorr = real(yrx)*A + 1i*(real(yrx)*C + imag(yrx)*C); > > % in order to check for NMSE, need to time align > ycorr = ycorr/std(ycorr)*std(x); > [~,ycorr] = fitSignal_120825(x, ycorr); > NMSE(k1,k2) = 20*log10(norm(ycorr-x)/norm(x)); > end > end > > ... but the NMSE is stuck at -30dB with alpha~1 and phi~0. > > Maybe doing something wrong. > > I wonder that I could not find a single sample code in google or matlab > file exchange ... > > Thank you! > > Peter > > > > > > [1] http://www.faculty.ece.vt.edu/swe/argus/iqbal.pdf
Hi Peter, Have you tried feeding a pure RF sinewave into the receiver and then look at your I and Q signals. They should be two equi-amplitude sinusoids 90 degrees out of phase with each other. Just capture those and do a little analysis and you will see what the error is. Clay
On Wed, 2 Nov 2016 20:19:50 -0700 (PDT), clay@claysturner.com wrote:

>On Thursday, July 14, 2016 at 10:39:11 PM UTC-4, Peter Mairhofer wrote: >> Hi, >>=20 >> Does anyone have some code for I/Q mismatch calibration/compensation for >> a direct conversion receiver which I may use? >>=20 >> So far I used a spectrum analyzer as capturing device which can do I/Q >> calibration automatically ... but now I use an RF board and I have an >> image at -30dBc ... and NMSE=3D-30 dB only. >>=20 >> I was told I should just filter out the image but this makes it even >> worse. I don't think it makes sense because isn't also crap from the >> image on top of the wanted signal? >>=20 >> Then I followed [1]. But since I just want to understand if the error is >> indeed caused by I/Q mismatch, I don't want to bother implementing an >> algorithm but just use Eq (13) while sweeping over possible values of >> alpha and phi: >>=20 >> for k1=3D1:length(alphas) >> for k2=3D1:length(phis) >> alpha =3D alphas(k1); >> phi =3D phis(k2); >> A =3D alpha^-1; >> C =3D -sin(phi)/(alpha*cos(phi)); >> D =3D 1/cos(phi); >> ycorr =3D real(yrx)*A + 1i*(real(yrx)*C + imag(yrx)*C); >>=20 >> % in order to check for NMSE, need to time align >> ycorr =3D ycorr/std(ycorr)*std(x); >> [~,ycorr] =3D fitSignal_120825(x, ycorr); >> NMSE(k1,k2) =3D 20*log10(norm(ycorr-x)/norm(x)); >> end >> end >>=20 >> ... but the NMSE is stuck at -30dB with alpha~1 and phi~0. >>=20 >> Maybe doing something wrong. >>=20 >> I wonder that I could not find a single sample code in google or matlab >> file exchange ... >>=20 >> Thank you! >>=20 >> Peter >>=20 >>=20 >>=20 >>=20 >>=20 >> [1] http://www.faculty.ece.vt.edu/swe/argus/iqbal.pdf > >Hi Peter, > >Have you tried feeding a pure RF sinewave into the receiver and then look a= >t your I and Q signals. They should be two equi-amplitude sinusoids 90 degr= >ees out of phase with each other. Just capture those and do a little analys= >is and you will see what the error is. > >Clay
^^What Clay said. If a sine input doesn't creat a perfect circle, then there are I/Q distortions, and it should be evident whether they're magnitude or phase imbalances. e.g., a magnitude imbalance will make an oval with the squashed part aligned with the I or Q axis. A phase imbalance will have the squashed part at a 45-degree angle to the coordinate axes. Combinations of the two can occur, but when you have a circle, then it's correct.
<eric.jacobsen@ieee.org> wrote:

>On Wed, 2 Nov 2016 20:19:50 -0700 (PDT), clay@claysturner.com wrote:
>>Have you tried feeding a pure RF sinewave into the receiver and then look a= >>t your I and Q signals. They should be two equi-amplitude sinusoids 90 degr= >>ees out of phase with each other. Just capture those and do a little analys= >>is and you will see what the error is.
>^^What Clay said. > >If a sine input doesn't creat a perfect circle, then there are I/Q >distortions, and it should be evident whether they're magnitude or >phase imbalances. e.g., a magnitude imbalance will make an oval with >the squashed part aligned with the I or Q axis. A phase imbalance >will have the squashed part at a 45-degree angle to the coordinate >axes. Combinations of the two can occur, but when you have a circle, >then it's correct.
I agree. It is usual to calibrate on a test tone. What may be a bit tricky is synthesizing and injecting the pure RF sinewave -- if it uses similar circuitry as the signal path you're trying to balance, it may itself have imbalances (images around the carrier). One solution is to create it using a DPLL at RF (or at a subharmonic, then filtering). Or you could use a low-IF method. In some cases you can run your I/Q calibration algorithm at a center frequency that is different from you operating frequency, and which is chosen so that the test tone is easy to create, avoiding the need to synthesize test tones at lots of different RF frequencies. Steve