Sjors
(Sjors)
December 16, 2025, 10:04am
1
Hello, I’m writing for a X20CP1584 PLC. I’m trying to start a trace from software. I believe I would use MC_BR_ParTrace. But, currently, about 2-3 loops after starting the trace, my MC_BR_ParTrace_0 block goes into error. The errorID is 29217. I believe I have set all input parameters correctly, but is there a way to verify? Or to find out what input parameter is causing the error?
The problem occurs both in simulation and on the PLC itself, so I don’t assume it is something to do with the simulation.
Greetings,
Sjors
Hello,
I never used this Functionblock, so i do not have a valid set of Parameters at hand.
You can check if there is Additional Info in:
This Functionblock has a MC_ERRORRECORD_REF Structure
Network Command Trace
Automation Studio Logger
If this Diagnostic Tools does not have more details, we have to go over each Parameter one by one. Can you share your settings with us?
Greetings
Michael
Sjors
(Sjors)
December 16, 2025, 11:21am
3
Here is my minimal (not)working example:
PROGRAM _CYCLIC
MC_TRACEPARAMS_REF_0[0].Axis := Axis1Obj;
MC_TRACEPARAMS_REF_0[0].ParID := 91; // ENCOD1_S_ACT
MC_TRACETRIGGER_REF_0.Axis := Axis1Obj;
MC_TRACETRIGGER_REF_0.ParID := 91;
MC_TRACETRIGGER_REF_0.Event := mcIN_WINDOW;
MC_TRACETRIGGER_REF_0.Threshold := 1;
MC_TRACETRIGGER_REF_0.Window := 5;
MC_PARTRACE_REF_0.Type := mcMULTI_AXIS_TRACE;
MC_PARTRACE_REF_0.TracingTime := 3;
MC_PARTRACE_REF_0.SamplingTime := 0.001;
MC_PARTRACE_REF_0.Delay := 0;
MC_PARTRACE_REF_0.NetTriggerDelay := 0;
MC_PARTRACE_REF_0.Trigger := MC_TRACETRIGGER_REF_0;
MC_PARTRACE_REF_0.Parameter := MC_TRACEPARAMS_REF_0;
MC_DATOBJ_REF_0.Name := 'TraceOb';
MC_DATOBJ_REF_0.Type := mcFILE;
MC_DATOBJ_REF_0.Format := mcFILE_CSV;
MC_DATOBJ_REF_0.Device := 'USER';
MC_PARTRACECONFIG_REF_0.ParTrace:= MC_PARTRACE_REF_0;
MC_PARTRACECONFIG_REF_0.DatObj := MC_DATOBJ_REF_0;
(************* TRACE STATE MACHINE *************)
CASE traceState OF
(********* Idle *********)
TRACESTATE_IDLE:
IF StartTrace THEN
MC_BR_ParTrace_0.Configuration := MC_PARTRACECONFIG_REF_0;
MC_BR_ParTrace_0.Command := mcSTART;
MC_BR_ParTrace_0.Execute := TRUE;
traceState := TRACESTATE_WAIT_FOR_COMPLETE;
loops := 0;
StartTrace := FALSE;
END_IF
(********* Wait for trace to complete *********)
TRACESTATE_WAIT_FOR_COMPLETE:
loops := loops + 1;
IF MC_BR_ParTrace_0.Done THEN
MC_BR_ParTrace_0.Execute := FALSE;
traceState := TRACESTATE_SAVING;
ELSIF MC_BR_ParTrace_0.Error THEN
traceState := TRACESTATE_ERROR;
END_IF
(************** Save trace to CSV *****************)
TRACESTATE_SAVING:
MC_BR_ParTrace_0.Command := mcSAVE;
MC_BR_ParTrace_0.Execute := TRUE;
traceState := TRACESTATE_SAVED;
(************** Saving finished *****************)
TRACESTATE_SAVED:
IF MC_BR_ParTrace_0.Done THEN
MC_BR_ParTrace_0.Execute := FALSE;
StartTrace := FALSE;
traceState := TRACESTATE_IDLE;
ELSIF MC_BR_ParTrace_0.Error THEN
traceState := TRACESTATE_ERROR;
END_IF
(************** Error *****************)
TRACESTATE_ERROR:
MC_BR_ParTrace_0.ErrorID;
MC_BR_ParTrace_0.Error;
MC_BR_ParTrace_0.ErrorRecord.Info;
MC_BR_ParTrace_0.ErrorRecord.Number;
MC_BR_ParTrace_0.ErrorRecord.ParID;
MC_BR_ParTrace_0.ErrorRecord.Type;
MC_BR_ParTrace_0.Execute := FALSE;
loops;
StartTrace := FALSE;
traceState := TRACESTATE_IDLE;
END_CASE;
MC_BR_ParTrace_0();
END_PROGRAM
These are the values of the MC_ERRORRECORD_REF etc when debugging the error state:
MC_BR_ParTrace_0.ErrorID = 29217
MC_BR_ParTrace_0.Error = 1
MC_BR_ParTrace_0.ErrorRecord.Info = 0
MC_BR_ParTrace_0.ErrorRecord.Number; = 32261
MC_BR_ParTrace_0.ErrorRecord.ParID = 0
MC_BR_ParTrace_0.ErrorRecord.Type = 1
Here is the Network Command Trace window. I’m just realising too, could it be a problem that I don’t have a motor attached? I do have the controller/drive connected via Powerlink.
And here is the Logger, but I don’t think it shows anything helpful:
Thanks for the quick response by the way!
Hello,
i have tried you code in ArSim and it is working without an Error.
Your assumtion that a missing Motor could be the issue, may be possible.
While you do not have the motor ready you can try to set up ACOPOS Simulation and retry.
Side note: You should check the Errors from FB_MC_ReadStatus which indicates issues with a axis structure.
Greetings
Michael
Hi,
MC_BR_ParTrace reports error 29217 in the following cases:
Input “Command” has an invalid value
“Configuration.Type” is not mcMULTI_AXIS_TRACE
After it has set the trace start command internally, the trace stays off (it assumes that is due to invalid parameters)
In your case it seems to be Nr. 3.
Trace does not start after internal start command, due to error 32261.
The other error entries in the network command trace, 29489, tell us that internal values in the axis structure are invalid (overwritte by the application?).
Please check that no init values are set for your axis variables.
Example:
kovarj
(Jaroslav Kovar)
January 5, 2026, 9:29am
6
Hello @Sjors , have you found solution for your issue? I think lot of good advices has been provided.
Sjors
(Sjors)
January 5, 2026, 12:50pm
7
Yes, it is working now. Thanks for the help!
I ran into some other issues too along the way so I don’t remember exacly what the working fix was.