Commit graph

82 commits

Author SHA1 Message Date
Brent Stapleton
d0cb6de410 mpm: PeriphManager decides and applies overlay
Previously, the daughterboard requested an overlay file based on SFP
preference using magic values. This commit moves the decision making to
the peripheral manager, which uses our singular name (ie 'n3xx' for the
N310).
2017-12-22 15:05:57 -08:00
Martin Braun
44b117be95 mpm: mg: Add ref lock sensor
Note: The sensor API for this lives in n310, but it queries the dboards
for a ref lock status, which is now no longer a stub.
2017-12-22 15:05:07 -08:00
Martin Braun
d2594f9a92 mpm: mg: Add flag to see if master clock rate is being changed
Note: On the first run, this flag will always assert.
2017-12-22 15:05:07 -08:00
Martin Braun
064faf09c3 mpm: mg: Fix linter errors, compacted SPI factories 2017-12-22 15:05:07 -08:00
Martin Braun
ee00c0384e mpm: mg: Move some class attributes to local scopes
The clock_synchronizer, jesdcore, and dboard_clk_control objects don't
need to exist for the full lifetime of the Magnesium class. Having them
around complicates management of UIO file descriptors.
2017-12-22 15:05:07 -08:00
Trung N Tran
d8ebabaa12 mpm: mg: Remove unused spi_factories key 2017-12-22 15:05:07 -08:00
Trung Tran
201761cfa6 mpm: mg: Set default master_clock_rate to 125 MHz at every init 2017-12-22 15:05:07 -08:00
Trung N Tran
2467deeb17 mpm: mykonos: Add API to change master clock rate 2017-12-22 15:05:07 -08:00
Martin Braun
f14b49ff5b n3xx: add support for 122.88 and 153.6 MHz sample clock rates
- re-wrote portions of the LMK driver for flexible rates and configuration
 - tweaked TDC driver for compatibility and ease of debugging
 - updated comments and log statements throughout for uniformity
2017-12-22 15:05:07 -08:00
Martin Braun
63f4049a10 mg: Enable variable master clock rates
The master_clock_rate argument is passed to init() during
initialization; this change allows to query the correct MCR at
initialization time. It does not allow changing the MCR while a session
is active.

The MCR also affects the LO settings; it is the reference clock for the
lowband LOs.
2017-12-22 15:05:07 -08:00
Martin Braun
b14cafd90c mpm: mg: Add dboard sensors for low- and highband LO lock status
- Add LO locked APIs to Magnesium
- Add LO locked sensor APIs for RX/TX and highband/lowband LOs
- Poll all those sensors from magnesium_radio_ctrl_impl

Reviewed-By: Steven Bingler <steven.bingler@ni.com>
Reviewed-By: Trung Tran <trung.tran@ettus.com>
2017-12-22 15:05:07 -08:00
Martin Braun
50a8624a4b mpm: mg: Make Magnesium __init__ exception-safe 2017-12-22 15:05:06 -08:00
Martin Braun
0fdf93748a mpm: Make dboard manager __init__ exception-safe 2017-12-22 15:05:06 -08:00
Trung N Tran
db7039f8be mpm: enable RX external LO set through args
This change allow user to set RX LO of ad9371 to external or internal from args
constructor of usrp device.
 new args is rx_lo_source value can be either internal or external:
 If there's no rx_lo_source specified or invalid value, default rx_lo is used;  which is internal LO.
Usage example:
 usrp_application --args "rx_lo_source=external"
2017-12-22 15:05:06 -08:00
Trung Tran
9ea0d6da9e mg: enable init and track calibration API
Currently, AD9371 turned on most of the calibration and hard coding the turning
on process during bringup time.
This change enables users to pass in a mask field for init ARM calibration and
tracking arm calibration at the time creating USRP device reference.
This mask field can be passed through device arguments of:
 1/ init_cals : for init ARM  calibration masks. This is defined in AD9371 UG-992
table 65. Default to 0x4DFF
 2/ tracking_cals : for tracking calibration masks. This is defined in AD9371
UG-992 table 66. Default to 0xC3

Example of pasing in init calibration and tracking calibration mask
      usrp_application --args "init_cals=0x4f, tracking_cals=0xC3"
NOTE: UHD currently expect user to input the correct init_cals and
tracking_cals. There's no mechanism to check if init mask and tracking mask are
valid. For example if the init mask field not mask 0x4f, the AD9371 will failed
to setup.
2017-12-22 15:05:06 -08:00
Martin Braun
96f209a561 mpm: mg: Add lowband LO lock and AD9371 lock sensors
Note: The AD9371 lock sensors are only stubbed out for now.
2017-12-22 15:05:06 -08:00
Martin Braun
61aac1dd72 mpm: mg: Refactor some periph inits into __init__
SPI interfaces and -lock, user EEPROM, radio regs, CPLD, dboard clock
control and GPIO expander can be initialized in Magnesium.__init__().
This shaves a little time off of the actual init() call and allows for
earlier failures.
2017-12-22 15:05:06 -08:00
Martin Braun
ba25633132 mpm: mg: Fix linting issues and warnings
- Removed superfluous code
- Fixed most PyLint warnings
- Reordered methods to match call order
2017-12-22 15:05:06 -08:00
Martin Braun
e9a7db19ab mpm: Fix minor logging issues with LMK04828 code
Log prefixes weren't properly being set.
2017-12-22 15:05:05 -08:00
Martin Braun
08d8a34a2a mpm: mg: Move CPLD controls to dedicated class 2017-12-22 15:05:05 -08:00
Martin Braun
f2bcec5945 mpm: Replace MMCM lock and TDC PPS sleeps with poll_with_timeout
This increases init speed by replacing worst-case sleeps with polls.
2017-12-22 15:04:02 -08:00
djepson1
5eb49364ce lmk: change holdover settings to reduce lock time
- Register 0x150 bit [1] to '0'
  - Change lock detect to poll operation
2017-12-22 15:04:02 -08:00
Martin Braun
e212936218 mpm: mg: Minor cleanup in __init__
- Moved AD9371 API generation around
- Fixed some PyLint warnings
2017-12-22 15:04:02 -08:00
Martin Braun
be7e72ed1d mpm: mg: Enable user EEPROM data read/write 2017-12-22 15:04:02 -08:00
Trung N Tran
832e9fc794 mpm: mg: Specify I2C parents for GPIO devices
The Magnesium daughterboards have GPIO port expanders, but both have the
same udev label. In order to specify which port expander to use, we pass
in the parent udev I2c device.
2017-12-22 15:04:02 -08:00
Martin Braun
c8094c0e51 mpm: mg: Specify the required overlay for FPGA auto-loading 2017-12-22 15:04:02 -08:00
Martin Braun
d601fd03d5 mpm: Properly populate device_info dict for dboard classes
Prior to this commit, device_info was always an empty dictionary on all
dboard classes. The device_info dict is now auto-populated from the
EEPROM contents, if any were provided.

Dboard classes can still opt to amend that dictionary in specific class
implementations.

Signed-off-by: Martin Braun <martin.braun@ettus.com>
2017-12-22 15:04:02 -08:00
Martin Braun
cea45dda8f mpm: Add mboard EEPROM support
MPMD binds a property for the mboard EEPROM to the appropriate RPC
calls. PeriphManager now provides default implementations for an mboard
EEPROM.
2017-12-22 15:04:02 -08:00
djepson1
4e0600b00a mg: Updated JESD204b init seq and documentation.
- Based on feedback from ADI, updated SYSREF sequencing for
    meeting deterministic latency requirements.
  - Changed majority of register addresses in nijesdcore.py to
    constants.
  - Corrected write data to SYSREF_CAPTURE_CONTROL to produce
    the correct SYSREF toggle rate inside the FPGA.

Signed-off-by: djepson1 <daniel.jepson@ni.com>
2017-12-22 15:04:02 -08:00
djepson1
6858b05357 mg: Fix debug support for CPLD accesses
Signed-off-by: djepson1 <daniel.jepson@ni.com>
2017-12-22 15:04:02 -08:00
djepson1
58e83611f4 mg: Clean up CPLD initialization.
Signed-off-by: djepson1 <daniel.jepson@ni.com>
2017-12-22 15:04:02 -08:00
djepson1
ca847bb474 mg: Preliminary clock sync support
Signed-off-by: djepson1 <daniel.jepson@ni.com>
2017-12-22 15:04:02 -08:00
djepson1
6bb1e12503 mg: Clean up radio_regs creation
Signed-off-by: djepson1 <daniel.jepson@ni.com>
2017-12-22 15:04:02 -08:00
djepson1
ee3f82e454 mg: Updated support for LMK
- add clock shifting
  - add DAC support
  - modify __init__ calls for cleanup

Signed-off-by: djepson1 <daniel.jepson@ni.com>
2017-12-22 15:04:02 -08:00
Martin Braun
e2f8f8e0bd mpm: Added sensor API
- Motherboard sensors are automatically populated into the property
  tree, they can be automatically enumerated and queried
- Daughterboard sensors have an API for querying and enumerating
  sensors, but this commit does not automatically add them to the
  property tree
2017-12-22 15:04:02 -08:00
Daniel Jepson
3b716315fe mpm: Update TDC sync code to make it generic for N dboards 2017-12-22 15:04:01 -08:00
Daniel Jepson
39e7b7fd13 mpm: Added lmk_mg to CMake 2017-12-22 15:04:01 -08:00
DJ Epson
f141f71180 mpm: Streaming-related improvements to Magnesium controls 2017-12-22 15:04:01 -08:00
Mark Meserve
309a2f04e3 mg: General fixes
- Make DB probe-able
- Add RPC client
2017-12-22 15:04:00 -08:00
Martin Braun
7cd6758336 n310/eiscat: Removed 20 MHz as a valid ref clock frequency 2017-12-22 15:04:00 -08:00
Derek Kozel
e5a7be4453 eiscat: Change sync pin configuration to switch to CD in case of error 2017-12-22 15:04:00 -08:00
djepson1
d15b55481d eiscat: Fixing a sequencing issue with channel enables for signal integrity reasons 2017-12-22 15:04:00 -08:00
sugandhagupta
0347dc8b4b mpm: fixed mpm rerun issue 2017-12-22 15:04:00 -08:00
Martin Braun
8e1dec25f2 eiscat: Move JESD init and ADC reset to its own function 2017-12-22 15:03:59 -08:00
Martin Braun
d6dc8377ed eiscat: JESD failure does no longer throw; returns failure 2017-12-22 15:03:59 -08:00
Martin Braun
d6d4ac861e eiscat: Unset initialized-flag when ref clock freq is changed 2017-12-22 15:03:59 -08:00
Martin Braun
62e2c25107 eiscat: Minor logging update for clock sync 2017-12-22 15:03:59 -08:00
Martin Braun
5f803ae32e eiscat: Skip re-initialization of dboards 2017-12-22 15:03:59 -08:00
Daniel Jepson
45012fa48c EISCAT: Hard reset ADCs before init, fixed interleaving engine 2017-12-22 15:03:59 -08:00
Martin Braun
40235b8c5a mpm/mpmd: Call init() during UHD session init, not on hwd spawn 2017-12-22 15:03:59 -08:00