st_edits #6
|
|
@ -17,7 +17,7 @@ class Pluto(SDR):
|
||||||
"""
|
"""
|
||||||
Initialize a Pluto SDR device object and connect to the SDR hardware.
|
Initialize a Pluto SDR device object and connect to the SDR hardware.
|
||||||
|
|
||||||
This software supports the ADALAM Pluto SDR created by Analog Devices.
|
This software supports the ADALM Pluto SDR created by Analog Devices.
|
||||||
|
|
||||||
:param identifier: The value of the parameter that identifies the device.
|
:param identifier: The value of the parameter that identifies the device.
|
||||||
:type identifier: str = "192.168.3.1", "pluto.local", etc
|
:type identifier: str = "192.168.3.1", "pluto.local", etc
|
||||||
|
|
@ -34,8 +34,24 @@ class Pluto(SDR):
|
||||||
else:
|
else:
|
||||||
uri = f"ip:{identifier}"
|
uri = f"ip:{identifier}"
|
||||||
|
|
||||||
self.radio = adi.ad9361(uri)
|
# Detect MIMO capability by checking IIO channels (one-time, during init)
|
||||||
print(f"Successfully found Pluto radio with identifier [{identifier}].")
|
# Rev B: 2 channels (voltage0, voltage1) - single RX/TX only
|
||||||
|
# Rev C/D: 4 channels (voltage0-3) - dual RX/TX capable
|
||||||
|
test_radio = adi.ad9361(uri)
|
||||||
|
ctx = test_radio.ctx
|
||||||
|
dev = ctx.find_device("cf-ad9361-lpc")
|
||||||
|
|
||||||
|
if dev and len(dev.channels) >= 4:
|
||||||
|
# MIMO-capable hardware (Rev C/D)
|
||||||
|
self.radio = test_radio
|
||||||
|
self._mimo_capable = True
|
||||||
|
print(f"Successfully found MIMO-capable Pluto (Rev C/D) with identifier [{identifier}].")
|
||||||
|
else:
|
||||||
|
# Non-MIMO hardware (Rev B) - use standard Pluto driver
|
||||||
|
self.radio = adi.Pluto(uri)
|
||||||
|
self._mimo_capable = False
|
||||||
|
print(f"Successfully found Pluto (Rev B) with identifier [{identifier}].")
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"Failed to find Pluto radio with identifier [{identifier}].")
|
print(f"Failed to find Pluto radio with identifier [{identifier}].")
|
||||||
raise e
|
raise e
|
||||||
|
|
@ -74,6 +90,11 @@ class Pluto(SDR):
|
||||||
self.radio.rx_enabled_channels = [0]
|
self.radio.rx_enabled_channels = [0]
|
||||||
print(f"Pluto channel(s) = {self.radio.rx_enabled_channels}")
|
print(f"Pluto channel(s) = {self.radio.rx_enabled_channels}")
|
||||||
elif channel == 1:
|
elif channel == 1:
|
||||||
|
if not self._mimo_capable:
|
||||||
|
raise ValueError(
|
||||||
|
"Dual RX channel requested (channel=1) but hardware is not MIMO-capable. "
|
||||||
|
"Dual RX/TX requires Pluto Rev C/D. Detected hardware: Rev B (single channel only)."
|
||||||
|
)
|
||||||
self.radio.rx_enabled_channels = [0, 1]
|
self.radio.rx_enabled_channels = [0, 1]
|
||||||
print(f"Pluto channel(s) = {self.radio.rx_enabled_channels}")
|
print(f"Pluto channel(s) = {self.radio.rx_enabled_channels}")
|
||||||
else:
|
else:
|
||||||
|
|
@ -142,6 +163,11 @@ class Pluto(SDR):
|
||||||
print(f"Pluto center frequency = {self.radio.tx_lo}")
|
print(f"Pluto center frequency = {self.radio.tx_lo}")
|
||||||
|
|
||||||
if channel == 1:
|
if channel == 1:
|
||||||
|
if not self._mimo_capable:
|
||||||
|
raise ValueError(
|
||||||
|
"Dual TX channel requested (channel=1) but hardware is not MIMO-capable. "
|
||||||
|
"Dual RX/TX requires Pluto Rev C/D. Detected hardware: Rev B (single channel only)."
|
||||||
|
)
|
||||||
self.radio.tx_enabled_channels = [0, 1]
|
self.radio.tx_enabled_channels = [0, 1]
|
||||||
print(f"Pluto channel(s) = {self.radio.tx_enabled_channels}")
|
print(f"Pluto channel(s) = {self.radio.tx_enabled_channels}")
|
||||||
elif channel == 0:
|
elif channel == 0:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user