Ritz
Ritz

Reputation: 1253

How do I get feedback from T32 after running cmm scripts?

I am running a T32 CMM script as below via command line(putting in a python wrapper) however I would like to know the status of T32 whether the script has been running successfully or was there an error,how can I that feedback from T32?

cd C:\T32\bin\windows64

Config.t32:

RCL=NETASSIST
PORT=20000
PACKLEN=1024

; Environment variables
OS=
ID=T32
TMP=C:\Users\jhigh\AppData\Local\Temp
SYS=C:\T32


PBI=
USB

; Printer settings 
PRINTER=WINDOWS

USAGE:-

t32marm.exe -s c:\Temp\vi_chip_cmd_line.cmm \\Filerlocation\data\files

enter image description here

enter image description here

Upvotes: 0

Views: 4265

Answers (2)

dev15
dev15

Reputation: 750

Please check your T32 installation for a demo on how to use the T32 API (demo/api/python). Keep in mind that it will not work without a valid license. It's also important that if you use Python inside 32-bit cygwin on a 64-bit host you need to load the 32-bit DLL.

Configuration:

RCL=NETASSIST
PORT=20000
PACKLEN=1024

Python script:

import platform
import ctypes

# Adjust the path / name to the DLL
t32api = ctypes.CDLL("./t32api64.dll")

t32api.T32_Config(b"NODE=",b"localhost")
t32api.T32_Config(b"PORT=",b"20000")
t32api.T32_Config(b"PACKLEN=",b"1024")

t32api.T32_Init()
t32api.T32_Attach(1)
t32api.T32_Ping()

t32api.T32_Cmd(b"AREA")

t32api.T32_Exit()

Then you can use the commands / techniques that Holger has suggested:

T32_GetPracticeState()

to get the current run-state of PRACTICE. And / or set a variable inside your script

Var.Assign \state=1
Var.Assign \state=2
....

and then poll it using T32_ReadVariableValue()

Upvotes: 1

Holger
Holger

Reputation: 4183

The TRACE32 "API for Remote Control and JTAG Access" allows you to communicate with a running TRACE32 application.

To enable the API for your TRACE32 application, just add the following two lines to your TRACE32 start-configuration file ("config.t32"). Empty lines before and after the two lines are mandatory.

RCL=NETASSIST
PORT=20000

The usage of the API is described in the PDF api_remote.pdf, which is in the PDF folder of your TRACE32 installation or you can download it from http://www.lauterbach.com/manual.html

You can find examples on how to use the remote API with Python at http://www.lauterbach.com/scripts.html (Just search the page for "Python")

To check if your PRACTICE script ("vi_chip_cmd_line.cmm") is still running, use the API function T32_GetPracticeState();

I also suggest to create an artificial variable in the beginning of your script with Var.NEWGLOBAL int \state. During your scripted test, set the variable "\state" to increasing values with Var.Set \state=42. Via the TRACE32 command EVAL Var.VALUE(\state) and API call T32_EvalGet() you can get the current value of the variable "\state" and by doing so, you can check, if your script reached its final state.

Another approach would be to write a log-file from your PRACTICE script ("vi_chip_cmd_line.cmm") by using the TRACE32 command APPEND and read the log file from your Python script.

Upvotes: 3

Related Questions