CHECKCHAIN

The CHECKCHAIN function checks that the JTAG chains in the current dynamic chains profile are working and that the ID codes of the devices in the chains match those that are expected. This function is generally used as the very first statement in a set of tests to determine if the circuit being tested is connected and configured correctly, and that its JTAG chains are working at a basic level.

The CHECKCHAIN function cannot be used inside either a HOLDOFF block or a raw JTAG block.

Syntax

CHECKCHAIN()

Return value

An INT value indicating the total number of devices found by scanning all active JTAG chains in the current profile. If a JTAG chain is broken, or if one or more ID codes do not match those expected (based on the project's BSDL files), it returns zero. If an incorrect number of devices are found but all chains are intact, the function will return the number of devices actually found.

Example

CheckChain()(INT result)
  INT key;
  INT deviceCount;

  DO
    deviceCount := CHECKCHAIN();
  WHILE deviceCount != CHAIN_DEVICES
    PRINT(CIRCUIT_NAME, " was not correctly detected - check it is attached to the XJLink.\n");
    PRINT("Press space bar to try again, or Q to quit.\n\n");
    DO
      key := WAITKEY();
    UNTIL key = ' ' ||? key = 'q' ||? key = 'Q'
    END;
    IF key != ' ' THEN EXIT; END;
  END;

  result := RESULT_PASS;
END;