LNAstate and setGrMode in mir_sdr_StreamInit()

Add useful snippets of code or links to entire SDR projects.
npnrj
Posts: 3
Joined: Sat Dec 23, 2017 8:36 am

LNAstate and setGrMode in mir_sdr_StreamInit()

Postby npnrj » Sun Jan 28, 2018 8:27 pm

I am, I admit, utterly confused by the documentation for the LNAstate and setGrMode parameters in the call to mir_sdr_StreamInit(). Has anyone got a clear explanation of what's going on here, and what on earth table 5.3 in the API documentation actually means? I read a few code samples but they don't really help much as they don't document the parameters to the calls.

It feels to me as if the API documentation needs a companion note explaining more about the internal operation of the RSP2 so that the API documentation makes more sense.

Nick
Last edited by npnrj on Thu Jan 01, 1970 12:00 am, edited 0 times in total.
Reason: No reason

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

Re: LNAstate and setGrMode in mir_sdr_StreamInit()

Postby sdrplay » Mon Jan 29, 2018 8:44 am

Hi Nick,

I have replied to your ticket on this.

Best regards,

Andy
Software Development

Reason: No reason

SteveAndrew
Posts: 121
Joined: Thu Nov 16, 2017 11:06 pm
Location: Gold Coast, QLD, Australia

Re: LNAstate and setGrMode in mir_sdr_StreamInit()

Postby SteveAndrew » Mon Jan 29, 2018 10:53 am

Hi Nick

I have the same sort of problem. I thought I understood what was supposed to happen, but now having re-visited the API documentation, I'm not so sure. I'm sure there are other coders out there with the same problem. I've been involved in other parts of my project for some time and have not got back into the radio-specific code for some time - swamp/alligator syndrome :D

To save the lads in support from having to answer the same query several times, is there any chance you could post their response here. I sure it would be helpful to a lot of people out there.

Many thanks in advance...

Reason: No reason

StevenP
Posts: 3
Joined: Tue Jan 16, 2018 4:26 pm

Re: LNAstate and setGrMode in mir_sdr_StreamInit()

Postby StevenP » Tue Jan 30, 2018 3:15 pm

I have to agree, the response to this question would be extremely helpful to me as well.
Last edited by StevenP on Thu Jan 01, 1970 12:00 am, edited 0 times in total.
Reason: No reason

Paul314
Posts: 17
Joined: Thu Nov 23, 2017 8:39 pm

Re: LNAstate and setGrMode in mir_sdr_StreamInit()

Postby Paul314 » Tue Jan 30, 2018 3:30 pm

I second the request to publish the answer given to the OP. It's most frustrating when engaging a question to have it vanish down a private conversation.

Reason: No reason

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

Re: LNAstate and setGrMode in mir_sdr_StreamInit()

Postby sdrplay » Tue Jan 30, 2018 9:43 pm

Thought I'd post a few things to try to clarify the gain control...

Firstly, the thing to remember with the RSP is that, when using the API, gain control is GAIN REDUCTION. Also, note that there are 2 types of gain reduction, IF and RF. The IFGR is all on the MSI001 whereas the RFGR is a combination of gain control on the MSI001 and external LNA.

Another thing to remember is that the AGC system ONLY controls the IFGR and that the IFGR has a range of 0 - 59 (you will notice in SDRuno and other software we produce that we use the range of 20-59 as the top 20dB of range won't do much in most situations, although it is still there if you need to use it).

For the RFGR, this is represented as a range of 0 to MAXRF, where MAXRF varies depending on the frequency or port (RSP2) - the ranges for RFGR (known as LNAstate in the API) can be seen in the API in section 5.3 (https://www.sdrplay.com/docs/SDRplay_SD ... cation.pdf)

You will see that each step of RFGR will apply a certain amount of Gain Reduction, so in both the IFGR and RFGR 0 = MIN GR = MAX GAIN

The API functions (StreamInit and others) will error if a value of GR is out of bounds for the relevant rules shown in section 3.5 of the API

The two common mistakes people make when using the API is 1) using gain values instead of gain reduction and 2) using a value for LNAstate that is out of bounds for the relevant condition.

I hope that clears up the confusion.

Best regards,

Andy

Reason: No reason


Return to “Code Corner”

Who is online

Users browsing this forum: No registered users and 1 guest