From 4eb862408081a48bf127a0eb251266592c1cf9c2 Mon Sep 17 00:00:00 2001 From: NI-velmurugan Date: Wed, 7 Oct 2026 19:45:14 +0530 Subject: [PATCH 1/6] Add @Avinash2Suresh as a code owner --- .github/CODEOWNERS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 17a4e6de4d..dac883d426 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1 +1 @@ -* @marcoskirsch @ni-jfitzger @vnktshr21 +* @marcoskirsch @ni-jfitzger @vnktshr21 @Avinash2Suresh From 8305ba26e923b280a766b480f52f77b1170c6fcd Mon Sep 17 00:00:00 2001 From: Divakar Date: Thu, 8 Oct 2026 16:17:45 +0530 Subject: [PATCH 2/6] Remove @Avinash2Suresh from CODEOWNERS --- .github/CODEOWNERS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index dac883d426..17a4e6de4d 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1 +1 @@ -* @marcoskirsch @ni-jfitzger @vnktshr21 @Avinash2Suresh +* @marcoskirsch @ni-jfitzger @vnktshr21 From 3d7dbe2abd6b002b9e1e5521f4a3182c897f3747 Mon Sep 17 00:00:00 2001 From: "Selvam, Divakar" Date: Wed, 4 Nov 2026 12:01:14 +0530 Subject: [PATCH 3/6] Add Create Pin Map example in NI-Digital Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- CHANGELOG.md | 1 + docs/nidigital/examples.rst | 9 ++ .../examples/create_pin_map/Pattern.digipat | Bin 0 -> 3986 bytes .../create_pin_map/PinLevels.digilevels | 15 +++ .../examples/create_pin_map/PinMap.pinmap | 33 ++++++ .../examples/create_pin_map/Timing.digitiming | 23 ++++ .../create_pin_map/create_pin_map.digiproj | 37 ++++++ .../nidigital_create_pin_map.py | 106 ++++++++++++++++++ 8 files changed, 224 insertions(+) create mode 100644 src/nidigital/examples/create_pin_map/Pattern.digipat create mode 100644 src/nidigital/examples/create_pin_map/PinLevels.digilevels create mode 100644 src/nidigital/examples/create_pin_map/PinMap.pinmap create mode 100644 src/nidigital/examples/create_pin_map/Timing.digitiming create mode 100644 src/nidigital/examples/create_pin_map/create_pin_map.digiproj create mode 100644 src/nidigital/examples/create_pin_map/nidigital_create_pin_map.py diff --git a/CHANGELOG.md b/CHANGELOG.md index 5bc3af6804..e86be897ea 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -558,6 +558,7 @@ #### [nidigital] Unreleased - Added - (Common) Added `nitlsconfig[grpc]>=1.0.0a2` to the optional gRPC dependencies. + - Added the `nidigital_create_pin_map.py` example. - Changed - Removed diff --git a/docs/nidigital/examples.rst b/docs/nidigital/examples.rst index b8c8cc689a..b5497f4741 100644 --- a/docs/nidigital/examples.rst +++ b/docs/nidigital/examples.rst @@ -21,6 +21,15 @@ nidigital_configure_time_set_and_voltage_levels.py :encoding: utf8 :caption: `(nidigital_configure_time_set_and_voltage_levels.py) `_ +nidigital_create_pin_map.py +--------------------------- + +.. literalinclude:: ../../src/nidigital/examples/create_pin_map/nidigital_create_pin_map.py + :language: python + :linenos: + :encoding: utf8 + :caption: `(nidigital_create_pin_map.py) `_ + nidigital_ppmu_source_and_measure.py ------------------------------------ diff --git a/src/nidigital/examples/create_pin_map/Pattern.digipat b/src/nidigital/examples/create_pin_map/Pattern.digipat new file mode 100644 index 0000000000000000000000000000000000000000..b96d897ab0fad38a82cc38c5d2574679e21ebc33 GIT binary patch literal 3986 zcmcgvZBG+H5I)rU9`QXU8oh596GM^2MB`haRjGm@w(zw%+65MSdv&{q_(}ekKMv=) zn`stkO%GBh3{P)gW}cnd*}ZGko5{r>2=whB=n_H%XXrPydPs7Cen3r}sF3gq>00cZ zvZlRojUKvc(6PGjbZXEKsgOGDdiex2z*C&Loz#YSBx!m6pA}7k;1U0L@cqN3Q9s-L zf`f18Dccb|Vdpvx*id#rR9EBO)Lx=z3_7(DZ3-iB>>GKF1`@#&OdeC`sx~^wl3JS3 zTJ&a5)vexBmI;Cz$&7DyzGw>sVHWwQM$0PhDjOkTXdIIl*t$X8NV+D32x8hD(xI(t zM9dOpT=a;VLsASmF6XFWj5joAM!WXFS#7pMp6V~?IkySI!&TC1)Y6G+DpzJj+iXk_ z#%>)kR*k;WE}p`AB&bVF;T7XV6eO(3q)1*t1LfxZXi3@yF|kO0Bk8BMRIs+#lOSx} zB&|klYihB=S%3{FITr+jBKK?BG@MGxL;~ujR1PdJ5BUt2Hs$sfnKTqX(8s)FYjRsgi z5IGUFVWV9pZPr$r^~GA#Pw8hK_>Qssn#C&{7=nL>Nwo{Y3s-${p-)ova)ii1C^+62 zZvI8v+0jmQTxL~Kai=G?L1t20OEcrJYE+CLOWD1GUfy_>)4W}!mVOW`h#**Skq%j` zq@B385^t*BluIhfsRV%_$UGsXk{Uqibu9^r2hYKC+b& ze<#f~96C%&V4R}+svEjAw3!L%yDc`qLaX9lSXXnLSGXn1^en!r=8N18?afg&) TAUP~%;{O3{%75!@aB%n+ + + + + + 0 + 3.3 + 0.8 + 2 + 0 + HighZ + + + + \ No newline at end of file diff --git a/src/nidigital/examples/create_pin_map/PinMap.pinmap b/src/nidigital/examples/create_pin_map/PinMap.pinmap new file mode 100644 index 0000000000..72d6bfd6b6 --- /dev/null +++ b/src/nidigital/examples/create_pin_map/PinMap.pinmap @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/nidigital/examples/create_pin_map/Timing.digitiming b/src/nidigital/examples/create_pin_map/Timing.digitiming new file mode 100644 index 0000000000..a51cf7721c --- /dev/null +++ b/src/nidigital/examples/create_pin_map/Timing.digitiming @@ -0,0 +1,23 @@ + + + + + + 100 ns + + + + 0 ns + 0 ns + 100 ns + + + 50 ns + + Pattern + + + + + + \ No newline at end of file diff --git a/src/nidigital/examples/create_pin_map/create_pin_map.digiproj b/src/nidigital/examples/create_pin_map/create_pin_map.digiproj new file mode 100644 index 0000000000..5294a77b4a --- /dev/null +++ b/src/nidigital/examples/create_pin_map/create_pin_map.digiproj @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/nidigital/examples/create_pin_map/nidigital_create_pin_map.py b/src/nidigital/examples/create_pin_map/nidigital_create_pin_map.py new file mode 100644 index 0000000000..c1b23f8d01 --- /dev/null +++ b/src/nidigital/examples/create_pin_map/nidigital_create_pin_map.py @@ -0,0 +1,106 @@ +#!/usr/bin/python + +import argparse +import nidigital +import os +import sys +import tempfile +from xml.etree import ElementTree + + +def _create_pin_map(resource_name, file_path): + instruments = [name.strip() for name in resource_name.split(',')] + if len(instruments) != 2 or not all(instruments) or instruments[0] == instruments[1]: + raise ValueError('This example requires two distinct instrument resource names, for example PXI1Slot2,PXI1Slot3.') + + # Python does not expose the LabVIEW pin/channel map creation APIs, so create an XML file for load_pin_map. + # The bundled PinMap.pinmap is the equivalent reference map for create_pin_map.digiproj. + pin_map = ElementTree.Element('PinMap', xmlns='http://www.ni.com/TestStand/SemiconductorModule/PinMap.xsd', schemaVersion='1.5') + instrument_list = ElementTree.SubElement(pin_map, 'Instruments') + for instrument in instruments: + ElementTree.SubElement(instrument_list, 'NIDigitalPatternInstrument', name=instrument, numberOfChannels='32', group='Digital') + + # Pin and group names must match the bundled levels, timing, and pattern files. + dut_pins = ('SCL', 'SDA', 'CS') + pins = ElementTree.SubElement(pin_map, 'Pins') + for pin in dut_pins: + ElementTree.SubElement(pins, 'DUTPin', name=pin) + ElementTree.SubElement(pins, 'SystemPin', name='Vcc') + + pin_groups = ElementTree.SubElement(pin_map, 'PinGroups') + pin_group = ElementTree.SubElement(pin_groups, 'PinGroup', name='I2C_bus') + for pin in ('Vcc',) + dut_pins: + ElementTree.SubElement(pin_group, 'PinReference', pin=pin) + + sites = ElementTree.SubElement(pin_map, 'Sites') + connections = ElementTree.SubElement(pin_map, 'Connections') + # Both sites share CS on the first instrument; Vcc is a system pin, not a per-site pin. + ElementTree.SubElement(connections, 'Connection', pin='CS', siteNumber='0,1', instrument=instruments[0], channel='30') + # Each instrument provides SCL and SDA for one site on channels 0 and 1. + for site, instrument in enumerate(instruments): + ElementTree.SubElement(sites, 'Site', siteNumber=str(site)) + for pin, channel in (('SCL', '0'), ('SDA', '1')): + ElementTree.SubElement(connections, 'Connection', pin=pin, siteNumber=str(site), instrument=instrument, channel=channel) + ElementTree.SubElement(connections, 'SystemConnection', pin='Vcc', instrument=instruments[0], channel='3') + + ElementTree.ElementTree(pin_map).write(file_path, encoding='utf-8', xml_declaration=True) + + +def example(resource_name, options): + # Keep the generated pin map outside the example directory and remove it after closing the session. + with tempfile.TemporaryDirectory() as temp_dir: + pin_map_filename = os.path.join(temp_dir, 'PinMap.pinmap') + _create_pin_map(resource_name, pin_map_filename) + + with nidigital.Session(resource_name=resource_name, options=options) as session: + # Load the pin map created at runtime, rather than the bundled reference map. + session.load_pin_map(pin_map_filename) + + # Load the levels and timing sheets created using the Digital Pattern Editor. + dir = os.path.dirname(os.path.abspath(__file__)) + levels_filename = os.path.join(dir, 'PinLevels.digilevels') + timing_filename = os.path.join(dir, 'Timing.digitiming') + session.load_specifications_levels_and_timing(levels_file_paths=levels_filename, timing_file_paths=timing_filename) + + # Apply the loaded voltage levels and timing settings to the instrument. + session.apply_levels_and_timing(levels_filename, timing_filename) + + # Load the pattern file created using the Digital Pattern Editor. + pattern_filename = os.path.join(dir, 'Pattern.digipat') + session.load_pattern(pattern_filename) + + print('Start bursting pattern') + try: + # Burst the pattern and wait until it completes. + session.burst_pattern(start_label='new_pattern') + finally: + # Disconnect all channels using programmable onboard switching. + session.selected_function = nidigital.SelectedFunction.DISCONNECT + print('Done bursting pattern') + + +def _main(argsv): + parser = argparse.ArgumentParser(description='Demonstrates how to create a pin map file, load levels and timing, and burst a pattern on the digital pattern instrument.', formatter_class=argparse.ArgumentDefaultsHelpFormatter) + parser.add_argument('-n', '--resource-name', default='PXI1Slot2,PXI1Slot3', help='The specified resource name shown in Measurement & Automation Explorer (MAX) for a digital pattern instrument, for example, PXI1Slot3, where PXI1Slot3 is an instrument resource name. This example requires two distinct instrument resource names in site order.') + parser.add_argument('-s', '--simulate', default='True', choices=['True', 'False'], help='Whether to run on simulated hardware or real hardware') + args = parser.parse_args(argsv) + example(args.resource_name, 'Simulate=1, DriverSetup=Model:6571' if args.simulate == 'True' else '') + + +def main(): + _main(sys.argv[1:]) + + +def test_example(): + resource_name = 'PXI1Slot2,PXI1Slot3' + options = {'simulate': True, 'driver_setup': {'Model': '6571'}, } + example(resource_name, options) + + +def test_main(): + _main([]) + _main(['--resource-name', 'PXI1Slot4,PXI1Slot5', '--simulate', 'True']) + + +if __name__ == '__main__': + main() From 03c2504fd5c7998ef09f19cabf75af8fa26d0de4 Mon Sep 17 00:00:00 2001 From: "Selvam, Divakar" Date: Wed, 4 Nov 2026 18:48:46 +0530 Subject: [PATCH 4/6] removing self explainatory comments Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../examples/create_pin_map/nidigital_create_pin_map.py | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/nidigital/examples/create_pin_map/nidigital_create_pin_map.py b/src/nidigital/examples/create_pin_map/nidigital_create_pin_map.py index c1b23f8d01..50f61c8695 100644 --- a/src/nidigital/examples/create_pin_map/nidigital_create_pin_map.py +++ b/src/nidigital/examples/create_pin_map/nidigital_create_pin_map.py @@ -36,7 +36,6 @@ def _create_pin_map(resource_name, file_path): connections = ElementTree.SubElement(pin_map, 'Connections') # Both sites share CS on the first instrument; Vcc is a system pin, not a per-site pin. ElementTree.SubElement(connections, 'Connection', pin='CS', siteNumber='0,1', instrument=instruments[0], channel='30') - # Each instrument provides SCL and SDA for one site on channels 0 and 1. for site, instrument in enumerate(instruments): ElementTree.SubElement(sites, 'Site', siteNumber=str(site)) for pin, channel in (('SCL', '0'), ('SDA', '1')): @@ -56,25 +55,20 @@ def example(resource_name, options): # Load the pin map created at runtime, rather than the bundled reference map. session.load_pin_map(pin_map_filename) - # Load the levels and timing sheets created using the Digital Pattern Editor. dir = os.path.dirname(os.path.abspath(__file__)) levels_filename = os.path.join(dir, 'PinLevels.digilevels') timing_filename = os.path.join(dir, 'Timing.digitiming') session.load_specifications_levels_and_timing(levels_file_paths=levels_filename, timing_file_paths=timing_filename) - # Apply the loaded voltage levels and timing settings to the instrument. session.apply_levels_and_timing(levels_filename, timing_filename) - # Load the pattern file created using the Digital Pattern Editor. pattern_filename = os.path.join(dir, 'Pattern.digipat') session.load_pattern(pattern_filename) print('Start bursting pattern') try: - # Burst the pattern and wait until it completes. session.burst_pattern(start_label='new_pattern') finally: - # Disconnect all channels using programmable onboard switching. session.selected_function = nidigital.SelectedFunction.DISCONNECT print('Done bursting pattern') From e48cf5302416088e9721290586a5f028eb1a6e4d Mon Sep 17 00:00:00 2001 From: "Selvam, Divakar" Date: Wed, 4 Nov 2026 18:50:54 +0530 Subject: [PATCH 5/6] Update resource-name argument description Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../examples/create_pin_map/nidigital_create_pin_map.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/nidigital/examples/create_pin_map/nidigital_create_pin_map.py b/src/nidigital/examples/create_pin_map/nidigital_create_pin_map.py index 50f61c8695..0988aca48d 100644 --- a/src/nidigital/examples/create_pin_map/nidigital_create_pin_map.py +++ b/src/nidigital/examples/create_pin_map/nidigital_create_pin_map.py @@ -75,7 +75,7 @@ def example(resource_name, options): def _main(argsv): parser = argparse.ArgumentParser(description='Demonstrates how to create a pin map file, load levels and timing, and burst a pattern on the digital pattern instrument.', formatter_class=argparse.ArgumentDefaultsHelpFormatter) - parser.add_argument('-n', '--resource-name', default='PXI1Slot2,PXI1Slot3', help='The specified resource name shown in Measurement & Automation Explorer (MAX) for a digital pattern instrument, for example, PXI1Slot3, where PXI1Slot3 is an instrument resource name. This example requires two distinct instrument resource names in site order.') + 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. This example requires two distinct instrument resource names in site order.') parser.add_argument('-s', '--simulate', default='True', choices=['True', 'False'], help='Whether to run on simulated hardware or real hardware') args = parser.parse_args(argsv) example(args.resource_name, 'Simulate=1, DriverSetup=Model:6571' if args.simulate == 'True' else '') From c7a7563b1f2441b3ebea58c6340d6f418e43a717 Mon Sep 17 00:00:00 2001 From: "Selvam, Divakar" Date: Thu, 5 Nov 2026 18:01:37 +0530 Subject: [PATCH 6/6] Define system pins and pin connections in variables Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../create_pin_map/nidigital_create_pin_map.py | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/nidigital/examples/create_pin_map/nidigital_create_pin_map.py b/src/nidigital/examples/create_pin_map/nidigital_create_pin_map.py index 0988aca48d..40a7596cc0 100644 --- a/src/nidigital/examples/create_pin_map/nidigital_create_pin_map.py +++ b/src/nidigital/examples/create_pin_map/nidigital_create_pin_map.py @@ -22,25 +22,32 @@ def _create_pin_map(resource_name, file_path): # Pin and group names must match the bundled levels, timing, and pattern files. dut_pins = ('SCL', 'SDA', 'CS') + system_pins = ('Vcc',) + dut_pin_connections = (('SCL', '0'), ('SDA', '1')) + shared_pin_connection = {'pin': 'CS', 'siteNumber': '0,1', 'instrument': instruments[0], 'channel': '30'} + system_pin_connections = (('Vcc', instruments[0], '3'),) + pins = ElementTree.SubElement(pin_map, 'Pins') for pin in dut_pins: ElementTree.SubElement(pins, 'DUTPin', name=pin) - ElementTree.SubElement(pins, 'SystemPin', name='Vcc') + for pin in system_pins: + ElementTree.SubElement(pins, 'SystemPin', name=pin) pin_groups = ElementTree.SubElement(pin_map, 'PinGroups') pin_group = ElementTree.SubElement(pin_groups, 'PinGroup', name='I2C_bus') - for pin in ('Vcc',) + dut_pins: + for pin in system_pins + dut_pins: ElementTree.SubElement(pin_group, 'PinReference', pin=pin) sites = ElementTree.SubElement(pin_map, 'Sites') connections = ElementTree.SubElement(pin_map, 'Connections') # Both sites share CS on the first instrument; Vcc is a system pin, not a per-site pin. - ElementTree.SubElement(connections, 'Connection', pin='CS', siteNumber='0,1', instrument=instruments[0], channel='30') + ElementTree.SubElement(connections, 'Connection', **shared_pin_connection) for site, instrument in enumerate(instruments): ElementTree.SubElement(sites, 'Site', siteNumber=str(site)) - for pin, channel in (('SCL', '0'), ('SDA', '1')): + for pin, channel in dut_pin_connections: ElementTree.SubElement(connections, 'Connection', pin=pin, siteNumber=str(site), instrument=instrument, channel=channel) - ElementTree.SubElement(connections, 'SystemConnection', pin='Vcc', instrument=instruments[0], channel='3') + for pin, instrument, channel in system_pin_connections: + ElementTree.SubElement(connections, 'SystemConnection', pin=pin, instrument=instrument, channel=channel) ElementTree.ElementTree(pin_map).write(file_path, encoding='utf-8', xml_declaration=True)