pothosware / SoapyPlutoSDR

Soapy SDR plugin for PlutoSDR
https://github.com/pothosware/SoapyPlutoSDR/wiki
GNU Lesser General Public License v2.1
58 stars 22 forks source link

Support for DC Block Option #21

Closed unixpunk closed 4 years ago

unixpunk commented 5 years ago

Hi, thanks for the work here and with SoapySDR in general! I'm looking for some guidance on options I can (or can't) pass through using rx_sdr's new -t option. I'm looking to do DC spike removal and offset tuning. Thanks in advance!

unixpunk commented 5 years ago

[-t SDR settings (ex: rfnotch_ctrl=false,dabnotch_ctrlb=true)]

unixpunk commented 5 years ago

I tried pass some of these options and did not see a change in the result in the output running again while an rx stream was active:

# iio_attr -q -i -c ad9361-phy voltage2 dev 'ad9361-phy', channel 'voltage2' (input), attr 'bb_dc_offset_tracking_en', value '1' dev 'ad9361-phy', channel 'voltage2' (input), attr 'filter_fir_en', value '1' dev 'ad9361-phy', channel 'voltage2' (input), attr 'gain_control_mode_available', value 'manual fast_attack slow_attack hybrid' dev 'ad9361-phy', channel 'voltage2' (input), attr 'offset', value '57' dev 'ad9361-phy', channel 'voltage2' (input), attr 'quadrature_tracking_en', value '1' dev 'ad9361-phy', channel 'voltage2' (input), attr 'raw', value '1072' dev 'ad9361-phy', channel 'voltage2' (input), attr 'rf_bandwidth', value '200000' dev 'ad9361-phy', channel 'voltage2' (input), attr 'rf_bandwidth_available', value '[200000 1 56000000]' dev 'ad9361-phy', channel 'voltage2' (input), attr 'rf_dc_offset_tracking_en', value '1' dev 'ad9361-phy', channel 'voltage2' (input), attr 'rf_port_select_available', value 'A_BALANCED B_BALANCED C_BALANCED A_N A_P B_N B_P C_N C_P TX_MONITOR1 TX_MONITOR2 TX_MONITOR1_2' dev 'ad9361-phy', channel 'voltage2' (input), attr 'sampling_frequency', value '1249999' dev 'ad9361-phy', channel 'voltage2' (input), attr 'sampling_frequency_available', value '[520833 1 61440000]' dev 'ad9361-phy', channel 'voltage2' (input), attr 'scale', value '0.305250'

zuckschwerdt commented 5 years ago

You are spot on. The API isn't supported in SoapyPlutoSDR. I'll add the support now.

zuckschwerdt commented 5 years ago

Would you be looking for attributes in other chips/channels besides ad9361-phy voltage2? Not sure which values to pass through as device default

zuckschwerdt commented 5 years ago

s.a. #22

guruofquality commented 5 years ago

Typically there is a hasDCOffsetMode() an set/getDCOffsetMode(). If there is a rx dc removal, then set/get is missing: https://github.com/pothosware/SoapyPlutoSDR/blob/master/PlutoSDR_Settings.cpp#L192

zuckschwerdt commented 5 years ago

The PlutoSDR has

iio:device1: ad9361-phy
        voltage0:  (input)
            attr  0: bb_dc_offset_tracking_en value: 1
            attr  9: rf_dc_offset_tracking_en value: 1
        voltage2:  (input)
            attr  0: bb_dc_offset_tracking_en value: 1
            attr  8: rf_dc_offset_tracking_en value: 1

I'm not sure what those attributes control though?

zuckschwerdt commented 5 years ago

Work in #22 is very early but should already give access to:

unixpunk commented 5 years ago

Thanks! After some more testing this weekend, I'm not even sure if/how these options will help in my ultimate need to avoid the dc spike because they're all always 1 anyway when using rx_sdr...I'm not sure if its the offset value that needs changing or if there is another device aside from the 9361 that might have other options. SoapySDRUtil --probe shows the pluto as having DC Removal, but not really sure what that means, i.e., is it hw-based? (I can find no evidence of that, and by the way my question here was answered, sounds like it has to be done in sw or an offset needs to be changed along with the dc offset options being set to 1? https://ez.analog.com/university-program/f/q-a/108619/where-to-find-plutosdr-specific-driver-level-settings-i-e-dc-block )

zuckschwerdt commented 5 years ago

Try iio_info -a and look around the attributes if something interesting stands out. The attributes listed above are the ones I found to perhaps be useful. Both mentioned in your linked question are available, but anyway set to enabled by default (at least for me).

The reported DC Removal is a fixed information not a reading.

unixpunk commented 5 years ago

Sorry for delay in testing..I'm not actually seeing the option stick on the device.

For example: rx_sdr -f 98700000 -g 73 -t filter_fir_en=0 /dev/null still shows 'filter_fir_en', value '1' in iio_attr.

Is there a way I can test this without rx_sdr to confirm this portion is good? Then if need-be I can open an issue for rx_tools.

zuckschwerdt commented 4 years ago

Please reopen if there is again interest in this and more testing has been done.