Repository navigation
Adding SPI example in NI-Digital #2254
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
NI-velmurugan
wants to merge
12
commits into
ni:master
Choose a base branch
from
NI-velmurugan:users/velmurugan/add-nidigital-spi
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
407154f
Adding SPI example in NI-Digital
NI-velmurugan 2c5d745
Fixing the pytest
NI-velmurugan 7923271
Rephrashing comments
NI-velmurugan 39bc16c
Trigger CI build
NI-velmurugan 8808639
Removing self explanatory comments
NI-velmurugan 5ff15cc
Adding Source Waveform example in NI-Digital
NI-velmurugan b151b5e
Revert "Adding Source Waveform example in NI-Digital"
NI-velmurugan 2f84162
Merge branch 'ni:master' into master
NI-velmurugan 041d370
Merge branch 'ni:master' into master
NI-velmurugan d3b40d7
Merge branch 'master' into users/velmurugan/add-nidigital-spi
NI-velmurugan 17c9af0
Renaming the example
NI-velmurugan 7d823b5
Fixing codegen error
NI-velmurugan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| <?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="CS"> | ||
| <Vil>dc.vcc * 0.7</Vil> | ||
| <Vih>0</Vih> | ||
| <Vol>2.5</Vol> | ||
| <Voh>0.5</Voh> | ||
| <Iol>1.5 m</Iol> | ||
| <Ioh>-1.5 m</Ioh> | ||
| <Vcom>0</Vcom> | ||
| <Vterm>0</Vterm> | ||
| <TerminationMode>HighZ</TerminationMode> | ||
| </DigitalPinLevelSet> | ||
| <DigitalPinLevelSet pin="SCLK"> | ||
| <Vil>dc.vcc * 0.7</Vil> | ||
| <Vih>0</Vih> | ||
| <Vol>2.5</Vol> | ||
| <Voh>0.5</Voh> | ||
| <Iol>1.5 m</Iol> | ||
| <Ioh>-1.5 m</Ioh> | ||
| <Vcom>0</Vcom> | ||
| <Vterm>0</Vterm> | ||
| <TerminationMode>HighZ</TerminationMode> | ||
| </DigitalPinLevelSet> | ||
| <DigitalPinLevelSet pin="MOSI"> | ||
| <Vil>dc.vcc * 0.7</Vil> | ||
| <Vih>0</Vih> | ||
| <Vol>2.5</Vol> | ||
| <Voh>0.5</Voh> | ||
| <Iol>1.5 m</Iol> | ||
| <Ioh>-1.5 m</Ioh> | ||
| <Vcom>0</Vcom> | ||
| <Vterm>0</Vterm> | ||
| <TerminationMode>HighZ</TerminationMode> | ||
| </DigitalPinLevelSet> | ||
| <DigitalPinLevelSet pin="MISO"> | ||
| <Vil>dc.vcc * 0.7</Vil> | ||
| <Vih>0</Vih> | ||
| <Vol>2.5</Vol> | ||
| <Voh>0.5</Voh> | ||
| <Iol>1.5 m</Iol> | ||
| <Ioh>-1.5 m</Ioh> | ||
| <Vcom>0</Vcom> | ||
| <Vterm>0</Vterm> | ||
| <TerminationMode>HighZ</TerminationMode> | ||
| </DigitalPinLevelSet> | ||
| </DigitalPinLevelSets> | ||
| </PinLevelsSheet> | ||
| </PinLevelsFile> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| <?xml version="1.0" encoding="utf-8"?> | ||
| <PinMap schemaVersion="1.5" xmlns="http://www.ni.com/TestStand/SemiconductorModule/PinMap.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> | ||
| <Instruments> | ||
| <NIDigitalPatternInstrument name="PXI1Slot2" numberOfChannels="32" group="Digital" /> | ||
| <NIDigitalPatternInstrument name="PXI1Slot3" numberOfChannels="32" group="Digital" /> | ||
| </Instruments> | ||
| <Pins> | ||
| <DUTPin name="CS" /> | ||
| <DUTPin name="SCLK" /> | ||
| <DUTPin name="MOSI" /> | ||
| <DUTPin name="MISO" /> | ||
| </Pins> | ||
| <PinGroups> | ||
| <PinGroup name="SPI_PINS"> | ||
| <PinReference pin="SCLK" /> | ||
| <PinReference pin="CS" /> | ||
| <PinReference pin="MOSI" /> | ||
| <PinReference pin="MISO" /> | ||
| </PinGroup> | ||
| </PinGroups> | ||
| <Sites> | ||
| <Site siteNumber="0" /> | ||
| <Site siteNumber="1" /> | ||
| <Site siteNumber="2" /> | ||
| <Site siteNumber="3" /> | ||
| </Sites> | ||
| <Connections> | ||
| <Connection pin="CS" siteNumber="0" instrument="PXI1Slot2" channel="0" /> | ||
| <Connection pin="SCLK" siteNumber="0" instrument="PXI1Slot2" channel="1" /> | ||
| <Connection pin="MOSI" siteNumber="0" instrument="PXI1Slot2" channel="2" /> | ||
| <Connection pin="MISO" siteNumber="0" instrument="PXI1Slot2" channel="3" /> | ||
| <Connection pin="CS" siteNumber="1" instrument="PXI1Slot2" channel="4" /> | ||
| <Connection pin="CS" siteNumber="2" instrument="PXI1Slot3" channel="0" /> | ||
| <Connection pin="CS" siteNumber="3" instrument="PXI1Slot3" channel="4" /> | ||
| <Connection pin="SCLK" siteNumber="1" instrument="PXI1Slot2" channel="5" /> | ||
| <Connection pin="MOSI" siteNumber="1" instrument="PXI1Slot2" channel="6" /> | ||
| <Connection pin="MISO" siteNumber="1" instrument="PXI1Slot2" channel="7" /> | ||
| <Connection pin="MISO" siteNumber="2" instrument="PXI1Slot3" channel="3" /> | ||
| <Connection pin="MISO" siteNumber="3" instrument="PXI1Slot3" channel="7" /> | ||
| <Connection pin="MOSI" siteNumber="2" instrument="PXI1Slot3" channel="2" /> | ||
| <Connection pin="MOSI" siteNumber="3" instrument="PXI1Slot3" channel="6" /> | ||
| <Connection pin="SCLK" siteNumber="2" instrument="PXI1Slot3" channel="1" /> | ||
| <Connection pin="SCLK" siteNumber="3" instrument="PXI1Slot3" channel="5" /> | ||
| </Connections> | ||
| </PinMap> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| <?xml version="1.0" encoding="utf-8"?> | ||
| <SourceFile Checksum="D2BAABBF12CBC90C7D79BDBE3006E7C3" xmlns="http://www.ni.com/PlatformFramework"> | ||
| <SourceModelFeatureSet> | ||
| <ParsableNamespace AssemblyFileVersion="4.0.0.24189" FeatureSetName="NI Digital Pattern Editor" MinimumParsableVersion="4.0.0.0" MinimumSemanticallyEquivalentVersion="4.0.0.0" Name="http://www.ni.com/PatternBasedDigital" Version="4.0.0.0" /> | ||
| <ParsableNamespace AssemblyFileVersion="4.0.0.24189" FeatureSetName="Editor" MinimumParsableVersion="4.0.0.0" MinimumSemanticallyEquivalentVersion="4.0.0.0" Name="http://www.ni.com/PlatformFramework" Version="4.0.0.29" /> | ||
| <ApplicationVersionInfo Name="Digital Pattern Editor" Version="4.0.0.24189" /> | ||
| </SourceModelFeatureSet> | ||
| <ShmooSetupDefinition xmlns="http://www.ni.com/PatternBasedDigital"> | ||
| <Shmoo Id="1" OutputPath="" PatternName="SPI_Pattern"> | ||
| <ShmooAxisSetup Id="2" Name="X-Axis" PinItems="MISO" ShmooType="CompareStrobe" Start="0 µs" StepSize="10 ns" Stop="1.2 µs" TimeSets="SPI" /> | ||
| <ShmooAxisSetup Id="3" Name="Y-Axis" PinItems="MISO" ShmooType="Voh" Start="2 V" StepSize="0.1 V" Stop="3 V" TimeSets="SPI" /> | ||
| </Shmoo> | ||
| </ShmooSetupDefinition> | ||
| </SourceFile> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| <?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="dc"> | ||
| <f:Formula symbol="vcc"> | ||
| <f:Definition>5</f:Definition> | ||
| <f:Description>V</f:Description> | ||
| </f:Formula> | ||
| </Section> | ||
| <Section name="ac"> | ||
| <f:Formula symbol="period"> | ||
| <f:Definition>1 / 1000000</f:Definition> | ||
| <f:Description>1 MHz</f:Description> | ||
| </f:Formula> | ||
| </Section> | ||
| <Description /> | ||
| </Specifications> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| <?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="SPI"> | ||
| <Period>ac.period</Period> | ||
| <PinEdges> | ||
| <PinEdge pin="CS"> | ||
| <DriveNonReturn> | ||
| <On>0</On> | ||
| <Data>0</Data> | ||
| <Off>ac.period</Off> | ||
| </DriveNonReturn> | ||
| <CompareStrobe> | ||
| <Strobe>(3 * ac.period) / 4</Strobe> | ||
| </CompareStrobe> | ||
| <DataSource>Pattern</DataSource> | ||
| </PinEdge> | ||
| <PinEdge pin="SCLK"> | ||
| <ReturnToLow> | ||
| <On>ac.period / 2</On> | ||
| <Data>ac.period / 2</Data> | ||
| <Return>ac.period</Return> | ||
| <Off>ac.period</Off> | ||
| </ReturnToLow> | ||
| <CompareStrobe> | ||
| <Strobe>(3 * ac.period) / 4</Strobe> | ||
| </CompareStrobe> | ||
| <DataSource>Pattern</DataSource> | ||
| </PinEdge> | ||
| <PinEdge pin="MOSI"> | ||
| <DriveNonReturn> | ||
| <On>0</On> | ||
| <Data>0</Data> | ||
| <Off>ac.period</Off> | ||
| </DriveNonReturn> | ||
| <CompareStrobe> | ||
| <Strobe>(3 * ac.period) / 4</Strobe> | ||
| </CompareStrobe> | ||
| <DataSource>Pattern</DataSource> | ||
| </PinEdge> | ||
| <PinEdge pin="MISO"> | ||
| <DriveNonReturn> | ||
| <On>0</On> | ||
| <Data>0</Data> | ||
| <Off>ac.period</Off> | ||
| </DriveNonReturn> | ||
| <CompareStrobe> | ||
| <Strobe>(3 * ac.period) / 4</Strobe> | ||
| </CompareStrobe> | ||
| <DataSource>Pattern</DataSource> | ||
| </PinEdge> | ||
| </PinEdges> | ||
| </TimeSet> | ||
| </TimeSets> | ||
| </TimingSheet> | ||
| </TimingFile> |
39 changes: 39 additions & 0 deletions
39
src/nidigital/examples/nidigital_spi/nidigital_spi.digiproj
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| <?xml version="1.0" encoding="utf-8"?> | ||
| <SourceFile Checksum="BB0032E819E476A89A56C8757D885885" xmlns="http://www.ni.com/PlatformFramework"> | ||
| <SourceModelFeatureSet> | ||
| <ParsableNamespace AssemblyFileVersion="5.3.1.51258" 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.51258" FeatureSetName="Editor" Name="http://www.ni.com/PlatformFramework" OldestCompatibleVersion="5.2.0.49153" Version="5.2.0.49153" /> | ||
| <ApplicationVersionInfo Build="5.3.1.51258" Name="Digital Pattern Editor" Version="19.0.0" /> | ||
| </SourceModelFeatureSet> | ||
| <Project xmlns="http://www.ni.com/PlatformFramework"> | ||
| <ProjectSettings Id="1" ModelDefinitionType="ProjectSettings" Name="ZProjectSettings" /> | ||
| <NameScopingEnvoy Id="2" ModelDefinitionType="DefaultTarget" Name="DefaultTarget"> | ||
| <DefaultTarget /> | ||
| <FileReference Id="44" ModelDefinitionType="PinLevelsDefinition" Name="PinLevels\.digilevels" StoragePath="PinLevels.digilevels" p4:IsActive="True" xmlns:p4="http://www.ni.com/PatternBasedDigital" /> | ||
| <SourceFileReference Id="45" ModelDefinitionType="ShmooSetupDefinition" Name="Shmoo\.digishmoo" StoragePath="Shmoo.digishmoo" /> | ||
| <FileReference Id="46" ModelDefinitionType="SpecificationsDefinition" Name="Specifications\.specs" StoragePath="Specifications.specs" /> | ||
| <FileReference Id="49" ModelDefinitionType="TimingDefinition" Name="Timing\.digitiming" StoragePath="Timing.digitiming" p4:IsActive="True" xmlns:p4="http://www.ni.com/PatternBasedDigital" /> | ||
| <FileReference Id="56" ModelDefinitionType="PinMap" Name="PinMap\.pinmap" StoragePath="PinMap.pinmap" p4:IsActive="True" xmlns:p4="http://www.ni.com/PatternBasedDigital" /> | ||
| <FileReference Id="57" ModelDefinitionType="DigitalPatternEditor.PatternDefinition" Name="Pattern\.digipat" StoragePath="Pattern.digipat" /> | ||
| <EmbeddedDefinitionReference Id="58" ModelDefinitionType="{http://www.ni.com/PatternBasedDigital}CaptureResultsDefinition" Name="CaptureResults"> | ||
| <CaptureResultsDefinition xmlns="http://www.ni.com/PatternBasedDigital" /> | ||
| </EmbeddedDefinitionReference> | ||
| <EmbeddedDefinitionReference Id="60" ModelDefinitionType="{http://www.ni.com/PatternBasedDigital}BurstResultsDefinition" Name="BurstResults"> | ||
| <BurstResultsDefinition xmlns="http://www.ni.com/PatternBasedDigital" /> | ||
| </EmbeddedDefinitionReference> | ||
| <EmbeddedDefinitionReference Id="62" ModelDefinitionType="{http://www.ni.com/PatternBasedDigital}SystemInfoDefinition" Name="SystemInfo"> | ||
| <SystemInfoDefinition xmlns="http://www.ni.com/PatternBasedDigital" /> | ||
| </EmbeddedDefinitionReference> | ||
| <EmbeddedDefinitionReference Id="63" ModelDefinitionType="{http://www.ni.com/PatternBasedDigital}DigitalScopeDefinition" Name="DigitalScope"> | ||
| <DigitalScopeDefinition xmlns="http://www.ni.com/PatternBasedDigital" /> | ||
| </EmbeddedDefinitionReference> | ||
| </NameScopingEnvoy> | ||
| <EmbeddedDefinitionReference Id="5" ModelDefinitionType="NationalInstruments.ProjectExplorer.Modeling.ProjectDataManager" Name="ProjectExplorer"> | ||
| <ProjectExplorer /> | ||
| </EmbeddedDefinitionReference> | ||
| <EmbeddedDefinitionReference Id="37" ModelDefinitionType="DigitalPatternEditor.ProjectPropertiesDefinition" Name="ProjectProperties"> | ||
| <ProjectPropertiesDefinition xmlns="http://www.ni.com/PatternBasedDigital" /> | ||
| </EmbeddedDefinitionReference> | ||
| </Project> | ||
| <ProjectInformation xmlns="http://www.ni.com/PlatformFramework" /> | ||
| </SourceFile> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| #!/usr/bin/python | ||
|
|
||
| import argparse | ||
| import nidigital | ||
| import os | ||
| import sys | ||
|
|
||
|
|
||
| def example(resource_name, options, start_label='SPI_Pattern'): | ||
|
|
||
| with nidigital.Session(resource_name=resource_name, options=options) as session: | ||
|
|
||
| dir = os.path.join(os.path.dirname(__file__)) | ||
|
|
||
| pin_map_filename = os.path.join(dir, 'PinMap.pinmap') | ||
| session.load_pin_map(pin_map_filename) | ||
|
|
||
| spec_filename = os.path.join(dir, 'Specifications.specs') | ||
| levels_filename = os.path.join(dir, 'PinLevels.digilevels') | ||
| timing_filename = os.path.join(dir, '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(dir, 'Pattern.digipat') | ||
| session.load_pattern(pattern_filename) | ||
|
|
||
| # The returned dictionary maps each site number to its pass/fail result | ||
| site_pass_fail_results = session.burst_pattern(start_label=start_label) | ||
|
|
||
| session.selected_function = nidigital.SelectedFunction.DISCONNECT | ||
|
|
||
| for site, passed in site_pass_fail_results.items(): | ||
| print('Site {}: {}'.format(site, 'Pass' if passed else 'Fail')) | ||
|
|
||
|
|
||
| def _main(argsv): | ||
| parser = argparse.ArgumentParser(description='Demonstrates how to burst an SPI pattern on the digital pattern instrument and display the pass/fail result for each site.', 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('-l', '--start-label', default='SPI_Pattern', help='Pattern label or name of the pattern from which to start bursting.') | ||
| args = parser.parse_args(argsv) | ||
|
|
||
| example(args.resource_name, | ||
| 'Simulate=1, DriverSetup=Model:6570' if args.simulate == 'True' else '', | ||
| args.start_label) | ||
|
|
||
|
|
||
| def main(): | ||
| _main(sys.argv[1:]) | ||
|
|
||
|
|
||
| def test_main(): | ||
| _main([]) | ||
|
|
||
|
|
||
| def test_example(): | ||
| resource_name = 'PXI1Slot2,PXI1Slot3' | ||
| options = {'simulate': True, 'driver_setup': {'Model': '6570'}, } | ||
| start_label = 'SPI_Pattern' | ||
| example(resource_name, options, start_label) | ||
|
|
||
|
|
||
| if __name__ == '__main__': | ||
| main() | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.