Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
4eb8624
Add @Avinash2Suresh as a code owner
NI-velmurugan Oct 7, 2026
79d0b7e
Merge branch 'master' of https://github.com/NI-velmurugan/nimi-python
divakar-selvam07 Oct 12, 2026
8305ba2
Remove @Avinash2Suresh from CODEOWNERS
divakar-selvam07 Oct 8, 2026
edb1a2c
Merge branch 'master' of https://github.com/NI-velmurugan/nimi-python
divakar-selvam07 Oct 23, 2026
001e834
Merge branch 'master' of https://github.com/NI-velmurugan/nimi-python
divakar-selvam07 Oct 23, 2026
322f69f
Merge branch 'master' of https://github.com/NI-velmurugan/nimi-python
divakar-selvam07 Oct 26, 2026
a8f2416
Merge branch 'master' of https://github.com/NI-velmurugan/nimi-python
divakar-selvam07 Oct 27, 2026
a8a0743
add: Add Initial Version of the Example
divakar-selvam07 Oct 31, 2026
2b839f3
nit: simplify tests
divakar-selvam07 Nov 2, 2026
ef694fb
nit: fix formatting
divakar-selvam07 Nov 2, 2026
4da8443
nit: fix formatting
divakar-selvam07 Nov 3, 2026
da15ec2
removing self explainatory comments
divakar-selvam07 Nov 4, 2026
327ec60
Update resource-name argument description
divakar-selvam07 Nov 4, 2026
5ff15cc
Adding Source Waveform example in NI-Digital
NI-velmurugan Nov 5, 2026
b151b5e
Revert "Adding Source Waveform example in NI-Digital"
NI-velmurugan Nov 5, 2026
2f84162
Merge branch 'ni:master' into master
NI-velmurugan Nov 11, 2026
041d370
Merge branch 'ni:master' into master
NI-velmurugan Nov 16, 2026
d4c4b90
Merge branch 'master' into users/diva/add-nidigital-capture-waveform-…
NI-velmurugan Nov 16, 2026
649bcbe
Renaming the example
NI-velmurugan Nov 16, 2026
a9b6979
Trigger CI build
NI-velmurugan Nov 16, 2026
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 @@ -558,6 +558,7 @@
#### [nidigital] Unreleased
- Added
- (Common) Added `nitlsconfig[grpc]>=1.0.0a2` to the optional gRPC dependencies.
- Added the `nidigital_capture_waveform.py` example.
- Added the `nidigital_load_sheets_and_burst.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_capture_waveform.py
-----------------------------

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

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

Expand Down
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<PinLevelsFile xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" schemaVersion="1.0" xmlns="http://www.ni.com/Semiconductor/PinLevels">
<PinLevelsSheet>
<DigitalPinLevelSets>
<DigitalPinLevelSet pin="PinGroup1">
<Vil>0</Vil>
<Vih>3.3</Vih>
<Vol>0.8</Vol>
<Voh>2</Voh>
<Vterm>0</Vterm>
<TerminationMode>HighZ</TerminationMode>
</DigitalPinLevelSet>
</DigitalPinLevelSets>
</PinLevelsSheet>
</PinLevelsFile>
69 changes: 69 additions & 0 deletions src/nidigital/examples/nidigital_capture_waveform/PinMap.pinmap
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
<?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" />
<Site siteNumber="2" />
<Site siteNumber="3" />
</Sites>
<Connections>
<Connection pin="DUTPin1" siteNumber="0" instrument="PXI1Slot2" channel="0" />
<Connection pin="DUTPin2" siteNumber="0" instrument="PXI1Slot2" channel="1" />
<Connection pin="DUTPin3" siteNumber="0" instrument="PXI1Slot2" channel="2" />
<Connection pin="DUTPin4" siteNumber="0" instrument="PXI1Slot2" channel="3" />
<Connection pin="DUTPin5" siteNumber="0" instrument="PXI1Slot2" channel="4" />
<Connection pin="DUTPin6" siteNumber="0" instrument="PXI1Slot2" channel="5" />
<Connection pin="DUTPin7" siteNumber="0" instrument="PXI1Slot2" channel="6" />
<Connection pin="DUTPin8" siteNumber="0" instrument="PXI1Slot2" channel="7" />
<Connection pin="DUTPin1" siteNumber="1" instrument="PXI1Slot2" channel="8" />
<Connection pin="DUTPin1" siteNumber="2" instrument="PXI1Slot3" channel="0" />
<Connection pin="DUTPin1" siteNumber="3" instrument="PXI1Slot3" channel="8" />
<Connection pin="DUTPin2" siteNumber="1" instrument="PXI1Slot2" channel="9" />
<Connection pin="DUTPin2" siteNumber="2" instrument="PXI1Slot3" channel="1" />
<Connection pin="DUTPin2" siteNumber="3" instrument="PXI1Slot3" channel="9" />
<Connection pin="DUTPin3" siteNumber="1" instrument="PXI1Slot2" channel="10" />
<Connection pin="DUTPin3" siteNumber="2" instrument="PXI1Slot3" channel="2" />
<Connection pin="DUTPin3" siteNumber="3" instrument="PXI1Slot3" channel="10" />
<Connection pin="DUTPin4" siteNumber="1" instrument="PXI1Slot2" channel="11" />
<Connection pin="DUTPin4" siteNumber="2" instrument="PXI1Slot3" channel="3" />
<Connection pin="DUTPin4" siteNumber="3" instrument="PXI1Slot3" channel="11" />
<Connection pin="DUTPin5" siteNumber="1" instrument="PXI1Slot2" channel="12" />
<Connection pin="DUTPin5" siteNumber="2" instrument="PXI1Slot3" channel="4" />
<Connection pin="DUTPin5" siteNumber="3" instrument="PXI1Slot3" channel="12" />
<Connection pin="DUTPin6" siteNumber="1" instrument="PXI1Slot2" channel="13" />
<Connection pin="DUTPin6" siteNumber="2" instrument="PXI1Slot3" channel="5" />
<Connection pin="DUTPin6" siteNumber="3" instrument="PXI1Slot3" channel="13" />
<Connection pin="DUTPin7" siteNumber="1" instrument="PXI1Slot2" channel="14" />
<Connection pin="DUTPin7" siteNumber="2" instrument="PXI1Slot3" channel="6" />
<Connection pin="DUTPin7" siteNumber="3" instrument="PXI1Slot3" channel="14" />
<Connection pin="DUTPin8" siteNumber="1" instrument="PXI1Slot2" channel="15" />
<Connection pin="DUTPin8" siteNumber="2" instrument="PXI1Slot3" channel="7" />
<Connection pin="DUTPin8" siteNumber="3" instrument="PXI1Slot3" channel="15" />
</Connections>
</PinMap>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<Specifications xmlns:f="http://www.ni.com/schemas/Semiconductor/Formula.xsd" schemaVersion="1.0" xmlns="http://www.ni.com/schemas/Semiconductor/Specifications.xsd">
<Section name="timing">
<f:Formula symbol="period">
<f:Definition>1 µs</f:Definition>
</f:Formula>
</Section>
<Description />
</Specifications>
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<TimingFile xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" schemaVersion="1.0" xmlns="http://www.ni.com/Semiconductor/Timing">
<TimingSheet>
<TimeSets>
<TimeSet name="tset0">
<Period>timing.period</Period>
<PinEdges>
<PinEdge pin="PinGroup1">
<DriveNonReturn>
<On>0 µs</On>
<Data>timing.period / 2</Data>
<Off>timing.period</Off>
</DriveNonReturn>
<CompareStrobe>
<Strobe>(3 * timing.period) / 4</Strobe>
</CompareStrobe>
<DataSource>Pattern</DataSource>
</PinEdge>
</PinEdges>
</TimeSet>
</TimeSets>
</TimingSheet>
</TimingFile>
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?xml version="1.0" encoding="utf-8"?>
<SourceFile Checksum="AF1FB7DAC70E9FA5BE5BF0DEFA0EF99F" 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="15" ModelDefinitionType="PinLevelsDefinition" Name="PinLevels\.digilevels" StoragePath="PinLevels.digilevels" p4:IsActive="True" xmlns:p4="http://www.ni.com/PatternBasedDigital" />
<FileReference Id="16" ModelDefinitionType="DigitalPatternEditor.PatternDefinition" Name="Pattern\.digipat" StoragePath="Pattern.digipat" />
<FileReference Id="17" ModelDefinitionType="PinMap" Name="PinMap\.pinmap" StoragePath="PinMap.pinmap" p4:IsActive="True" xmlns:p4="http://www.ni.com/PatternBasedDigital" />
<FileReference Id="18" ModelDefinitionType="SpecificationsDefinition" Name="Specifications\.specs" StoragePath="Specifications.specs" />
<FileReference Id="19" ModelDefinitionType="TimingDefinition" Name="Timing\.digitiming" StoragePath="Timing.digitiming" p4:IsActive="True" xmlns:p4="http://www.ni.com/PatternBasedDigital" />
<FileReference Id="28" ModelDefinitionType="CaptureWaveformDefinition" Name="CaptureWaveform\.digicapture" StoragePath="CaptureWaveform.digicapture" />
<EmbeddedDefinitionReference Id="29" ModelDefinitionType="{http://www.ni.com/PatternBasedDigital}CaptureResultsDefinition" Name="CaptureResults">
<CaptureResultsDefinition xmlns="http://www.ni.com/PatternBasedDigital" />
</EmbeddedDefinitionReference>
<EmbeddedDefinitionReference Id="31" ModelDefinitionType="{http://www.ni.com/PatternBasedDigital}BurstResultsDefinition" Name="BurstResults">
<BurstResultsDefinition xmlns="http://www.ni.com/PatternBasedDigital" />
</EmbeddedDefinitionReference>
<EmbeddedDefinitionReference Id="33" ModelDefinitionType="{http://www.ni.com/PatternBasedDigital}SystemInfoDefinition" Name="SystemInfo">
<SystemInfoDefinition xmlns="http://www.ni.com/PatternBasedDigital" />
</EmbeddedDefinitionReference>
<EmbeddedDefinitionReference Id="34" 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>
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
#!/usr/bin/python

import argparse
import nidigital
import os
import sys


CAPTURE_WAVEFORM_TYPES = ('Serial', 'Parallel', 'From File: Digicapture')
WAVEFORM_NAME = 'new_waveform'


def example(resource_name, options, samples_to_read, pin_list, capture_waveform_type, sample_width, bit_order, waveform_file_path):

with nidigital.Session(resource_name=resource_name, reset_device=True, options=options) as session:

directory = os.path.dirname(os.path.abspath(__file__))

pin_map_filename = os.path.join(directory, 'PinMap.pinmap')
session.load_pin_map(pin_map_filename)

spec_filename = os.path.join(directory, 'Specifications.specs')
levels_filename = os.path.join(directory, 'PinLevels.digilevels')
timing_filename = os.path.join(directory, 'Timing.digitiming')
session.load_specifications_levels_and_timing(spec_filename, levels_filename, timing_filename)

session.apply_levels_and_timing(levels_filename, timing_filename)

pattern_filename = os.path.join(directory, 'Pattern.digipat')
session.load_pattern(pattern_filename)

try:
if capture_waveform_type == 'Serial':
session.pins[pin_list].create_capture_waveform_serial(waveform_name=WAVEFORM_NAME, sample_width=sample_width, bit_order=bit_order)
elif capture_waveform_type == 'Parallel':
session.pins[pin_list].create_capture_waveform_parallel(waveform_name=WAVEFORM_NAME)
elif capture_waveform_type == 'From File: Digicapture':
capture_file_path = os.path.abspath(os.path.join(directory, waveform_file_path))
session.create_capture_waveform_from_file_digicapture(waveform_name=WAVEFORM_NAME, waveform_file_path=capture_file_path)
else:
raise ValueError('Unsupported capture waveform type: {}'.format(capture_waveform_type))

print('Start bursting pattern')
session.burst_pattern(start_label='new_pattern')

waveforms = session.fetch_capture_waveform(waveform_name=WAVEFORM_NAME, samples_to_read=samples_to_read)
captured_waveforms = {site: list(data) for site, data in waveforms.items()}
print('Captured data:')
for site, samples in sorted(captured_waveforms.items()):
print('Site {} ({} samples): {}'.format(site, len(samples), samples))
finally:
session.pins[pin_list].selected_function = nidigital.SelectedFunction.DISCONNECT

print('Done capturing waveform')


def _main(argsv):
parser = argparse.ArgumentParser(description='Demonstrates how to configure a capture waveform and capture data on the digital pattern instrument.', 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('-r', '--samples-to-read', default=4, type=int, help='Number of samples to fetch.')
parser.add_argument('-p', '--pin-list', default='DUTPin1', help='List of pins to capture.')
parser.add_argument('-t', '--capture-waveform-type', default='Serial', type=str.title, choices=CAPTURE_WAVEFORM_TYPES, help='Selects the capture waveform configuration to use.')
parser.add_argument('-sw', '--sample-width', default=32, type=int, help='Width in bits of each serial sample. Valid values are between 1 and 32.')
parser.add_argument('-bo', '--bit-order', default='MSB', type=str.upper, choices=nidigital.BitOrder.__members__, help='Order in which to shift the bits.')
parser.add_argument('-wf', '--waveform-file', default='CaptureWaveform.digicapture', help='Absolute file path to the capture waveform file (.digicapture) you want to load.')
args = parser.parse_args(argsv)

example(args.resource_name,
'Simulate=1, DriverSetup=Model:6570' if args.simulate == 'True' else '',
args.samples_to_read, args.pin_list, args.capture_waveform_type,
args.sample_width, nidigital.BitOrder[args.bit_order], args.waveform_file)


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


def test_main():
_main([])
_main(['--capture-waveform-type', 'Parallel'])
_main(['--capture-waveform-type', 'From File: Digicapture'])
_main(['--sample-width', '8', '--bit-order', 'LSB'])


def test_example():
resource_name = 'PXI1Slot2,PXI1Slot3'
options = {'simulate': True, 'driver_setup': {'Model': '6570'}}
samples_to_read = 4
pin_list = 'DUTPin1'
sample_width = 32
bit_order = nidigital.BitOrder.MSB
waveform_file_path = 'CaptureWaveform.digicapture'

example(resource_name, options, samples_to_read, pin_list, 'Serial', sample_width, bit_order, waveform_file_path)
example(resource_name, options, samples_to_read, pin_list, 'Parallel', sample_width, bit_order, waveform_file_path)
example(resource_name, options, samples_to_read, pin_list, 'From File: Digicapture', sample_width, bit_order, waveform_file_path)
example(resource_name, options, samples_to_read, pin_list, 'Serial', 8, nidigital.BitOrder.LSB, waveform_file_path)


if __name__ == '__main__':
main()
Loading