Understanding RX Image Rejection Code

221 views
Skip to first unread message

Karin

unread,
Nov 21, 2013, 6:08:32 PM11/21/13
to powersdr...@googlegroups.com


Hello Group:
Ever since I found this group more than a couple of years ago, I've been doing a lot of program modification based upon version 1.19.3.5 of PowerSDR-IFStage.
I've done an awful lot of embedded hardware and software design professionally over the years.  I've got a few basic questions about understanding how the receiver image rejection code is supposed to work.  And also trying to understand the DttSP code used in the DLL.  Fundamentally, my system is running well with the exception of the image rejection part of the software.  I've been putting up with its mediocre performance for quite some time now.  I've got a K2 with the added IF buffer amp and an LP-Pan setup for the K2.  The sound card I'm using is an Infrasonic Quartet with the latest drivers (v1.25.04) installed. I've also got Microsoft Visual Studio Team System 2008 and have made "Extensive Additions" to the base software based upon v1.19.3.5 of PowerSDR-IFStage.  I've highlighted the Extensive Additions because there are many.  Including the very nice panadapter resolution changes developed by W3SZ.
I am including a jpg of the image and desired signal after running the image rejection code in PowerSDR-IFStage.


What is interesting is that running the rx image function has absolutely no effect on reducing the image.
The image is the small signal immediately to the left of the desired signal which is centered

Now to the question.
If you look in the source code for "console.cs" under "CalibrateRXImage(float freq, Progress progress,bool suppress_error)", the first part of the code sets up the frequency based on the value passed then passes this to the K2, then sets up the PowerSDR filter bandwidths and a few other housekeeping functions. The code eventually gets to the point of measuring the noise floor of the system centered about the passed frequency, and comparing that to the max signal amplitude in the receiver filter passband.  This is all done while a signal from an external signal generator is applied to the K2 radio. Once the code has determined that the signal is greater than 30 dB above the noise floor, I/Q Correction is turned on, having been previously disabled to do the noise floor/max signal check.  From what I can see the following bit of code:
                float real, imag;
                DttSP.SetCorrectIQMu(0, 0, 0);
                DttSP.GetCorrectRXIQw(0, 0, &real, &imag, 1);
                DttSP.SetCorrectRXIQw(0, 0, real, imag, 0);
                DttSP.SetCorrectRXIQw(0, 0, 0.0f, 0.0f, 1);
                Debug.WriteLine("RX Image Real: " + real.ToString("f6") + "  Imag: " + imag.ToString("f6"));
                rx1_image_gain_table[(int)rx1_band] = real;
                rx1_image_phase_table[(int)rx1_band] = imag;
tries to set phase and amplitude values to minimize the image.  I don't see any way the code is actually measuring the value of the image amplitude to try to reduce the image response or figure out when to stop trying to minimize it.  The documentation for DttSP is virtually non-existent except by reading the C code.
I don't understand what the values for phase and amplitude balance really are in the above code.  Another issue I'm seeing is if I turn on WBIR it will eventually cause all image rejection to be completely destroyed.  In other words the image signal is at the same amplitude as the desired signal, this with the steady signal from the external signal generator applied to the radio. 
As an experiment I've used the exact same hardware setup and have run Spectrum Lab, where you can manually adjust the phase and amplitude balance from its internal control panel, and I am definitely able to null the image with its controls. From this experiment it is clear that the hardware and another software program can definitely reduce the image into the noise floor. 
So my conclusion is that something is broken in the PowerSDR-IFStage RX image reduction software and also maybe even the WBIR implementation in the base version of the software.  I'm not looking for plug and play here as I feel I am a competent C# and C++ developer in Windows.  I just need to understand a bit more about the code and its implementation.  I do understand the theory behind the algorithm for image cancellation.
Sorry for being so long winded and detailed but I feel that this is only way to figure these things out.  Any help would be appreciated.  I'm retired and have tons of time on my hands to these kinds of programming activities.

             Regards,
              Karin Anne Johnson   K3UU   Palm Harbor, Florida

Sergio IK8TNG

unread,
Nov 21, 2013, 6:38:47 PM11/21/13
to powersdr...@googlegroups.com
 
 
I have read carefully and interested in the subject, i hope that some OM more experience then me,  will answer soon.
Ciao Sergio Aversa (IT)
 
PS: I have a "goat" in programming.
----- Original Message -----
--
 
---
You received this message because you are subscribed to the Google Groups "PowerSDR / IF Stage" group.
To unsubscribe from this group and stop receiving emails from it, send an email to powersdr-if-st...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



Questa e-mail è priva di virus e malware perché è attiva la protezione avast! Antivirus .


Karin

unread,
Nov 23, 2013, 10:26:02 AM11/23/13
to powersdr...@googlegroups.com
Some more information regarding my search to understand how the image rejection code works.  While observing the output channels of my LP-PAN with both SpecLab and PowerSDR-IFStage, I notice that there is a substantial image while feeding an external RFsignal into the radio, as observed on the panadapter display of both programs.  This is before any attempt to run image rejection calibration at all.  I've checked the IF input signal to the LP-PAN device and there is only one signal in the passband, so the image is not being created in the radio (K2 in my case).  I don't have an actual audio spectrum analyzer as a separate piece of equipment, although SpecLab sort of does fulfill that function.  So I can only assume what I am seeing is coming from the output of the LP-PAN in the two audio signals, both I and Q.  At this point I'm not sure where the imbalance is, whether the amplitude or the phase.
I do have some pretty good test equipment for low level audio signals, Tektronix 7934 scope with 7A22 differential plugin, as well as others.  I'm going to see if I can actually see how good the amplitude and phase offset is on the LP-PAN.  In my previous post I mentioned that the SpecLab software was able to manually null the image and the indications I get from SpecLab is that both amplitude and phase need to be adjusted.  Not by much but it is required to null the image coming from LP-PAN. 
Here's another interesting event.  In the PowerSDR-IFStage source code there is a window form called "DSPTestForm".  In the source code version I have (v1.19.3.5) this window is setup but the code does not make it visible. I recompiled the source code to turn on this window, as it allows one to set the value of "DttSP..SetCorrectRXIQMu".  This is the entry point in DttSP.dll.  By the way this window form is normally not visible to the user unless you re-compile the source code with the appropriate values to turn it on. Once visible by holding down the Alt-Control-D keys I can then change the value of RXIQMu  to a value of 1.0 (it defaults to 0.005).  In my previous experience the label "Mu" when used in feedback loops usually is defined as a value for the sensitivity of how the feedback signal is modified to adjust the overall loop gain/phase value.  I'm assuming the image cancellation function is a feedback loop here. Then while observing the panadapter display in PowerSDR-IFStage I can see the image in the display gradually disappear into the noise floor. I've noticed that for this to happen the external RF signal to the radio needs to be above a certain signal level.  If it is below this level the automatic image cancellation will not proceed. I'm not sure what this level is.   Please note that the WBIR thread has been stopped and disabled, so the WBIR code is not causing the image to be nulled.  My assumption from this is something else in the DttSP code is actually providing an image cancellation function.  I have been unable to find it in the DttSP code.  I've also been trying to find the revised and updated algorithm code that Bob McGwier, N4HY developed several years ago.  He posted a link in a blog he wrote some time ago but apparently the link disappeared.

Regards,   Karin

Karin

unread,
Nov 27, 2013, 10:44:08 PM11/27/13
to powersdr...@googlegroups.com
Here is some more follow up on the personal work I've been doing to understand how the image rejection code works in PowerSDR-IFStage.  All of this curiousity came about because I felt that the automatic image rejection called Wideband Image Rejection (WBIR) wasn't really doing anything.  In fact there were numerous times when I had WBIR turned on it actually caused the image rejection code to create images.  Some of this effect is visible with only a single RF signal feeding the radio and LP-PAN/PowerSDR-IFStage system.  I also wasn't totally convinced that some of the signals on the panadapter display were actually images of very strong signals.  In a previous message to this thread I mentioned that I was able to turn on the DSPTestForm to manually get the image response of a single RF tone minimized.  Further, I was able to figure out where in the DttSP code this minimization was occuring.  It occurs in the DttSP module called "correctIQ.c".  Now the difficult part.  Since there is not a lot of documentation on how DttSP does its magic, I had to make some assumptions backed up with a discovery of a document labeled "DttSP.doc".  If you search around some of the SDR sites you will come across it.  It does give a very brief, and I mean "very brief" explanation of the structure of the audio processing front end.  Basically as I understand it, and as pointed out in "DttSP.doc" the audio from the sound card is absorbed in a ring buffer, the size of which is defined in the DSP tab of the Setup window in PowerSDR-IFStage. As each sample is taken off the ring another one is added.  There is some pre-processing done to the audio samples (both I and Q), via complex math, before it is sent off to the filters and demodulators.  So now I knew where the I/Q gain and phase could be adjusted to compensate for any static external effects.  
The operative term here is "static gain/phase offsets".  In my case with the Elecraft K2 and the LP-Pan system, I noticed that there was an imperfect balance between the I and Q channels in both gain and phase.  In other words the gain between each channel was not equal and the phase offset of ninety degrees was not present between each channel.  It is very close to ideal but not perfect. This is a total system effect in my case.  Namely it is caused mainly by the LP-PAN, but there may be some minor effect contributed by the K2 too.  I was able to see this by running another software I/Q program called SpecLab.  By being able to turn on the "DSPTestForm" I could manually minimize the image response by adjusting the value of "Mu", which I now know to be the step size adjustment for each sample IQ correction on the ring buffer as it is pre-processed.  I was also able to figure out that there are two variables labeled w[0] and
 w[1] in the DttSP module "correctIQ.c".  These variables eventually get changed to apply a correction factor to zero out the image response if you change the variable "Mu" for a long enough number of samples being processed.  You can actually watch the image disappear into the noise if you set the value of "Mu" high enough.  By being able to add a few more controls to the DSPTestForm window I was able to see how the variables w[0] and w[1] change in real time and how I might be able to use one or both of them to statically set an offset to compensate for the gain and phase offset in the hardware.  
I did exactly that and found that if I used the ability to set Mu in real time and watch the image go to a null, then read out the values of w[0] and w[1], I was able to add a bit of code to statically set the desired offset values in the processing code.  
Please note this is NOT a dynamic image rejection algorithm.  My effort here is trying to understand the image rejection capabilities of the hardware I have at hand and how I might be able to improve its performance, related specificaly to the K2 radio.  This effort is unique to the combination of K2 radio with attached LP-PAN device. 
Having Visual Studio and beind able to do source code debugging of DttSP proved to be the key to understanding how this code acutally works.  
 
Regards,     Karin   
On Thursday, November 21, 2013 6:08:32 PM UTC-5, Karin wrote:

WP4O

unread,
Nov 28, 2013, 9:41:15 AM11/28/13
to powersdr...@googlegroups.com

Hi Karen

Happy Thanksgiving, Welcome to the Left Coast, I use to use a K3 and PSDR IF now I use a Apache ANAN series 100 and 100d, I love it … software is from OpenHPSDR, Good luck on your project

 

De

Wp4o, Ed

South Tampa Florida also a Lefty…

--

Scott M

unread,
Dec 16, 2013, 12:29:16 AM12/16/13
to powersdr...@googlegroups.com
You should maybe talk to the author of Na3P - which is built on the latest version of PowerSDR/IF Stage.  I understand he started to work on the WBIR code some. In this branch of PowerSDR, the WBIR was just introduced and was buggy. I see image rejection get worse the longer powersdr runs.  I never did any analysis the effectiveness of image rejection in this branch.  

Quite frankly we have all these people running around messing with PowerSDR/IF code, but nobody to contribute back the changes? 

-Scott, WU2X

Karin Anne Johnson

unread,
Dec 16, 2013, 11:34:59 AM12/16/13
to powersdr...@googlegroups.com

Hi Scott:

Let me address the final point you made.  I do agree with you that there seem to be many folks messing with the PowerSDR-IFStage

code and not contributing back the changes.  Me included.  My only excuse is I’m a bit shy about revealing my weak programming ability.  But that was mostly my excuse when I first started this effort to learn a bit more about Windows programming.  And probably also I wasn’t sure if any collaboration effort on my part with reaching out to the original authors would be welcomed.  I see that the author of the NaP3 software has done a tremendous job on integrating many features to simplify the user experience related mostly to owners of LP-PAN and Elecraft devices.  That also more than likely dampened my effort on communicating revision updates to the software.  At this point I’m very comfortable with how the PowerSDR-IFStage code is organized, after spending almost three or maybe even four years messing with it.  Albeit, all of my changes have been focused at the Elecraft K2 interface.  Having worked at the hardware end of complex system designs for many, many years I appreciate what the software guys are up against in maintaining reliable code, while providing new features in the code and doing all of the appropriate regression testing.  It is not an enviable job in the corporate engineering world.  My forte has been embedded systems and I have had the luck to work with some world class organizations over the years, and in that process have learned a lot about the integration of reliable hardware and software.  Since retiring two years ago and having the learning experience related to the general SDR community, it’s been fun to play with the Windows development system I have.  I don’t know how much time you spend with the development process related to the software base of SDR code, and since I have so much free time myself, I’d certainly welcome the challenge of putting my meager contribution out there for others to benefit from.  Some of it is very esoteric in nature, and I certainly haven’t discovered anything earth shattering with respect to DSP code.  I’ll leave that to the PHD experts out there.  With regards to the overall operation of the WBIR code.  I found that there is some hardware deficiency with the combination of LP-PAN and Elecraft K2 that I wanted to address.  I did manage to discover sort of a big flaw in the LP-PAN hardware that probably can’t be fixed easily, but is easily fixed with software.

Much of the WBIR performance hides this problem, but it requires reasonable, reliable operation of the algorithm.  I appreciate the comment you made about the buggy nature of the original WBIR code.  I notice that Bob McGwire N4HY, in his blog has commented on some simple fixes to the WBIR issue.  I haven’t been able to find anything more about it as that post was more than two years ago.   Also FlexRadio has released a more updated version of the base code for their newer radios too.  Well enough of my rambling.  I would be amenable to having some guidance from either you or other original developers of the PowerSDR-IFStage to put my contributions out there.

Best regards and Seasons Greetings,

 

       Karin Anne Johnson  K3UU   Palm Harbor, FL

 


From: powersdr...@googlegroups.com [mailto:powersdr...@googlegroups.com] On Behalf Of Scott M
Sent: Monday, December 16, 2013 12:29 AM
To: powersdr...@googlegroups.com
Subject: [powersdr-if-stage] Re: Understanding RX Image Rejection Code

 

You should maybe talk to the author of Na3P - which is built on the latest version of PowerSDR/IF Stage.  I understand he started to work on the WBIR code some. In this branch of PowerSDR, the WBIR was just introduced and was buggy. I see image rejection get worse the longer powersdr runs.  I never did any analysis the effectiveness of image rejection in this branch.  

 

Quite frankly we have all these people running around messing with PowerSDR/IF code, but nobody to contribute back the changes? 

 

-Scott, WU2X

--
 
---
You received this message because you are subscribed to a topic in the Google Groups "PowerSDR / IF Stage" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/powersdr-if-stage/bH4wdS5hCt0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to powersdr-if-st...@googlegroups.com.

Reply all
Reply to author
Forward
0 new messages