Contenido principal

jtagchain

R2026b

Detect and program FPGA through JTAG interface

Since R2026b

Description

The jtagchain object detects an FPGA device connected to a JTAG cable and loads a bit file onto the FPGA using the specified toolchain.

The jtagchain object automatically scans devices connected to a JTAG cable and identifies FPGA devices along with their positions in the JTAG chain. Device information is available in the Devices property. If the connected JTAG cable or devices change after you create the object, use the scan object function to rescan the JTAG chain and update the Devices property. Use the programFPGA object function to program a selected FPGA device.

Creation

Description

jtagObj = jtagchain(Vendor) returns an object, jtagObj, that detects and programs the FPGA device through the JTAG interface. Vendor specifies the name of the FPGA chip vendor.

example

jtagObj = jtagchain(Vendor,Name=Value) sets properties using one or more name-value arguments.

Input Arguments

expand all

Name of the FPGA chip vendor, specified as "AMD", "Altera", or "Microchip".

Example: "AMD"

Data Types: char | string

Name-Value Arguments

expand all

Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

Example: jtagObj = jtagchain("AMD",CableType="FTDI",CableName="auto",TckFrequency="15") creates a jtagchain object, jtagObj, for an AMD® device. It sets the JTAG cable type to FTDI, JTAG cable name to auto, and JTAG clock frequency to 15 MHz.

Type of JTAG cable to use for communication with the FPGA device, specified as 'auto', 'FTDI', or 'PLUSBII'. Specify this argument for an AMD device and if more than one JTAG cable is connected to the development computer.

  • "auto" — The jtagchain object autodetects the JTAG cable type in this order:

    • The object first searches for a Digilent® cable.

    • If the object does not find a Digilent cable, it searches for an FTDI cable.

    • If the object does not find an FTDI cable, it searches for a Platform Cable USB II.

    • If the object does not find a Platform Cable USB II, it returns an error. To resolve this error, connect a Digilent cable, an FTDI cable, or a Platform Cable USB II.

    • If the object finds two cables of the same type, it returns an error. To resolve this error, specify the desired cable name by using the CableName argument.

    • If the object finds two cables of different types, it prioritizes a Digilent cable over an FTDI cable and a Platform Cable USB II. It prioritizes an FTDI cable over a Platform Cable USB II.

  • "FTDI" — The jtagchain object uses an FTDI cable for communication with the FPGA device.

  • 'PLUSBII' — The aximanager object uses a Platform Cable USB II for communication with the FPGA device.

Example: "FTDI"

Data Types: char | string

Name of the JTAG cable to use for communication with the FPGA device, specified as a character vector or string scalar representing a JTAG cable name. Specify this argument if more than one JTAG cable of the same type is connected to the development computer. If the development computer has more than one JTAG cable and you do not specify this property, the object returns an error. The error message contains the names of the available JTAG cables.

Example: "auto"

Data Types: char | string

JTAG clock frequency, specified in MHz as an integer from 0 to 33. Specify this argument for an AMD device. The JTAG frequency depends on the type of cable and the maximum clock frequency supported by the FPGA device. Check the device documentation for maximum frequency.

Example: 33

Data Types: uint8 | fi

Output Arguments

expand all

Instance of JTAG chain object, returned as a jtagchain object.

Example: jtagObj

Properties

expand all

This property is read-only.

Name of the FPGA chip vendor, specified as "AMD", "Altera", or "Microchip".

Example: "AMD"

Data Types: char | string

This property is read-only.

FPGA devices detected in the JTAG chain, specified as an n-by-3 table, where n is the number of FPGA devices connected to the JTAG cable. The first column shows the FPGA position in the JTAG scan chain, the second column shows the FPGA manufacturer, and the third column shows the FPGA part number.

The jtagchain object automatically populates this property when you create the object, and the scan object function updates it when you rescan the JTAG chain.

Data Types: table

Object Functions

scanDetect devices connected to a JTAG chain
programFPGAProgram FPGA device through JTAG connection

Examples

collapse all

This example shows how to create a jtagchain object, view information about devices detected in the JTAG chain, rescan the chain when the hardware configuration changes, and program a selected FPGA device.

First, set your system environment for accessing Altera® tools from MATLAB® by using the hdlsetuptoolpath function.

hdlsetuptoolpath('ToolName','Altera Quartus II',...
                 'ToolPath','C:\altera\24.1\quartus\bin\quartus.exe');

Create a jtagchain object for Altera devices. When you create the object, the constructor automatically scans the JTAG chain and populates the Devices property with information about the detected devices.

jtagObj = jtagchain("Altera")
### Checking Quartus tool

jtagObj =

  JTAGChain with properties:

          Vendor: "Altera"
       CableName: "auto"
         Devices: [1×3 table]

The Devices property contains the devices detected in the JTAG chain.

jtagObj.Devices
ans =

  1×3 table

    ChainPosition         Manufacturer               Part
    _____________    _______________________    _____________

          1          "Intel (Altera FPGA)"     "5CSEMA5F31"

If the connected JTAG cable or devices change, use the scan object function to rescan the JTAG chain and update the Devices property.

scan(jtagObj)

View the updated device information.

jtagObj.Devices

After identifying the devices in the JTAG chain, program the FPGA using the programming file /dir/mybitstream.sof at JTAG chain position 1.

programFPGA(jtagObj,'/dir/mybitstream.sof',JTAGChainPosition=1);

Version History

Introduced in R2026b

See Also

|