pothosware/SoapySDRPlay3

if_mode missing in version 3

Closed this issue · 4 comments

Not sure if I'm misunderstanding something, but it looks like the if_mode option was removed with version 3. Is there a way to set the module to use low IF?

Dug into the code a bit, am I right to understand Low IF is set automatically now if you set the sample rate to something less than 2 MS/s?

Ref: Settings.cpp

@hsand - according the SDRplay API Specification Guide (https://www.sdrplay.com/docs/SDRplay_API_Specification_v3.15.pdf), low IF works only under a very specific set of configuration parameters listed in the description of the function sdrplay_api_Init() on page 25:

(fsHz == 8192000) && (bwType == sdrplay_api_BW_1_536) && (ifType == sdrplay_api_IF_2_048)
(fsHz == 8000000) && (bwType == sdrplay_api_BW_1_536) && (ifType == sdrplay_api_IF_2_048)
(fsHz == 8000000) && (bwType == sdrplay_api_BW_5_000) && (ifType == sdrplay_api_IF_2_048)
(fsHz == 2000000) && (bwType <= sdrplay_api_BW_0_300) && (ifType == sdrplay_api_IF_0_450)
(fsHz == 2000000) && (bwType == sdrplay_api_BW_0_600) && (ifType == sdrplay_api_IF_0_450)
(fsHz == 6000000) && (bwType <= sdrplay_api_BW_1_536) && (ifType == sdrplay_api_IF_1_620)

Because of that we thought with @SDRplay that it would be more useful for the general SoapySDR user to automatically have low IF selected only when those conditions are met.

Specifically we decided that the low IF would be automatically enabled (as you correctly saw in the source code for the method getInputSampleRateAndDecimation(): https://github.com/pothosware/SoapySDRPlay3/blob/master/Settings.cpp#L962-L1023) when the user selects a sample rate of exactly 2MHz (or one of its power-of-two factors, like 1MHz, 500kHz, and so on, via decimation) because in this scenario all the conditions for the last row in that list can be satisfied.

This way we also made it transparent to the SoapySDR user that with low IF enabled the output sample rate is 2MHz while the 'internal' sample rate used by the RSP is actually 6MHz (see the value of the fsHz API parameter).

We aimed at making the selection of low IF more convenient to use and tried to improve the user experience by removing that explicit if_mode (for instance low IF helps with removing the DC component, and since a sample rate of 2MHz or one if its fractions is very common in many SDR applications, having a low IF automatically enabled would make the RSP performance better around the LO frequency).

If there are other use cases where you think having low IF enabled would help, please let me know and I'll be happy to think how we can best accommodate those cases.

Franco

Hi Franco, thanks for the detailed explanation!

I'm running OpenWebRX and have profiles that increment by 1 MHz, with a sample rate of 1.536 MS/s so that I can catch any frequencies right on the edge (7 MHz / 8 / 9 / etc...) Easy fix would be to increase the sampling rate to 2 MS/s, at the expense of some FFT resolution.

Agree the behavior now makes sense for most users, but would also be nice to have the option to configure it manually :) Anyway, closing the case since my initial question was answered.

@hsand - I am glad I was able to answer your question.
Unfortunately 1.536MS/s is not compatible with the specific sample rates that support low IF, so trying to enable low IF with that sample rate would result in a stream of I/Q values that are just real values (Q is always 0).

I also thought you might interested in a little utility I wrote a while ago called single_tuner_recorder (https://github.com/fventuri/single-tuner-experiments), that allows the user to play directly with the many settings of the SDRplay API (including IF mode) without being constrained by the SoapySDR interface.
I found it very useful to learn about how SDRplay IF modes actually work, what kind of internal decimation SDRplay applies in those modes, and many other interesting details that are very hard to find in the documentation.

Franco