Commit graph

190 commits

Author SHA1 Message Date
Martin Braun
b8b988da11 mpm: Move parse_encoded_git_hash() to mpmutils
This function was identically implemented twice, and this removes this
duplication.
2022-11-02 11:00:17 -05:00
Aaron Rossetto
e80495654f N320: Revert PLL lock time reduction
This commit reverts the changes made in commit 81a9cc1f8 to reduce the
time for the LMK PLL to report lock status. The decision to revert the
change comes after an investigation found that reducing the overall time
to detect lock correlates with an increase in an error reported by the
TDC ('[ERROR] TDC measurements show a wide range of values!  Check your
clock rates for incompatibilities. ...  Uncaught exception in method
set_clock_source: TDC measurement out of expected range!').  Despite the
LMK PLL reporting lock status, our investigation revealed that it takes
additional time for the PLL to align the daughterboards' clocks closely
enough to pass the TDC measurement's range limit (i.e., no samples
exceeding the measurement mean +/- 500 ps). Reverting the change
increases the amount of time between achieving lock status and taking
the TDC measurements, thus greatly reducing the likelihood of the
reported error.
2022-06-03 13:58:23 -07:00
Virendra Kakade
09936d54c7 mpm: add support for lattice zbx cpld
Co-authored-by: Steven Koo <steven.koo@ni.com>
Signed-off-by: Virendra Kakade <virendra.kakade@ni.com>
2022-05-16 06:18:09 -07:00
mattprost
b8acf58798 n310: Add Filter API to n310
Add the Filter API to n3xx specifically for the AD937x device.  The TX
filter is limited to 32 taps, and the RX filter is limited to 48 taps.

This feature requires MPM version 4.2 or later on the device.

Co-authored-by: bpadalino <bpadalino@gmail.com>
Signed-off-by: mattprost <matt.prost@ni.com>
2022-04-07 13:28:02 -07:00
mattprost
a8ad4917d3 n310: Add frontend bandwidth control
Allow users to control the Mykonos frontend bandwidth settings for
Rx and Tx. Note that this operation requires the daughterboard to
re-initialize, so it may take some time. Values for frontend filter
settings were derived using ADI's AD9371 Filter Wizard.

This feature requires MPM version 4.1 or later on the device.

Co-authored-by: bpadalino <bpadalino@gmail.com>
Signed-off-by: mattprost <matt.prost@ni.com>
2022-04-07 13:28:02 -07:00
Martin Braun
a120837195 mpm: Factor out common code between E31x_db and Neon classes
These classes share a *lot* of common code, due to them both being
AD9361-based devices. This code is now factored out into a single file.
2022-03-17 14:00:06 -05:00
David Raeman
7599789f83 mpm: fix ref_locked sensor on n320
The ref_locked mboard sensor on the n320 always returned true without
querying hardware. On this device family, mboard sensor callback in
n3xx.py returns the "and" of its daughterboard LMK PLLs by querying the
get_ref_lock() function on each dboard manager. However, that function
only existed for the Magnesium daughterbaord. For the Rhodium
daughterboard, the function didn't exist and so a true value was
automatically returned.

This commit adds the get_ref_lock() implementations for Rhodium and
EISCAT daughterboards, which are identical to the implementation
already present for Magnesium.

Co-authored-by: Martin Braun <martin.braun@ettus.com>
2022-03-03 14:02:30 -06:00
Martin Braun
cd4b9cb96c mpm: rh: Minor linter cleanup 2022-03-03 14:02:30 -06:00
Martin Braun
ba00ff0cf5 Remove FSRU-related files
The FSRU (aka EISCAT) was never supported in UHD 4.0. The FPGA
repository never had the relevant files, and the block controller also
never existed. This removes all the corresponding files from MPM, as
well as some references from makefiles.
2022-02-22 14:41:19 -06:00
Martin Braun
6666f36c26 mpm: e320/e31x: Fix lo-lock sensors
The LO-locked sensors on these devices were getting routed to the MPM
API call get_lo_lock_sensor(), which takes a 'which' argument (rx or
tx). However, UHD wants to pass a 'chan' argument (0 or 1). The way the
code was structured, it would always return 'False' (LO not locked) when
the argument was neither 'rx' or 'tx'.

The solution is to add get_rx_lo_lock_sensor() and
get_tx_lo_lock_sensor(), which generate the appropriate 'which'
argument, but discard the 'chan' argument (there is only one LO per Tx
and Rx, respectively).
2022-01-10 08:02:41 -06:00
Martin Braun
edf16b3a85 e31x/e320: Amend LO-locked sensor names
In UHD 3, we had two sensors names for LO lock on these devices:
lo_lock, and lo_locked. The latter is the more standard, and is checked
in examples like rx_samples_to_file.

In UHD 4, the latter was removed without comment. This adds the sensor
back again and also updates the documentation accordingly.
2022-01-10 08:02:41 -06:00
Martin Anderseck
393ab38853 mpm: Fix handling of rfic_digital_loopback argument
In mpm arguments are handled as key=value pairs. Therefore setting
rfic_digital_loopback to 0 should disable the digital data loopback
inside the RFIC on N310. This fixes this behavior by correctly casting
from string to boolean but keeps the full re-init sequence when using
the rfic_digital_loopback flag.
2021-10-12 12:56:15 -07:00
michael-west
81a9cc1f87 N320: Reduce PLL lock time
- Reduce PLL1 DLD lock count to 4,000 (0xFA0), or 100ms
- Change loop to check for lock every 10ms

Signed-off-by: michael-west <michael.west@ettus.com>
2021-08-16 15:42:05 -05:00
Martin Braun
99bb7b2127 mpm: zbx: Fix revision compat check
The revision compat check for ZBX hardware is broken. It requires the
rev_compat register to read 1. However, that is the value for RevA,
which we are deliberately *not* supporting.

Supported revisions are B and C, which have a rev_compat value of 2. We
therefore change the check to support revision 2, but not 1. In the
future, we would support revisions 2 and up if there are more revs to
ZBX. Valid rev_compat values are tracked in a whitelist (which we need
to update as we produce more revisions).

This patch fixes an issue where MPM wouldn't start when ZBX revisions
B or C are plugged in.
2021-07-08 00:19:19 -07:00
Lars Amsel
2a575bf9b5 uhd: Add support for the USRP X410
Co-authored-by: Lars Amsel <lars.amsel@ni.com>
Co-authored-by: Michael Auchter <michael.auchter@ni.com>
Co-authored-by: Martin Braun <martin.braun@ettus.com>
Co-authored-by: Paul Butler <paul.butler@ni.com>
Co-authored-by: Cristina Fuentes <cristina.fuentes-curiel@ni.com>
Co-authored-by: Humberto Jimenez <humberto.jimenez@ni.com>
Co-authored-by: Virendra Kakade <virendra.kakade@ni.com>
Co-authored-by: Lane Kolbly <lane.kolbly@ni.com>
Co-authored-by: Max Köhler <max.koehler@ni.com>
Co-authored-by: Andrew Lynch <andrew.lynch@ni.com>
Co-authored-by: Grant Meyerhoff <grant.meyerhoff@ni.com>
Co-authored-by: Ciro Nishiguchi <ciro.nishiguchi@ni.com>
Co-authored-by: Thomas Vogel <thomas.vogel@ni.com>
2021-06-10 12:01:53 -05:00
mattprost
38980b2e49 mpm: mg: periphs: Read lowband lo lock status from cpld
Fix the issue where N310 did not correctly read the lo lock status
from the cpld.

Signed-off-by: mattprost <matt.prost@ni.com>
2021-04-19 12:42:33 -05:00
Toni Jones
1a9033b3e9 mpm: Add DboardIface for MB DB driver control
Add DboardIface class which will act as an interface to bridge the gap
between MB and DB drivers in MPM. The DboardIface will be implemented
by each Motherboard with MB specific information. Dboard objects
will then instantiate the class in order to utilize the implemented
control functions.
2021-03-04 12:09:39 -06:00
Samuel O'Brien
bfff8b79b9 sim: Add Daughterboard Methods
This commit adds daughterboard simulation to the simulator. There is a
sim_dboard class which registers it's methods with the rpc server. These
methods are visible over mpm as well as the mpm_shell.

Signed-off-by: Samuel O'Brien <sam.obrien@ni.com>
2020-10-07 15:29:19 -05:00
Martin Braun
31cafbb3ed rh: Enable inverse sinc filter for DAC37J82
This enables the inv_sinc_ab and inv_sinc_cd flags for the DAC,
turning on the inverse sinc filter.
2020-08-12 15:19:56 -05:00
Steven Koo
e244764ffa mpm: Look for pca953x based devices by device/name
The pca953x driver introduced a change for how the "label" property
populates. Instead of using the device model, it gives a device specific
name. As a replacement, use device/name. This affects the tca6424
and tca6408.

For the kernel change that causes this see:
5128f8d445
2020-06-11 10:39:05 -05:00
Martin Braun
1c3c7bddff mpm: mg: Make set_master_clock_rate() an async call
The ad9371 call set_master_clock_rate() can take a while depending on
the rate change, so make it asynchronous in order not to lock out the
reclaimer loop.
2019-11-26 12:21:35 -08:00
Martin Braun
14fb3cc6f4 e310: Fix issues in MPM and UHD
- Remove superfluous INFO logging
- Improve formatting in many places
- Improve Pylint score in various places
- Add tear_down to DB object
- Simplify custom EEPROM code for E310
- Fix time source selection code
- Remove references to GPS_CTRL and GPS_STATUS (are E320 only)
- Move clock source control out of MboardRegs object
2019-11-26 12:21:33 -08:00
Martin Braun
d60e4d87d8 mpm: Clean up code, improve Pylint score
Many small cleanups:
- Fix copyright headers
- Fix superfluous imports
- Pull some constants out of classes where appropriate
- Fix formatting
- Improve/fix some docstrings
- Disable specific Pylint warnings where appropriate
- Global catches use BaseException instead of Exception
- Don't use len() for empty checks
- Make sure to declare all self attributes in __init__ (note: this is
  particularly of interest for E310, becuase its regular init happens
  outside of __init__)
- Compacted some E310 code that had multi-DB checks
2019-11-26 12:21:33 -08:00
Martin Braun
c256b9df65 x300/mpmd: Port all RFNoC devices to the new RFNoC framework
Co-Authored-By: Alex Williams <alex.williams@ni.com>
Co-Authored-By: Sugandha Gupta <sugandha.gupta@ettus.com>
Co-Authored-By: Brent Stapleton <brent.stapleton@ettus.com>
Co-Authored-By: Ciro Nishiguchi <ciro.nishiguchi@ni.com>
2019-11-26 12:16:25 -08:00
Martin Braun
227fe34217 n3xx: mg: Make set_freq() call asynchronous
This does not change the MPM/UHD API, but it makes the set_freq() call
asynchronous on the MPM side. The upside is that it will release the GIL
if the set_freq() call takes too long, e.g., because of MPM
calibrations.
2019-08-22 10:35:13 -07:00
Martin Braun
78f453f8b5 mpm: mg: Only import AD9371 API calls if not yet on Magnesium
This will avoid importing API calls from the self.mykonos object onto
the Magnesium class if the Magnesium class already has such a method.
2019-08-22 10:35:13 -07:00
Sugandha Gupta
178b35569b e310/e320: Move E310 to MPM architecture and refactor
- Turns the E310 into an MPM device (like N3xx, E320)
- Factor out common code between E320 and E310, maximize sharing between
  the two devices
- Remove all pre-MPM E310 code that is no longer needed
- Modify MPM to remove all existing overlays before applying new ones
  (this is necessary to enable idle image mode for E310)

Co-authored-by: Virendra Kakade <virendra.kakade@ni.com>
Signed-off-by: Virendra Kakade <virendra.kakade@ni.com>
2019-05-01 15:17:23 -07:00
Martin Braun
2a4f196068 mpm: rhodium: Fix clock value log formatting
Before, the log messages would occasionally print 6 digits worth of
precision for sample clock values that only require 2.
2019-02-22 16:12:23 -08:00
Martin Braun
0c658067bd mpm: rhodium: Fix typo in log message 2019-02-22 09:20:10 -08:00
Martin Braun
94bc1897c9 mpm: n320: Properly check for the LO distribution board
Without this patch, the N320 code will rely on an error to occur to
determine the non-existence of the N321 LO distribution board. While
this works, it forces an error message where there's no error. This will
first check for the existence of the board before trying to initialize
it.
2019-02-19 15:33:05 -08:00
Alex Williams
10ad1a6626 mpm: Fix up Rhodium EEPROM handling for BfrfsEEPROM
Fixes Rhodium for changes introduced in b7bab6a. The constructor call
for BfrfsEEPROM didn't match the signature, and Rhodium's EEPROM map
referred to the wrong revision.
2019-01-23 13:21:15 -08:00
Martin Braun
9e14b14485 rhodium: Fix some Pylint warnings
Remove some semicolons and superfluous imports.
2019-01-21 13:41:22 -08:00
Mark Meserve
ec0b4dd127 rh: general code cleanup
- Add default bandwidth range
- Add default mash order constant
- Delete MPM todos
- Cleanup whitespace in MPM python code
- Add docstring for is_lo_dist_present
2019-01-10 09:50:16 -08:00
Martin Braun
b7bab6a44f mpm: Factor out user EEPROM code into own module
Affects Magnesium and Rhodium classes, which where duplicating this
code.
2018-12-20 14:57:54 -08:00
Ryan Marlow
5a5f604994 uhd/mpm: eiscat: Various changes
- correct lmk initialization parameters
- adding missing parameters and consts wrt clock synchronization.
- fixed default master clock rate
- eiscat, ddc: update xml.
 - remove references to CORDIC_FREQ in ddc_eiscat
 - update readback reg addr in radio_eiscat
 - set default spp from 3992 to 3968.
- updated jesd mode sequence initialization
- updating eiscat_radio_ctrl_impl
 - add rx_codecs to property tree to display correct ADC chip.
 - updated issue_stream_cmd
2018-12-19 09:36:51 -08:00
Mark Meserve
22836d65e7 rh: remove polarity setting for sdclkout11
- output 11 is unused, a value of 0 will leave the polarity as normal
2018-12-12 16:27:25 -08:00
Mark Meserve
75ee8e0314 rh: add functions to toggle lowband lo 2018-12-12 16:27:25 -08:00
Humberto Jimenez
3c134a2941 rh: Enable clock synchronization error checking 2018-11-29 11:38:43 -08:00
Alex Williams
a8ae5d433b mpm: rh: Remove n321 overlay
The n321 overlay is no longer needed. The devices have been added to the
n320 overlay because the kernel cannot tear down multiple overlays
reliably.
2018-11-27 16:45:23 -08:00
Humberto Jimenez
f36a8dd853 rh: Fix update_ref_clock_freq() to update init args
The update_ref_clock_freq() procedure now updates the self._init_args
value of the Rhodium class daugtherboard objects in MPM to propagate
the latest user-selected arguments for future reference.
2018-11-26 13:34:01 -08:00
Mark Meserve
e8143acd3e rh: fix typo in set_clk_safe_state 2018-11-16 15:18:54 -08:00
Martin Braun
a69ab0c23a cmake: Update coding style to use lowercase commands
Also updates our coding style file.

Ancient CMake versions required upper-case commands.  Later command
names became case-insensitive.  Now the preferred style is lower-case.

Run the following shell code (with GNU compliant sed):

cmake --help-command-list | grep -v "cmake version" | while read c; do
  echo 's/\b'"$(echo $c | tr '[:lower:]' '[:upper:]')"'\(\s*\)(/'"$c"'\1(/g'
done > convert.sed \
&& git ls-files -z -- bootstrap '*.cmake' '*.cmake.in' \
'*CMakeLists.txt' | xargs -0 gsed -i -f convert.sed && rm convert.sed

(Make sure the backslashes don't get mangled!)
2018-11-14 14:10:09 -08:00
Mark Meserve
930bd09457 rh: change uio access to utilize with-as 2018-11-12 16:08:34 -08:00
Alex Williams
2493f31820 mpm: rh: Add MAX 10 update script 2018-11-07 09:39:18 -08:00
Mark Meserve
728d9abfe7 rh: add lo distribution support
- This is a combination of 5 commits.
- rh: add lo distribution board gpio expander
- rh: add lo distribution mpm functions
- rh: add code to conditionally initialize lo distribution
- rh: change empty i2c device from exception to assertion
- rh: add lo distribution board control
2018-11-05 13:43:07 -08:00
Mark Meserve
77bd367016 rh: disable lmk test output
- Improves spur performance
2018-10-30 10:13:59 -07:00
Humberto Jimenez
5c9c7b3dd3 rh: Phase DAC configuration clean-up
- Confirmed the Phase DAC to be initialized at mid-scale.
- Confirmed the Phase DAC step resolution for fine clock shifting.

The clock synchronization algorithm relies on the Phase DAC to fine
shift the sampling clocks on each daughterboard.

Only a certain number of DAC codes are required for the actual clock
adjustment, thus a different range of codes may be chosen by
initializing the Phase DAC with a given value. With the selected range,
one may measure the Phase DAC's linearity and step resolution, which
defines how many steps are required when performing the fine shifting
of the clocks.

After initializing the 16-bit Phase DAC at 25%, 50% (mid-scale), and
75%; it was found that the clock distribution PLL locks relatively
faster when using mid-scale (2^15). By testing the Phase DAC's
linearity, it was confirmed that the circuit resolution is 1.11 ps per
code.
2018-10-30 09:57:55 -07:00
Humberto Jimenez
eb4a609ec8 rh: Deterministic latency optimization in JESD204B
- Optimized JESD204B RX/TX links' latency.
- Made JESD latency constant across supported frequencies.
- Checking RX SYSREF capture in the FPGA deframer block.

The JESD204B standard can be linked in such a way to produce a
repeatable, deterministic delay from the framer to deframer. This is
accomplished by setting up a LMFC (local multiframe clock) in both
devices.

The LMFCs are reset whenever a SYSREF edge is captured by the framer
and deframer. Therefore, it is simple to control the LMFC rising edges
in each device by implementing variable delay elements on the SYSREF
pulses to the framer and deframer.

Latency across the JESD204B TX/RX links should remain constant and
deterministic across the supported sampling_clock_rate values. By
testing the roundtrip latency (i.e. FPGA -> TX -> RX -> FPGA) with
different delay values in the FPGA, one may decrease the latency and
provide enough setup and hold margin for the data to be transfered
through each JESD link.

It was found that a different set of SYSREF delay values are required
for sampling_clock_rate = 400 MSPS to match the latency of the other
supported rates.
2018-10-30 09:57:55 -07:00
Mark Meserve
d87ae61d04 rh: add support for rhodium devices
Co-authored-by: Humberto Jimenez <humberto.jimenez@ni.com>
Co-authored-by: Alex Williams <alex.williams@ni.com>
Co-authored-by: Derek Kozel <derek.kozel@ni.com>
2018-10-25 10:30:59 -07:00
Mark Meserve
fad36514e5 nijesdcore: add variable configuration support 2018-10-25 10:30:59 -07:00