Commit Graph

74 Commits

Author SHA1 Message Date
Abhishek Verma
b1e77b24e4 mpm: Add rtnetlink-driven xport_info cache invalidation
-Add gevent rtnetlink listener for interface and IP changes.
-Refresh cached transport info immediately after network changes.
-Extend x4xx cache TTL to 300 seconds with epoch-based invalidation.
2026-10-08 09:40:00 +02:00
Abhishek Verma
5745c8a640 mpm: x4xx: cache xport_info to speed up GetDeviceInfo
get_xport_info() enumerates network interfaces via netlink/pyudev on every
GetDeviceInfo call (~350ms, non-yielding). Since GetDeviceInfo is
unclaimed and gets flooded during discovery, this could starve claimed
RPCs past their short deadlines like 2 seconds.

Cache the result for 10s (X400_XPORT_INFO_CACHE_TTL); it's stable per
session, and init() drops the cache since IPs may change. This turns most
GetDeviceInfo calls much faster.

Add a dedicated lock for the xport_info_cache so concurrent
GetDeviceInfo calls don't race on refresh/invalidations
2026-10-08 09:40:00 +02:00
Max Becker
b1e4016c2b mpm: Update X4xx GPIO SPI support
Update MPM GPIO handling for the updated X4xx GPIO SPI register
interface.

Require the FPGA compatibility number bump introduced with the new
SPI support so MPM does not operate against an incompatible FPGA image.

Bump MPM compat number.
2026-09-29 13:12:32 +02:00
Jörg Hofrichter
d539960867 mpm: use flag locked_fpga=True for L variant devices 2026-08-25 22:03:46 +01:00
Jörg Hofrichter
aa2665d6f4 mpm: print error if loading FPGA bitstream failed 2026-08-10 16:40:53 +02:00
Jörg Hofrichter
6284863e14 mpm: handle bootgen generated .bin files
- Verify signature in case the device does not support customizable
  FPGA (just as sanity check before actual loading the bitstream).
- Extract the bitstream from the bootgen generated .bin file
  otherwise.
2026-08-10 16:40:53 +02:00
Jörg Hofrichter
294ced36f6 mpm: x4xx: l device only supports "bin" file extension for FPGA 2026-08-10 16:40:53 +02:00
Jörg Hofrichter
a58a06f50c mpm: x4xx: add l variant PIDs 2026-08-10 16:40:53 +02:00
Abhishek Verma
e24b1cb8bb host/mpm: replace mpRPC with gRPC transport
host:
Replace the msgpack-RPC (rpclib) client with a gRPC-based
implementation. Add auto-generated C++ client and Python bindings
from protobuf definitions. Remove rpclib dependency and integrate
FindgRPC into CMake.

mpm:
Replace the msgpack-RPC server with a gRPC server generated from
protobuf definitions. Add pb_utils.py for type conversion between
Python and protobuf. Update rpc_server.py to dispatch calls via
gRPC stubs. Update mpm_shell to use gRPC. Replace pyudev with sysfs
scan in uio device discovery.

Bump MPM compatibility number to 7.0 and RPC version to 2.

This change requires new depedencies. E.g. for Ubuntu 24.04 or 25.10:
libgrpc++-dev, libprotobuf-dev, protobuf-compiler-grpc, python3-grpcio
2026-07-09 12:12:04 +02:00
Jörg Hofrichter
8d2addaf1f mpm: HwmonTempSensors: fix double listed temp sensors, et. al.
- Fix double-listed temp sensors
- Implement mapping fan1_input -> fan0, etc. to remain backward
  compatibility
- add function to read sensor names
2026-06-25 14:47:14 +02:00
Bjoern Bachmann
d468872d40 mpm: refactor thermal/fan sensor handling with unified hwmon/sysfs abstraction
Introduce HwmonTempSensors (sysfs_hwmon.py) and refactor
SysfsThermalSensors (sysfs_thermal.py) to enumerate available sensors
once at construction time and cache device references in a sensor_map
dict, avoiding repeated udev context creation and device-tree walks on
every readout.

HwmonTempSensors supports the cros-ec hwmon subsystem and accepts a
sensor_list parameter to discover both temp and fan sensors. A new
read_fan_sensor_value() method is added alongside the existing
read_thermal_sensor_value(). Multiple subsystems (hwmon, iio) and
sensor formats are supported via a read_sysfs_sensors_value() utility.

SysfsThermalSensors is extended to support multiple subsystems (IIO
and thermal) and a data_probe parameter for flexible attribute reading.
A read_fan_sensor_value() method is added to match the hwmon interface.

Both classes expose the same read_thermal_sensor_value(sensor_names,
reduce_fn) interface, making them interchangeable at the call site.

All affected peripheral managers are updated:
- E320: updated to use the new sensor abstraction pattern
- N3xx: refactored temp and fan sensor methods for hwmon/thermal backends
- X4xx: unified _temp_fan_sensors handle with hwmon/thermal dispatch,
  add missing HwmonTempSensors import
- E310: add dynamic MB temperature sensor type detection instead of
  hardcoding "jc-42.4-temp", fixing usrp_list_sensors compatibility

A _hwmon_based_sensors flag at init time selects the correct backend
for fan and temperature reads on all platforms.
2026-06-25 14:47:14 +02:00
Martin Braun
fa0c49e074 mpm: x4xx: Add sticky LMK DLD bits back as ref_stable sensor
This adds a new sensor called `ref_stable` to the X4xx series. Unlike
`ref_locked`, which only checks the current ref-lock status, this will
also query the sticky bits of the LMK04832 lock-detect circuitry, and
then clear them. This allows checking if ref-lock was lost any time
between queries to the `ref_stable` sensor (unlike the `ref_locked`
sensor, which queries the current ref-lock status).
2026-06-12 15:19:41 +02:00
Martin Braun
2e7ec477cd mpm: x4xx: Make ref-lock sensor non-sticky
This changes the LMK04832 class to only optionally (and not always)
check the sticky LD_LOST flags in the 0x182 lock-detect register of the
LMK04832. As a result, the ref_locked sensor will now only return the
current lock status of this PLL, and the ref-locked LED
2026-06-12 15:19:41 +02:00
Max Köhler
dc6323fa9a mpm: Add support for USRP X420 (20 GHz USRP)
This adds support for the new USRP X420. It is the latest addition to
our X4xx series and comes with two HBX daughterboards. The HBX is
a one-channel direct conversion transceiver that covers 5G NR FR3 and
X-/KU-Band needs for Research and Prototyping in a frequency range of 10
MHz up to 20 GHz. It supports analog bandwidths of up to 1 GHz.

This commit is the MPM portion of the X420 support.

Co-authored-by: Martin Anderseck <martin.anderseck@emerson.com>
Co-authored-by: Ahmed Salman <ahmed.salman@emerson.com>
Co-authored-by: Max Köhler <max.koehler@emerson.com>
Co-authored-by: Markus Schill <markus.schill@emerson.com>
2026-03-20 16:14:33 +01:00
Martin Anderseck
5bd1cf3459 mpm: Enable sub-channels per channel
With this change, it is possible to have different sub-channels within
one channel to serve different purposes. For instance it is possible to
have one converter run in Real mode while two other converters serve I
and Q respectively. They all count as the same channel for UHD and the
driver software needs to take care to switch between them if required.
For the IQ architecture we also disable the NCO in the RFDC.
2026-03-09 16:13:22 +01:00
Martin Anderseck
14d215665c mpm: Move tile startup after DB startup
This moves the ADC/DAC tile startup after the daughterboard power-up.
Reason for this is that especially the ADC needs silence when starting
up as it runs its foreground calibration then. If during that time the
daughterboards are not yet powered up we cannot guarantee that which
might impact the noise floor. To move the tile startup, it was factored
out into a (re)start method.
2026-02-19 16:50:06 +01:00
Jörg Hofrichter
e147f1e134 mpm: apply "ni-python-styleguide fix" to usrp_mpm 2026-02-04 14:02:15 +01:00
Max Köhler
894ecb691e mpm: bump FPGA compat number to 10.0 2025-03-20 09:07:06 +01:00
Max Köhler
f9ed6b2286 mpm: x400: apply linting to x4xx.py 2025-02-12 14:38:08 +01:00
Max Köhler
4111fdf431 mpm: x400: bump FPGA compat version to 9.0 2025-02-12 14:38:08 +01:00
NIDvoez
3975a4d049 mpm: add additional temperature sensor readings for x4xx
Add functions to read the temperature sensors of the following
components:

- main power (PMBUS 0 and 1)
- sample clock (SPLL)
- DRAM
- TMP464
- Power supply PCB
2024-12-02 12:24:46 +01:00
Max Köhler
670c8a2fe7 mpm: apply python styleguide on x4xx.py 2024-09-18 16:56:32 +02:00
Max Köhler
76e183d3f0 mpm: adding debug access to the RFDC registers 2024-09-18 16:56:32 +02:00
Joerg Hofrichter
ba5028cf57 mpm: avoid importing from rpc_server when importing usrp_mpm
Importing from usrp_mpm.rpc_server imports a lot of dependencies which are
unnecessary if the rpc_server functionality is not actually needed.

Move the decorator functions to a new file rpc_utils.py and import only
from this file inside periph_manager.

usrp_hwd.py needs additional dependencies which are specifically imported:
- usrp_mpm.rpc_server.spawn_rpc_process
- usrp_mpm.discovery.spawn_discovery_process
2024-06-11 10:20:08 +02:00
Martin Braun
ad5f97f828 fpga/mpm: x4xx: Add device DNA read capability
- Bumps FPGA compat from 8.2 to 8.3
- Adds three global motherboard registers to read the 96-bit device DNA
- MPM is updated to read these registers and update the device_info if
  compat version 8.3 is available
2024-06-11 10:20:07 +02:00
Javier Valenzuela
7b762b36d0 mpm: x400: Align FPGA revision 2023-10-30 11:22:00 -05:00
Javier Valenzuela
de2eaf3d1a mpm: x400: match HDL PPS updates 2023-10-27 09:20:14 -05:00
Grant Meyerhoff
5da051fffa x4xx: pass reboot mpm command to host on new clock config for x440 2023-09-06 10:09:36 -05:00
michael-west
f2b5e9cd1e MPM: Normalize name for gps_locked sensor
Change all references to "gps_lock" to "gps_locked" for consistency
across the code base.  Fixes incorrect use of "gps_lock" for the sensor
name on X4xx.

Signed-off-by: michael-west <michael.west@ettus.com>
2023-08-31 15:19:12 -05:00
Martin Anderseck
b3b5e69b02 SelfCal: Trigger if clocking has changed
This change ensures that ADC selfcal is triggered during session start
if the clocking was reconfigured. So it saves time if several
consecutive sessions are opened with always the same settings.
It also makes the ADC self cal run if in an open session either
set_clock_source(), set_time_source() or set_sync_source() are called
and a clock reconfiguration was triggered by that.
2023-07-07 12:35:55 -07:00
Martin Braun
cd754412e7 mpm: x4xx: Remove internal_temp_sensor
This sensor is undefined and not connected. It probably got into the
codebase by accident or copy&paste.
2023-06-30 10:42:30 -05:00
Martin Braun
371c4c139c mpm: Add support for X440/FBX
Co-authored-by: Lars Amsel <lars.amsel@ni.com>
Co-authored-by: Martin Anderseck <martin.anderseck@ni.com>
Co-authored-by: Virendra Kakade <virendra.kakade@ni.com>
Co-authored-by: Javier Valenzuela <javier.valenzuela@ni.com>
2023-06-12 10:27:29 -05:00
Martin Braun
50f7d064ea mpm: x4xx: Enable DBs to have updateable_components
This adds an updateable_components overridable dictionary into the
daughterboards base class.

On X410, because some of the FPGA compatibility stems from DB-specific
components, they are moved into class ZBX.
2023-06-06 16:11:36 -05:00
Javier Valenzuela
c1d268917e mpm/fpga: x4xx: Major updates in preparation for future devices
FPGA:
- Split up MB registers that control daughterboard specific settings so
  that daughterboards 0 and 1 could have different setings, in
  preparation for future devices that require different settings.
  This requires a compat number bump to 8.0.
- Add registers for additional RFDC information, including the
  block/tile mapping of the individual channels, and information about
  resampling capabilities
- Identify sections of code that would be specific to X410/ZBX and move
  them to their own headers, so it's trivial to add device-specific
  sections of code instead for other devices in the future.
  - This includes constraints for clocks and I/O pins.
- Remove ability to do timed ctrlport transactions to the MB CPLD, this
  was unused and possibly broken.
- Move daughterboard-specific code into its own code location
  (dboards/zbx)
- Move X410-specific register documentation to its own location
  (doc/X410)
- Refactor Makefiles to split out X410/ZBX specific components and allow
  switching between device types
- Add 512-bit AXI interconnects
- Make number of timekeepers configurable (X410 keeps the single
  timekeeper)

MPM:
- Required compat is bumped to 8.0
- Now supports new registers for detecting DSP capabilities and
  multi-rate settings for the daughterboards
- Adds MMCM controls (currently unused)

Co-authored-by: Wade Fife <wade.fife@ni.com>
Co-authored-by: Ryan Marlow <ryan@lmarlow.com>
Co-authored-by: Martin Braun <martin.braun@ettus.com>
Co-authored-by: Humberto Jimenez <humberto.jimenez@ni.com>
2023-05-23 09:06:17 +02:00
Martin Braun
d398a02da7 mpm: x4xx: Prepare clock management for multi-mcr
This by itself does not enable dual-rate (or multi-mcr), but it
refactors the code to enable it in the future. Additional changes may be
required.

X4xxClockMgr is renamed to X4xxClockManager.
2023-05-20 11:12:51 -05:00
Martin Braun
cf1b65143d mpm: x4xx: Let RFDC control use clock policy
Before this change, x4xx_rfdc_ctrl.py had various backdoors to read out
required settings. Now that we have the clock policy object, we can
simply read them out from there.

This obviates some code paths (get_rfdc_resampling_factor(),
get_default_mcr(), set_rfdc_reset_cb()).
2023-05-17 13:16:27 -05:00
Martin Braun
3246aec020 mpm: x4xx: Check for tear_down()'s existence
On tear_down() (this is most commonly seen by users when updating the
FPGA image), we add a check to verify that subcomponents of the X4xx are
actually initialized, to avoid displaying a non-fatal error message that
looks like this:

[ERROR] [MPM.RPCServer] Error in update_component while resetting:
    'NoneType' object has no attribute 'tear_down'

The most common/easy way to trigger this error is by loading MPM with
a bitfile that has an invalid compat number (which would stop MPM from
initializing the RFDC controls) and then running `uhd_image_loader`
(which would force a tear_down()). In that circumstance, MPM would try
to call tear_down() on an uninitialized object.
2023-05-17 13:14:35 -05:00
Martin Braun
040d4bb0df mpm: x4xx: Factor clock control out of X4xxClockManager
This splits up x4xx_clk_mgr.py into PLL controls (which go into
x4xx_clock_ctrl.py) and just clock management (which stays in
x4xx_clk_mgr.py).
2023-05-16 18:18:56 -05:00
Martin Braun
f22b392a00 mpm: x4xx: Rename 'both' argument to 'all'
All call sites that use 'both' as an argument for channel numbers now
use 'all', in preparation for daughterboards that have more than
2 channels.
2023-05-16 10:47:11 -05:00
Martin Braun
0b65839d03 x4xx: Update BIST to match clocking refactoring 2023-05-12 15:43:29 -05:00
Martin Braun
cf04329058 mpm: x4xx: Introduce X4xxClockPolicy
This new class encapsulates all clocking-related infos into a single
file and makes it easier to modify clocking settings.
2023-05-12 15:43:29 -05:00
Martin Braun
94be5df1e8 mpm: x4xx: Move all clock control to single class
All code in x4xx.py that is specific to clocking is moved to
x4xx_clk_mgr.py. All ancillary code is adapted to call APIs from the
right places.
2023-05-05 11:43:50 -05:00
Martin Braun
997d788353 mpm: x4xx: Minor preparations to x4xx.py for X440 support 2023-04-27 22:31:08 -05:00
Martin Braun
d5505e44a8 mpm: x4xx: Move get_master_clock_rate() to DB-RPC
The X4x0 device is an outlier with respect to all other MPM devices when
it comes to this API. All other MPM-devices define this API on the
daughterboard, not the motherboard.

For all the reasons laid out in dboard_manager/base.py, we move this API
call for X4x0 also into the daughterboard RPC space.

Both get_master_clock_rate() and set_master_clock_rate() are explicitly
declared @no_rpc in MPM.

This is an API breakage in the UHD/MPM communication API.
2023-03-24 16:08:30 -07:00
Martin Braun
01ccb69459 mpm: x4xx: Move MB CPLD creation to factory
Main changes:
- x4xx_mb_cpld.MboardCPLD is renamed to X4xxMboardCPLD and is now a base
  class. Specific implementations of the MB CPLD require derived classes
  and have to provide their corresponding signature.
- In x4xx.py, we don't init the MB CPLD and then assert we have
  a specific signature. Instead, we init the MB CPLD, and choose
  a derived class based on the signature. If there is no such class,
  then the same error is generated as before (by itself, this means
  there is no behavioural change).
- The MB CPLD image for the X410 (ZBX daughterboards) is moved to
  a derived class X410MboardCPLD.
- New: The ZBX daughterboard driver verifies that the MB CPLD image is
  in fact compatible with the daughterboard. For this, the MB CPLD
  control classes require a COMPATIBLE_DB_PIDS attribute.

By itself, this change has no behavioural- or API changes. However, it
allows easily slotting in new CPLD images with different signatures.
Without further modifications, it does not allow *any* CPLD image
though: The PS API (e.g., enable/disable daughterboards, CMI status,
etc.) remain the same.
2023-03-09 11:10:39 -05:00
Martin Braun
71d957df29 mpm: x4xx: Remove references to white rabbit
At least in this version of UHD, there is no White Rabbit support on
X410. The references in x4xx.py are vestigial code snippets.
2023-01-05 12:00:27 -08:00
Martin Braun
4d6b7263f5 Revert "uhd: Revert Raw UDP Host Changes"
This reverts commit 6cb1dcca83.

Raw UDP support is added back in on both MPM and UHD side.
2022-09-21 15:35:55 -07:00
Steven Koo
6cb1dcca83 uhd: Revert Raw UDP Host Changes
This reverts the Raw UDP host changes which is breaking
multiple interface streaming.

Commits addb81aa5d2d6adcd3a0c7a8d59fcd96af0c1ec4^..b1ca51f97aaa2226ed6ef339fb26fbea54ab7593
are reverted.

Reverts:
doc: Update manual on streaming
examples: Add remote RX streaming example
rfnoc: Enable remote UDP streaming
mpm: e320: Enable raw UDP streaming
mpm: n3xx: Enable raw UDP streaming
mpm: x4xx: Enable transport manager adapter
mpm: Enable opt-in transport adapter control
rfnoc: Transition stream managers and mgmt_portal to topo_graph_t
rfnoc: Add topology graph object
uhd/mpm: Add API to set remote routes
mpm: xports: Add XportAdapterMgr class
2022-09-12 17:00:19 -05:00
Steven Koo
01170bc8c5 mpm: bump fpga compat for raw udp streaming
Signed-off-by: Steven Koo <steven.koo@ni.com>
2022-08-30 13:43:36 -05:00
Martin Braun
3eef5f8cc5 mpm: x4xx: Enable transport manager adapter
This checks if the FPGA compat number is at least 7.9, and if yes,
enables the 'remote_streaming' FPGA feature.
2022-08-30 13:43:36 -05:00