Example Code

NI-Digital Pattern Instrument Synchronization with TestStand Semiconductor Module™

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Software

  • Teststand

Code and Documents

Attachment

Description

This tutorial demonstrates how to use the NI-TClk API to synchronize two digital pattern instruments for use on one site within the TestStand Semiconductor Module (TSM). This example can easily be modified for multiple sites or any other instrument that support NI-TClk synchronization.

Note: This example is for digital pattern instruments that were calibrated in an NI STS.

How to Use

The source files for this tutorial are attached to this document. You will be working with the Synchronize Digital Pattern Instruments sequence file. In there, you will find the usual sequence callbacks: MainSequenceProcessSetup, and ProcessCleanup. Using ProcessSetup and ProcessCleanup is standard procedure when working with TSM. Following this practice ensures that your instruments sessions are properly initialized and closed when running your execution. This tutorial is a simpler version of the Accelerometer example. If you require a more full featured example, refer to the Accelerometer with LabVIEW (Semiconductor Module) help topic. 

Note: For more in-depth information about NI-TClk synchronization, refer to National Instruments NI-TClk Technology for Timing and Synchronization of Modular Instruments

1. Multisite Considerations

When designing test programs, take multisite options into consideration for your hardware configuration. This example uses one thread per subsystem which, for VIs configured for shared clone execution setting, results in one instance of the VI executing for the number of sites in a subsystem. This works for systems where the subsystems are independent but will not work for systems  where a DIB resource pin is shared by the multiple subsystems. If this is the case on your system, consider changing the subsystem configuration in your pinmap such that the shared resource is only owned by one site or by changing the multisite option to one thread per site and using global site data instead to store sessions instead of per site data.

 

2. ProcessSetup

The ProcessSetup sequence initializes the digital pattern sessions and applies timing levels. The reason why synchronization is not done in ProcessSetup is because you cannot store the digital pattern sessions in per site data and guarantee that all sessions will be open for the lifetime of all subsystems. This is why it is done in the Synchronize Digital Instrument Sessions step of the MainSequence.

Open and store NI-Digital Pattern sessions



Figure 1. LabVIEW block diagram for Add NI-Digital Pattern Instrument Sessions.vi showing how to initialize the digital pattern instruments 

 

  1. Get the list of digital pattern instruments from the pin map.
  2. Open NI-Digital Pattern Driver sessions for each instrument in the Semiconductor Module context. Store the open session in the Semiconductor Module context.
  3. Get the pin map path and load the pin map into the driver.
  4. Get the specifications, timing files, and levels files from the digital pattern project and load them into the driver.
  5. Get the patterns from the digital pattern project and load them into the driver.
  6. Get the source waveform files from the digital pattern project and load them into the driver. Data is not written here because it will be generated by the test program.
  7. Get the capture waveform specification files from the digital pattern project and load them into the driver.

Apply Timing and Levels

Figure 2. LabVIEW block diagram for Apply Levels and Timing.vi

 

  1. This VI gets the digital pattern sessions and then sets their timing levels to what is specified in the digital pattern project. Open the Synchronize Digital Pattern Instruments project in Digital Pattern Editor in order to view the timing document and levels document used in this example.

 

3. MainSequence

Figure 3. MainSequence of Synchronize Digital Devices.seq

 

The MainSequence callback is the starting point of your test program. In this example, you synchronize your instruments sessions before you start your test program to ensure that all the instruments are ready . 

Synchronize Instrument Sessions



Figure . LabVIEW block diagram for Synchronize Instruments Sessions.vi showing how to get and store NI-TClk sessions

 

  1. Get list of digital pattern instruments from the pin map.
  2. For each instrument, get its session object for NI-TClk. If you are trying to synchronize multiple instruments types (i.e. a scope and a digital pattern instrument), then you would need to get the session reference to those instruments and append them to the array.
  3. Call the NI-TClk configuration VIs. For more details, refer to the help or visit National Instruments NI-TClk Technology for Timing and Synchronization of Modular Instruments.
  4. Get the number of sites. Set Site Data requires an array element for each site. This ensures that you have the master NI-TClk session for this site.
  5. Initialize an array of variants whose size is equal to the number of sites. Each element is the SAME array of sessions. This gives each site access the same digital pattern sessions. One variant element is one instance of the array of instrument sessions.
  6. Store the array of variants in the site data.

There is no need to synchronize the devices on each run of the sequence. To enforce this, the following precondition is used on the Synchronize NI-Digital Pattern sessions step:

RunState.Caller.Locals.UUT.UUTLoopIndex <= 1

Connect Vref to digital

Figure 4. LabVIEW block diagram for Connect Vref Pin.vi

 

This VI sets the appropriate pins to high or low according to what is defined in the specification files. This step sets the relays to low. The SubVI uses the TSM pin map to find what pins to set and then uses the PPMU functionality on the digital pattern instrument to set the levels on the pin. 

Note: For more information on specification files refer to the Specifications File (Semiconductor Module) help document.

 

  1. This VI gets the Vih or Vil and relay settling time from the specifications file.
  2. Configures the pin to digital high or low.

Test DUT part Number register



Figure 5. LabVIEW Block Diagram using Site Data to get sessions.vi

 

  1. Get the site numbers and convert them to a string of format "site0,site1,....siteN". This is the site list used by the digital pattern driver.
  2. Get the digital pattern instrument sessions stored that were stored in Per Site data. Again, we do this because if we use the Pins to NI-Digital Pattern Sessions VI, there is a chance that we will not get the master TClk session. This would produce a runtime error.
  3. Each element in the array of variants is an array of digital pattern instrument sessions. Each variant element in the variant array is the same. For this reason, it does not matter which variant element we pass into step 4, Burst Pattern (Synchronized).
  4. Call niDigital Burst Pattern (Synchronized). This will burst a pattern on the digital pattern instruments that were synchronized using NI-TClk. The site list passed from the Get Site Numbers VI ensure we only burst on active sites.
  5. In order to get the pin query context to publish the results, you need to call Pins to the NI-Digital Pattern Sessions VI.
  6. Get the pass/fail results for each site. Be sure to use the digital pattern instrument sessions from Get Site Data.
  7. Publish the results.

 

4. ProcessCleanup

Close NI-Digital Pattern sessions

Figure 6. LabVIEW block diagram for Close NI-Digital Pattern Instrument Session.vi

 

This VI gets all of the digital pattern instrument sessions from the Semiconductor Module context, resets the instruments, and then closes the sessions. 

When you run this sequence, you will burst a simple pattern to your DUT. This example only has one pattern and that pattern uses both the digital pattern instruments. You can modify this example to fit your requirements by editing the pin map file to match your hardware configuration and add your own patterns in the digital pattern project. 

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Contributors