Introduction
The Tektronix TSP™ Toolkit is an open-source Microsoft™ Visual Studio Code™ extension that provides support for Tektronix's Test Script Processor (TSP) technology to edit and execute scripts on TSP-enabled Tektronix instruments.
The extension includes language features such as syntax error detection, code navigation, and code-completion suggestions, as well as .tsp command set documentation and hover help.
This guide will show you how to:
- Install the TSP Toolkit extension
- Set up your workspace
- Connect to an instrument
- Configure a project
- Run a .tsp script
- Use the Terminal
- Use the debugger
- Use automated (beta) TSP script generation
- Download and use .tsp example scripts
? You can download Visual Studio Code from https://code.visualstudio.com/.
Install the TSP Toolkit extension
? Before installing the extension from the Marketplace, select Help > Check for Updates to make sure that you have the most recent version of Visual Studio Code. If you are using Microsoft Windows, be sure to also have the latest Visual C++ Redistributable library installed.
To install the extension from the Visual Studio Code Marketplace:
- Select the extensions icon ?. Figure 1: Extensions icon
- Select the search icon ?, then enter
tektronix.tsp-toolkit
in the search field. Figure 2: Searching for the TSP Toolkit - Select Figure 3: Installing the TSP Toolkit under the Tektronix TSP Toolkit.
- The extension will install. Reload the window if you are prompted.
Set up your workspace
To set up your workspace in Visual Studio Code:
- Select the explorer icon ?. Figure 4: Selecting the Explorer
- Select File.
- Select Open Folder... to select a folder or create a new folder to use as your workspace. Figure 5: Opening a folder
In your workspace, use the New File and New Folder icons ➕ to create new .tsp files and subfolders. Figure 6: New File and New Folder icons
Connect to an instrument
You can connect your TSP-enabled instrument to your computer with a LAN, GPIB, or USB connection. GPIB and USB connections require a VISA driver.
To connect to a TSP-enabled instrument:
- Select the TSP icon ? on the left of the screen to open the instrument pane. Figure 7: Selecting the TSP icon
- Hover over the instrument you want to connect to, then your instrument, then select Connect ▶️. Figure 8: Selecting the Connect icon
If the connection was successful, a terminal window opens, and your instrument's *IDN? string will be displayed.
Configure a project
You can configure your project to have language features enabled for your TSP instruments and TSP-Link node network.
To configure a project:
- Select the TSP icon ? on the left of the screen to open the Instruments pane.
- Be sure that the System Configurations pane is selected. Figure 9: System Configurations selected
- Select the instrument tree icon ? to fetch the connected instrument and its TSP-Link nodes. Figure 10: Instrument tree icon
- If you do not have a connected instrument, select the add icon ➕ to manually add a new system. Figure 11: Adding a new system configuration
- Define your test system, then select Figure 12: Defining the system configuration .
When your project is configured, you are shown relevant code-completion suggestions, signature help, and command documentation for your connected instruments.
Run a .tsp script
To run a .tsp script:
- Open a .tsp script in the editor by clicking on it in the workspace or by selecting File > Open File.
- Right-click anywhere within the script editor to display the context menu.
- Select Send Script to Terminal to run the script. Figure 13: Running a .tsp script
Using the Terminal
? When scripts or commands are run from the Terminal, errors are only fetched after the requested action completes. No new errors are printed while the operation is in progress.
Once you have established a connection with your instrument, the Terminal can be used to send .tsp commands and run .tsp scripts.
To close the Terminal and disconnect from the instrument, send the .exit
command.
Figure 14: TSP Terminal window
Using the debugger
To debug a TSP script using the TSP Toolkit extension:
- Add a breakpoint by clicking to the left of a line number. Figure 15: Adding a breakpoint
- In the upper-right corner of the script editor, select Figure 16: Starting the debugger . The script will run until the breakpoint is triggered.
- When the breakpoint is triggered, use the debugger controls ⏯️▶️⏹️ to step through the script. Figure 17: Debugger controls
- You can navigate to the Debug view at any time by selecting Run and Debug ⚙️. Figure 18: Selecting Run and Debug
To add expressions to the Watch pane:
- Select the add icon ➕ in the top right corner. Figure 19: Adding to the Watch pane
- Enter the variable, command, or expression you wish to monitor, then press <Enter>.
- You can also highlight the expression within the script, then right-click and select Add to Watch. Figure 20: Selecting Add to Watch
Using automated (beta) TSP script generation
? This feature is only compatible with the Tektronix MP5000 Series SMU and PSU modules.
To create a TSP script using the Script Generation UI:
- From the Explorer pane, select the Script Generation panel.
- Select ➕ to view the TSP Toolkit Script Generation user interface. Figure 21: Selecting the View Script Generation UI
- Use the UI controls to configure the source and measure settings. The waveform previews can be used to verify that the settings will give the desired sourcing behavior. Figure 22: Using the Script Generation user interface to configure an IV test
- When you are finished adjusting parameters, select Figure 23: Opening the script .
- The generated script will be displayed in a new editor tab. You can run, save, or edit the script.
Downloading and using TSP example scripts
Example TSP Scripts are available for download on the TSP GitHub Repository.
To download and use a script:
- Select either the
Application_Specific
orInstrument_Examples
folder to find .tsp scripts. Figure 24: GitHub .tsp script site - Navigate the folders to find example scripts organized by instrument and application.
- You can click on a script to view the code within GitHub. Select the download icon ⬇️ to copy the script to your computer. Figure 25: Downloading a script
- When the download is finished, copy the script to your TSP Toolkit Workspace file location. Figure 26: Script in Workspace
Additional resources and tutorials
- Application note: How to write scripts for TSP
- Tektronix TSP GitHub script example repository
- TSP page on Tek.com
- TSP Toolkit feature walkthrough video
- TSP Toolkit product page
- TSP video series