ast / SoapyAirspy

Soapy SDR plugin for the Airspy
https://github.com/pothosware/SoapyAirspy/wiki
MIT License
4 stars 4 forks source link

Setting gain question #9

Open LarsThunberg opened 11 months ago

LarsThunberg commented 11 months ago

Hi, I have built the branch v2 and using for SatNOGS Raspberry PI 4, according to this thread: https://community.libre.space/t/new-airspy-r2-mini-driver-development/9768/26

I'm not sure if the gain setting is working, or if I'm using the wrong parameter settings. For example I'm using this setting in SatNOGS:

soapy-rx-device: "driver=airspy,gains=linearity"
other-settings: "LIN=19"

Changing the "LIN" value does not seem change any gain, as seen in the waterfall for a SatNOGS observation. The debug info from SatNOGS is the following:

Jul 31 13:20:52 satnogs858 satnogs-client[3038]: [DEBUG] SoapyAirspy::SoapyAirspy()
Jul 31 13:20:52 satnogs858 satnogs-client[3038]: [DEBUG] SoapyAirspy::SoapyAirspy(driver) = airspy
Jul 31 13:20:52 satnogs858 satnogs-client[3038]: [DEBUG] SoapyAirspy::SoapyAirspy(gains) = linearity
Jul 31 13:20:52 satnogs858 satnogs-client[3038]: [DEBUG] SoapyAirspy::SoapyAirspy(label) = AirSpy One [62cc68ff214d1f17]
Jul 31 13:20:52 satnogs858 satnogs-client[3038]: [DEBUG] SoapyAirspy::SoapyAirspy(serial) = 62cc68ff214d1f17
Jul 31 13:20:52 satnogs858 satnogs-client[3038]: [DEBUG] Found AirSpy device: serial = 62cc68ff214d1f17
Jul 31 13:20:52 satnogs858 satnogs-client[3038]: [DEBUG] SoapyAirspy::SoapyAirspy(gains) = linearity
Jul 31 13:20:52 satnogs858 satnogs-client[3038]: [DEBUG] Supported sample rate: 3000000
Jul 31 13:20:52 satnogs858 satnogs-client[3038]: [DEBUG] Supported sample rate: 6000000
Jul 31 13:20:52 satnogs858 satnogs-client[3038]: [DEBUG] SoapyAirspy::setGain(1, 0, 0.000000)
Jul 31 13:20:52 satnogs858 satnogs-client[3038]: [DEBUG] setSampleRate: 3000000
Jul 31 13:20:52 satnogs858 satnogs-client[3038]: [INFO] Using format CF32.
Jul 31 13:20:52 satnogs858 satnogs-client[3038]: [DEBUG] sample type: 0, sample size 8
Jul 31 13:20:52 satnogs858 satnogs-client[3038]: [DEBUG] SoapyAirspy::hasDCOffsetMode(1, 0)
Jul 31 13:20:52 satnogs858 satnogs-client[3038]: [DEBUG] SoapyAirspy::listAntennas(1, 0)
Jul 31 13:20:52 satnogs858 satnogs-client[3038]: [DEBUG] SoapyAirspy::setAntenna(1, 0, RX)
Jul 31 13:20:52 satnogs858 satnogs-client[3038]: [DEBUG] setBandwidth: 0.000000
Jul 31 13:20:52 satnogs858 satnogs-client[3038]: [DEBUG] setBandwidth: automatic
Jul 31 13:20:52 satnogs858 satnogs-client[3038]: [DEBUG] setBandwidth: 3000000.000000 0.000000 1.000000
Jul 31 13:20:52 satnogs858 satnogs-client[3038]: [DEBUG] setBandwidth: decimation < 4
Jul 31 13:20:52 satnogs858 satnogs-client[3038]: [DEBUG] airspy_set_conversion_filter_float32() success
Jul 31 13:20:52 satnogs858 satnogs-client[3038]: [DEBUG] SoapyAirspy::activateStream() flags=0 timeNs=0 numElems=0

And the question is what does SoapyAirspy::setGain(1, 0, 0.000000) mean?

janvgils commented 11 months ago

Good catch Lars.

LarsThunberg commented 11 months ago

@ast Did you have any free time to look at this?

jh4xsy commented 7 months ago

I found the gain is hard coded in Setting.cpp.

// Default to lowest gain, probably the safest.
  setGain(SOAPY_SDR_RX, 0, 0);
  setGainMode(SOAPY_SDR_RX, 0, false);

The method SoapySDR::Device::setGain(const int dir, const size_t channel, double gain).

Using this information we can set the gain in the following way:

setGain(sdr, SOAPY_SDR_RX, 0, 9.0)