Integrating XJTAG into Your Own .NET Programs

XJIntegration is a .NET DLL that allows other .NET programs to open XJPack files (XJRunner projects) and to run the tests and functions they contain. Calling programs can easily obtain test results and integrate them into part of a larger test environment. XJIntegration also allows an XJAnalyser-style interface to be used to control individual pins and to read their values.

XJRunner Integration and XJAnalyser Integration can therefore be used in applications written in C# or other languages using the .NET framework. Python code can also make use of this by, for example, utilising third-party software such as Python.NET.

A set of training videos is available in the XJTAG Academy.

Languages that can interact with Microsoft’s .NET Framework, such as C#, Visual Basic, F#, and Microsoft C++/CLI, can access data structures and methods that allow XJTAG projects to be opened and their tests to be run.

To help you implement the features of XJRunner Integration and XJAnalyser Integration in your own test programs, the standard XJTAG installation comes with example C# files that are heavily commented. They can be freely copied to form additions to your code or used to help understand the principles that apply.

Code Examples Using XJRunner Integration

The C# files demonstrate how to create an XJLink instance and open a project, and how subsequently to use XJIntegration’s most important methods and events. They include examples of using XJRunner Integration to perform the following:

  • Running the project’s complete test list with its default settings
  • Running one particular test from the project’s test list
  • Modifying the default settings that came from the test list
  • Calling an underlying XJEase function rather than a complete test
  • Returning control before a test has completed

Code Examples Using XJAnalyser Integration

The files include examples of using XJAnalyser Integration that show how to perform the following:

  • Starting, pausing, and stopping the JTAG chain
  • Accessing details of individual pins on the JTAG devices
  • Setting and reading pins

Code Examples for Using Window Forms with XJIntegration

Another example is included that demonstrates how to use the XJIntegration assembly to set up a dialog using XJTAG output. It shows how to:

  • Load an XJRunner project
  • Populate a TreeView with the project’s tests
  • Use a checkbox to show which tests will run
  • Run selected tests using the TreeView
  • Stop testing early
C# code example

Using XJIntegration With Python

Because XJIntegration is a .NET DLL, your Python code can access XJTAG’s powerful boundary scan functionality by using IronPython or third-party software such as Python.NET.

You can then open an XJPack file and run its boundary scan tests and functions from your code. If you’re using Python to create your own test executive, XJIntegration provides the perfect way to incorporate JTAG boundary scan in your production test process.

Calling XJTAG From Python in Console Applications

The standard XJTAG installation comes with heavily commented example Python code that demonstrates how to use Python.NET to access the .NET framework and call the XJRunner Integration methods. The main example is based around testing the XJDemo board and illustrates how to perform the following:

  • Adding the XJTAG install to the system path and referencing XJIntegration.dll
  • Opening an XJPack file
  • Initialising the JTAG controller
  • Error handling
  • How to incorporate user interaction during a test via the console
  • Running a test list that was created in XJDeveloper
  • Displaying test results in the console
  • Selecting and deselecting tests from the test list
Python code example

How to Call XJEase Functions from Your Python Script

The examples also demonstrate how you can call XJEase functions directly from the project rather than running tests from the test list, and how to use .NET arrays for a function’s input and output arguments.

Using Windows Forms to Host the XJTAG Output Box

Another example demonstrates how to use a graphical I/O box rather than the Python console interface. This can be used to provide more detailed text output, closer in style to XJRunner’s.

The example shows how to create an application window that hosts an output box by using the .NET framework’s Windows Forms library with Python.NET. It illustrates this by displaying the XJLink2’s self-test results in an XJTAG output box, which also handles the tests’ user input.

Locating Example Code

Example code in C# and Python can be found in directories below XJIntegration .NET Examples in the XJTAG Shared Files folder. Search the Help System for “Directory Structure” for assistance in locating it. The Python files are available in XJTAG version 3.11.3 and later.

Ready to get started? Try XJTAG

computer

See XJTAG in action.

Our experts will be happy to show you how the XJTAG tools can help you diagnose faults on your board as well as cutting test development and repair time.

Ask for a Demo

contact us icon

Questions? Contact us!

We're here to help.
Send us a message and one of our test specialists will get back to you shortly.

Contact us

workstation

Get a free test setup.

Evaluate the XJTAG system with full functionality for 30 days and get the first test project set up for your board – for free. No obligation to purchase.

Get started now

Join world leading companies using XJTAG Boundary Scan