ericek111 / libmirisdr-5

Support of Mirics MSi001 + MSi2500 SDR devices
GNU General Public License v2.0
27 stars 9 forks source link

Antenna selection #3

Open zaninime opened 1 year ago

zaninime commented 1 year ago

I own a SDRPlay RSPdx that features three antenna ports. The library here mostly works fine with a simple addition to the device list, but it is lacking the antenna selection feature, as far as I can tell.

Things I tested:

This is my current output from the device probing command:

Probe device
[INFO] Opening SDRplay RSPdx :: 00000001...

----------------------------------------------------
-- Device identification
----------------------------------------------------
  driver=MIRI
  hardware=RSP1
  index=0
  origin=https://github.com/ericek111/SoapyMiri

----------------------------------------------------
-- Peripheral summary
----------------------------------------------------
  Channels: 1 Rx, 0 Tx
  Timestamps: NO
  Other Settings:
     * Offset Tune - MiriSDR Offset Tuning Mode
       [key=offset_tune, default=false, type=bool]
     * Bias Tee - GPIO8 pin enable (bias tee)
       [key=biastee, default=false, type=bool]
     * HW flavour - HW variant of the RSP1
       [key=flavour, default=false, type=string, options=(Default, SDRplay)]

----------------------------------------------------
-- RX Channel 0
----------------------------------------------------
  Full-duplex: NO
  Supports AGC: YES
  Stream formats: CS16, CF32
  Native format: CS16 [full-scale=65536]
  Stream args:
     * Buffer Size - Number of bytes per buffer, multiples of 512 only.
       [key=bufflen, units=bytes, default=36864, type=int]
     * Ring buffers - Number of buffers in the ring.
       [key=buffers, units=buffers, default=15, type=int]
     * Async buffers - Number of async usb buffers (advanced).
       [key=asyncBuffs, units=buffers, default=0, type=int]
  Antennas: RX
  Full gain range: [0, 206] dB
    Automatic gain range: [0, 103, 1] dB
    LNA gain range: [0, 1, 1] dB
    Baseband gain range: [0, 59, 1] dB
    Mixer gain range: [0, 19, 19] dB
    Mixbuffer gain range: [0, 24, 6] dB
  Full freq range: [0, 2000] MHz
    RF freq range: [0, 2000] MHz
  Sample rates: 1.3, 1.536, 2.048, 5, 6, 7, 8, 9, 10, 12 MSps
  Filter bandwidths: 0.2, 0.3, 0.6, 1.536, 5, 6, 7, 8 MHz

If you have any pointers how to make this a reality, it would be highly appreciated.

zaninime commented 1 year ago

Hey @ericek111, do you have any idea on this one?

ericek111 commented 1 year ago

Looking at some PCB photos I found online and the binary API, I think the inputs are switched using a GPIO extender connected to the MSI.2500. I'm a little bit afraid that the other tuner would need to be initialized from scratch: https://www.sdrplay.com/wp-content/uploads/2018/05/RSPduo-Introduction-V3.pdf

So, it seems you'd need to write 0xRRVV4940, with RR being the register (0x13 for reg. 16) and VV being the bitfield set accordingly:

reg19, RSP1A:
(1 << 0) : DAB notch
(1 << 2) : broadcast notch, 1 for disable
(1 << 4) : biasT

reg19, RSP2:
(1 << 0) : biasT
(1 << 6) : notch
(1 << 7) : notch

reg18, RSP2:
(1 << 0) : ant
(1 << 1) : ant
(1 << 2) : ant
(1 << 6) : external reference

reg18, rspdx:
(1 << 1) : bias T
(1 << 2) : antenna 1
(1 << 3) : antenna 2
(1 << 4) : broadcast notch
(1 << 7) : DAB notch
zaninime commented 1 year ago

Thanks a lot for the answer and sorry for the long delay, at the moment this is out of reach for me. I'd leave the issue open for posterity, but I can't pursue this any further right now.

dashxdr commented 8 months ago

Do you have any pointers to MSI2500 documentation? The libmirisdr-5 code doesn't have any headers... and it just writes magic hex values into registers. The MSI001 is pretty well documented.

I have a slightly different version of the msi-sdr, the frequency bands + tuning don't match the two existing "flavours" and I'd like to add support for it.

I'm messing with it and keep running into awful frequency aliasing... I'm trying to grab 8 mhz samples to scan a large swath of RF space, but unless I choose a decent LO frequency it's a mess... I think I need to choose sample rate and LO frequency together to avoid as many aliased frequencies as possible... but the MSI2500 handles the sampling and it's not clear how to program it.

Any advice or suggestions would be greatly appreciated!