trying to reduce dc offset with low if modes, api differences

Add useful snippets of code or links to entire SDR projects.
Post Reply
bobasaurus
Posts: 9
Joined: Wed Mar 15, 2017 7:39 pm

trying to reduce dc offset with low if modes, api differences

Post by bobasaurus » Mon Jul 01, 2019 8:18 pm

I'm currently developing sdrplay rsp2 code using the older version 2.13 API. I'm having some difficulties with the DC offset wiping out a narrow signal (with and without correction), so I'm trying to use low if modes to eliminate the offset. Alternatively, I could tune off from center but I'm trying the low IF modes first. There are four configurations that work with low IF mode according to the API docs:

Image

I've tried the first three so far, here are average spectra saved from my code. Oddly I'm still getting the center dc spike, despite using mir_sdr_DCoffsetIQimbalanceControl(1, 1):

Image
Image
Image

I would like to use the third mode, but I'm confused by the spike on the right. What is causing it? I see the same low if spike in HDSDR, which I believe uses the same v2 api via extio:

Image

Oddly, it doesn't have any DC spike. I'm not sure if they're doing any extra tricks to eliminate the spike, such as subtracting the average I/Q from each sample.

In SDRUno, I'm not given as much control over the low if modes. I can only select "IF MODE: LIF", but not the sample rate which is fixed to 2 MSPS. I'm assuming this comes from the new V3 API which I have not yet explored.

So I guess I have two questions. Should I switch to the V3 API to get cleaner low IF mode output, and are there any other tricks for avoiding or eliminating DC offset?
Last edited by bobasaurus on Thu Jan 01, 1970 12:00 am, edited 0 times in total.
Reason: No reason
- Allen Jordan, NOAA software/electrical engineer

bobasaurus
Posts: 9
Joined: Wed Mar 15, 2017 7:39 pm

Re: trying to reduce dc offset with low if modes, api differences

Post by bobasaurus » Mon Jul 01, 2019 9:14 pm

The SDRUno low if spectrum also has no DC spike:

Image

Again, I don't know if this is due to the DC offset being removed during the FFT pre-processing, or if there is no DC offset spike because of the low IF mode.

Reason: No reason
- Allen Jordan, NOAA software/electrical engineer

sdrplay
Posts: 978
Joined: Wed Jan 07, 2015 7:58 am

Re: trying to reduce dc offset with low if modes, api differences

Post by sdrplay » Mon Jul 01, 2019 9:51 pm

There is always a DC spike, the IF mode determines where the spike appears. In Zero IF mode, the DC spike is at the LO frequency (0 Hz offset). Software is used to remove the spike which can also remove any signal at the LO frequency (which is why you need to apply an offset between the LO and VFO frequencies in Zero IF mode for signals with the center carrier such as AM)

Low IF mode has a DC spike at the IF frequency - you can see in the 3rd image that the DC spike is at 450 kHz offset from the LO frequency.

The API 3.x works differently with Low IF mode - it's easier to use. An input sample rate of 6 MHz will deliver a 2 MHz final sample rate IQ stream with an IF of 1.62 MHz. Decimation can then be used if a lower final sample rate is required.

Hope that helps,

Best regards,

SDRplay Support

Reason: No reason

bobasaurus
Posts: 9
Joined: Wed Mar 15, 2017 7:39 pm

Re: trying to reduce dc offset with low if modes, api differences

Post by bobasaurus » Tue Jul 02, 2019 6:13 pm

Thanks for the information, that explains the spike in the third spectrum... the smaller bandwidth of the first two spectra wasn't large enough to show this spike.

Any idea why I'm getting a narrow center spike on each one? This never shows up in commercial software, but I always see it when calculating average FFTs myself.

I'm intrigued by the new API, I might give it a try. I have to marshall the C calls into C# though, which is proving tricky for some of the new API enums and functions.

Reason: No reason
- Allen Jordan, NOAA software/electrical engineer

sdrplay
Posts: 978
Joined: Wed Jan 07, 2015 7:58 am

Re: trying to reduce dc offset with low if modes, api differences

Post by sdrplay » Tue Jul 02, 2019 6:42 pm

In the IQ stream, the centre will be at the beginning of the data, so I would check that you have the right number of points, etc. - I would also try other frequencies to see if you get the same result.

Best regards,

SDRplay Support

Reason: No reason

Post Reply