Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -559,6 +559,7 @@
- Added
- (Common) Added `nitlsconfig[grpc]>=1.0.0a2` to the optional gRPC dependencies.
- Added the `nidigital_load_sheets_and_burst.py` example.
- Added the `nidigital_tdr_measurement.py` example.
- Changed
- Removed

Expand Down
9 changes: 9 additions & 0 deletions docs/nidigital/examples.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,15 @@ nidigital_load_sheets_and_burst.py
:encoding: utf8
:caption: `(nidigital_load_sheets_and_burst.py) <https://github.com/ni/nimi-python/blob/master/src/nidigital/examples/load_sheets_and_burst/nidigital_load_sheets_and_burst.py>`_

nidigital_tdr_measurement.py
----------------------------

.. literalinclude:: ../../src/nidigital/examples/nidigital_tdr_measurement/nidigital_tdr_measurement.py
:language: python
:linenos:
:encoding: utf8
:caption: `(nidigital_tdr_measurement.py) <https://github.com/ni/nimi-python/blob/master/src/nidigital/examples/nidigital_tdr_measurement/nidigital_tdr_measurement.py>`_

nidigital_ppmu_source_and_measure.py
------------------------------------

Expand Down
51 changes: 51 additions & 0 deletions src/nidigital/examples/nidigital_tdr_measurement/PinMap.pinmap
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<?xml version="1.0" encoding="utf-8"?>
<PinMap xmlns="http://www.ni.com/TestStand/SemiconductorModule/PinMap.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" schemaVersion="1.5">
<Instruments>
<NIDigitalPatternInstrument name="PXI1Slot2" numberOfChannels="32" group="Digital" />
<NIDigitalPatternInstrument name="PXI1Slot3" numberOfChannels="32" group="Digital" />
</Instruments>
<Pins>
<DUTPin name="DUTPin1" />
<DUTPin name="DUTPin2" />
<DUTPin name="DUTPin3" />
<DUTPin name="DUTPin4" />
<DUTPin name="DUTPin5" />
<DUTPin name="DUTPin6" />
<DUTPin name="DUTPin7" />
<DUTPin name="DUTPin8" />
</Pins>
<PinGroups>
<PinGroup name="PinGroup1">
<PinReference pin="DUTPin1" />
<PinReference pin="DUTPin2" />
<PinReference pin="DUTPin3" />
<PinReference pin="DUTPin4" />
<PinReference pin="DUTPin5" />
<PinReference pin="DUTPin6" />
<PinReference pin="DUTPin7" />
<PinReference pin="DUTPin8" />
</PinGroup>
</PinGroups>
<Sites>
<Site siteNumber="0" />
<Site siteNumber="1" />
</Sites>
<Connections>
<Connection pin="DUTPin1" siteNumber="0" instrument="PXI1Slot2" channel="0" />
<Connection pin="DUTPin1" siteNumber="1" instrument="PXI1Slot3" channel="0" />
<Connection pin="DUTPin2" siteNumber="0" instrument="PXI1Slot2" channel="1" />
<Connection pin="DUTPin2" siteNumber="1" instrument="PXI1Slot3" channel="1" />
<Connection pin="DUTPin3" siteNumber="0" instrument="PXI1Slot2" channel="2" />
<Connection pin="DUTPin3" siteNumber="1" instrument="PXI1Slot3" channel="2" />
<Connection pin="DUTPin4" siteNumber="0" instrument="PXI1Slot2" channel="3" />
<Connection pin="DUTPin4" siteNumber="1" instrument="PXI1Slot3" channel="3" />
<Connection pin="DUTPin5" siteNumber="0" instrument="PXI1Slot2" channel="4" />
<Connection pin="DUTPin5" siteNumber="1" instrument="PXI1Slot3" channel="4" />
<Connection pin="DUTPin6" siteNumber="0" instrument="PXI1Slot2" channel="5" />
<Connection pin="DUTPin6" siteNumber="1" instrument="PXI1Slot3" channel="5" />
<Connection pin="DUTPin7" siteNumber="0" instrument="PXI1Slot2" channel="6" />
<Connection pin="DUTPin7" siteNumber="1" instrument="PXI1Slot3" channel="6" />
<Connection pin="DUTPin8" siteNumber="0" instrument="PXI1Slot2" channel="7" />
<Connection pin="DUTPin8" siteNumber="1" instrument="PXI1Slot3" channel="7" />
</Connections>
</PinMap>
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
#!/usr/bin/python

import argparse
import nidigital
import os
import sys


def example(resource_name, options, channel_list, endpoint_termination, apply_offsets):
directory = os.path.dirname(os.path.abspath(__file__))

with nidigital.Session(resource_name=resource_name, options=options, reset_device=True) as session:
try:
pin_map_filename = os.path.join(directory, 'PinMap.pinmap')
session.load_pin_map(pin_map_filename)

session.tdr_endpoint_termination = endpoint_termination

# Measure propagation delays and optionally apply the offsets to compensate for them.
print('Start TDR Measurement')
offsets = session.channels[channel_list].tdr(apply_offsets=apply_offsets)
offsets_in_seconds = [offset.total_seconds() for offset in offsets]

print('TDR Offsets (seconds): {}'.format(offsets_in_seconds))
finally:
session.channels[channel_list].selected_function = nidigital.SelectedFunction.DISCONNECT

print('Done TDR Measurement')
return offsets


def _main(argsv):
parser = argparse.ArgumentParser(description='Demonstrates how to use Time-Domain Reflectometry (TDR) to measure propagation delays through cables, connectors, and load boards. Use a 50 ohm controlled-impedance system and ensure an open or short exists at the selected TDR plane.', formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument('-n', '--resource-name', default='PXI1Slot2,PXI1Slot3', help='The specified resource name of a digital pattern instrument, for example, PXI1Slot3, where PXI1Slot3 is an instrument resource name.')
parser.add_argument('-s', '--simulate', default='True', choices=['True', 'False'], help='Whether to run on simulated hardware or real hardware')
parser.add_argument('-c', '--channel-list', default='PinGroup1', help='List of channels or pins to measure.')
parser.add_argument('-e', '--tdr-endpoint-termination', default='OPEN', type=str.upper, choices=nidigital.TDREndpointTermination.__members__, help='Specifies whether TDR Channels are connected to an open circuit or a short to ground.')
parser.add_argument('-a', '--apply-offsets', default='True', choices=['True', 'False'], help='A Boolean that specifies whether to apply the measured TDR offsets.')
args = parser.parse_args(argsv)

example(args.resource_name,
'Simulate=1, DriverSetup=Model:6570' if args.simulate == 'True' else '',
args.channel_list,
nidigital.TDREndpointTermination[args.tdr_endpoint_termination],
args.apply_offsets == 'True')


def main():
_main(sys.argv[1:])


def test_main():
_main([])
_main(['--tdr-endpoint-termination', 'SHORT_TO_GROUND', '--apply-offsets', 'False'])


def test_example():
resource_name = 'PXI1Slot2,PXI1Slot3'
options = {'simulate': True, 'driver_setup': {'Model': '6570'}, }
channel_list = 'PinGroup1'

endpoint_termination = nidigital.TDREndpointTermination.OPEN
example(resource_name, options, channel_list, endpoint_termination, apply_offsets=True)
example(resource_name, options, channel_list, endpoint_termination, apply_offsets=False)

endpoint_termination = nidigital.TDREndpointTermination.SHORT_TO_GROUND
example(resource_name, options, channel_list, endpoint_termination, apply_offsets=True)
example(resource_name, options, channel_list, endpoint_termination, apply_offsets=False)


if __name__ == '__main__':
main()
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?xml version="1.0" encoding="utf-8"?>
<SourceFile Checksum="FA43F2F930A03FFF190ABD78331B60FC" xmlns="http://www.ni.com/PlatformFramework">
<SourceModelFeatureSet>
<ParsableNamespace AssemblyFileVersion="5.3.1.50584" FeatureSetName="Digital Pattern Editor" Name="http://www.ni.com/PatternBasedDigital" OldestCompatibleVersion="4.5.0.0" Version="4.6.0.49152" />
<ParsableNamespace AssemblyFileVersion="5.3.1.50584" FeatureSetName="Editor" Name="http://www.ni.com/PlatformFramework" OldestCompatibleVersion="5.2.0.49153" Version="5.2.0.49153" />
<ApplicationVersionInfo Build="5.3.1.50584" Name="Digital Pattern Editor" Version="19.0.0" />
</SourceModelFeatureSet>
<Project xmlns="http://www.ni.com/PlatformFramework">
<ProjectSettings Id="1" ModelDefinitionType="ProjectSettings" Name="ZProjectSettings" />
<EmbeddedDefinitionReference Id="2" ModelDefinitionType="NationalInstruments.ProjectExplorer.Modeling.ProjectDataManager" Name="ProjectExplorer">
<ProjectExplorer />
</EmbeddedDefinitionReference>
<NameScopingEnvoy Id="3" ModelDefinitionType="DefaultTarget" Name="DefaultTarget">
<DefaultTarget />
<FileReference Id="14" ModelDefinitionType="PinMap" Name="PinMap\.pinmap" StoragePath="PinMap.pinmap" p4:IsActive="True" xmlns:p4="http://www.ni.com/PatternBasedDigital" />
<EmbeddedDefinitionReference Id="15" ModelDefinitionType="{http://www.ni.com/PatternBasedDigital}CaptureResultsDefinition" Name="CaptureResults">
<CaptureResultsDefinition xmlns="http://www.ni.com/PatternBasedDigital" />
</EmbeddedDefinitionReference>
<EmbeddedDefinitionReference Id="17" ModelDefinitionType="{http://www.ni.com/PatternBasedDigital}BurstResultsDefinition" Name="BurstResults">
<BurstResultsDefinition xmlns="http://www.ni.com/PatternBasedDigital" />
</EmbeddedDefinitionReference>
<EmbeddedDefinitionReference Id="19" ModelDefinitionType="{http://www.ni.com/PatternBasedDigital}SystemInfoDefinition" Name="SystemInfo">
<SystemInfoDefinition xmlns="http://www.ni.com/PatternBasedDigital" />
</EmbeddedDefinitionReference>
<EmbeddedDefinitionReference Id="20" ModelDefinitionType="{http://www.ni.com/PatternBasedDigital}DigitalScopeDefinition" Name="DigitalScope">
<DigitalScopeDefinition xmlns="http://www.ni.com/PatternBasedDigital" />
</EmbeddedDefinitionReference>
</NameScopingEnvoy>
<EmbeddedDefinitionReference Id="7" ModelDefinitionType="DigitalPatternEditor.ProjectPropertiesDefinition" Name="ProjectProperties">
<ProjectPropertiesDefinition xmlns="http://www.ni.com/PatternBasedDigital" />
</EmbeddedDefinitionReference>
</Project>
<ProjectInformation xmlns="http://www.ni.com/PlatformFramework" />
</SourceFile>
Loading