ethercatprint.c
Go to the documentation of this file.
1 /*
2  * Licensed under the GNU General Public License version 2 with exceptions. See
3  * LICENSE file in the project root for full license information
4  */
5 
15 #include <stdio.h>
16 #include "oshw.h"
17 #include "ethercattype.h"
18 #include "ethercatmain.h"
19 
20 #define EC_MAXERRORNAME 127
21 
23 typedef struct
24 {
28  char errordescription[EC_MAXERRORNAME + 1];
30 
32 typedef struct
33 {
37  char ALstatuscodedescription[EC_MAXERRORNAME + 1];
39 
41 typedef struct
42 {
46  char errordescription[EC_MAXERRORNAME + 1];
48 
50 typedef struct
51 {
55  char errordescription[EC_MAXERRORNAME + 1];
57 
59 
62  {0x00000000, "No error" },
63  {0x05030000, "Toggle bit not changed" },
64  {0x05040000, "SDO protocol timeout" },
65  {0x05040001, "Client/Server command specifier not valid or unknown" },
66  {0x05040005, "Out of memory" },
67  {0x06010000, "Unsupported access to an object" },
68  {0x06010001, "Attempt to read to a write only object" },
69  {0x06010002, "Attempt to write to a read only object" },
70  {0x06010003, "Subindex can not be written, SI0 must be 0 for write access" },
71  {0x06010004, "SDO Complete access not supported for variable length objects" },
72  {0x06010005, "Object length exceeds mailbox size" },
73  {0x06010006, "Object mapped to RxPDO, SDO download blocked" },
74  {0x06020000, "The object does not exist in the object directory" },
75  {0x06040041, "The object can not be mapped into the PDO" },
76  {0x06040042, "The number and length of the objects to be mapped would exceed the PDO length" },
77  {0x06040043, "General parameter incompatibility reason" },
78  {0x06040047, "General internal incompatibility in the device" },
79  {0x06060000, "Access failed due to a hardware error" },
80  {0x06070010, "Data type does not match, length of service parameter does not match" },
81  {0x06070012, "Data type does not match, length of service parameter too high" },
82  {0x06070013, "Data type does not match, length of service parameter too low" },
83  {0x06090011, "Subindex does not exist" },
84  {0x06090030, "Value range of parameter exceeded (only for write access)" },
85  {0x06090031, "Value of parameter written too high" },
86  {0x06090032, "Value of parameter written too low" },
87  {0x06090036, "Maximum value is less than minimum value" },
88  {0x08000000, "General error" },
89  {0x08000020, "Data cannot be transferred or stored to the application" },
90  {0x08000021, "Data cannot be transferred or stored to the application because of local control" },
91  {0x08000022, "Data cannot be transferred or stored to the application because of the present device state" },
92  {0x08000023, "Object dictionary dynamic generation fails or no object dictionary is present" },
93  {0xffffffff, "Unknown" }
94 };
95 
98  {0x0000 , "No error" },
99  {0x0001 , "Unspecified error" },
100  {0x0002 , "No memory" },
101  {0x0011 , "Invalid requested state change" },
102  {0x0012 , "Unknown requested state" },
103  {0x0013 , "Bootstrap not supported" },
104  {0x0014 , "No valid firmware" },
105  {0x0015 , "Invalid mailbox configuration" },
106  {0x0016 , "Invalid mailbox configuration" },
107  {0x0017 , "Invalid sync manager configuration" },
108  {0x0018 , "No valid inputs available" },
109  {0x0019 , "No valid outputs" },
110  {0x001A , "Synchronization error" },
111  {0x001B , "Sync manager watchdog" },
112  {0x001C , "Invalid sync Manager types" },
113  {0x001D , "Invalid output configuration" },
114  {0x001E , "Invalid input configuration" },
115  {0x001F , "Invalid watchdog configuration" },
116  {0x0020 , "Slave needs cold start" },
117  {0x0021 , "Slave needs INIT" },
118  {0x0022 , "Slave needs PREOP" },
119  {0x0023 , "Slave needs SAFEOP" },
120  {0x0024 , "Invalid input mapping" },
121  {0x0025 , "Invalid output mapping" },
122  {0x0026 , "Inconsistent settings" },
123  {0x0027 , "Freerun not supported" },
124  {0x0028 , "Synchronisation not supported" },
125  {0x0029 , "Freerun needs 3buffer mode" },
126  {0x002A , "Background watchdog" },
127  {0x002B , "No valid Inputs and Outputs" },
128  {0x002C , "Fatal sync error" },
129  {0x002D , "No sync error" }, // was "Invalid Output FMMU Configuration"
130  {0x002E , "Invalid input FMMU configuration" },
131  {0x0030 , "Invalid DC SYNC configuration" },
132  {0x0031 , "Invalid DC latch configuration" },
133  {0x0032 , "PLL error" },
134  {0x0033 , "DC sync IO error" },
135  {0x0034 , "DC sync timeout error" },
136  {0x0035 , "DC invalid sync cycle time" },
137  {0x0036 , "DC invalid sync0 cycle time" },
138  {0x0037 , "DC invalid sync1 cycle time" },
139  {0x0041 , "MBX_AOE" },
140  {0x0042 , "MBX_EOE" },
141  {0x0043 , "MBX_COE" },
142  {0x0044 , "MBX_FOE" },
143  {0x0045 , "MBX_SOE" },
144  {0x004F , "MBX_VOE" },
145  {0x0050 , "EEPROM no access" },
146  {0x0051 , "EEPROM error" },
147  {0x0060 , "Slave restarted locally" },
148  {0x0061 , "Device identification value updated" },
149  {0x00f0 , "Application controller available" },
150  {0xffff , "Unknown" }
151 };
152 
155  {0x0000, "No error" },
156  {0x1001, "No IDN" },
157  {0x1009, "Invalid access to element 1" },
158  {0x2001, "No Name" },
159  {0x2002, "Name transmission too short" },
160  {0x2003, "Name transmission too long" },
161  {0x2004, "Name cannot be changed (read only)" },
162  {0x2005, "Name is write-protected at this time" },
163  {0x3002, "Attribute transmission too short" },
164  {0x3003, "Attribute transmission too long" },
165  {0x3004, "Attribute cannot be changed (read only)" },
166  {0x3005, "Attribute is write-protected at this time" },
167  {0x4001, "No units" },
168  {0x4002, "Unit transmission too short" },
169  {0x4003, "Unit transmission too long" },
170  {0x4004, "Unit cannot be changed (read only)" },
171  {0x4005, "Unit is write-protected at this time" },
172  {0x5001, "No minimum input value" },
173  {0x5002, "Minimum input value transmission too short" },
174  {0x5003, "Minimum input value transmission too long" },
175  {0x5004, "Minimum input value cannot be changed (read only)" },
176  {0x5005, "Minimum input value is write-protected at this time" },
177  {0x6001, "No maximum input value" },
178  {0x6002, "Maximum input value transmission too short" },
179  {0x6003, "Maximum input value transmission too long" },
180  {0x6004, "Maximum input value cannot be changed (read only)" },
181  {0x6005, "Maximum input value is write-protected at this time" },
182  {0x7002, "Operation data transmission too short" },
183  {0x7003, "Operation data transmission too long" },
184  {0x7004, "Operation data cannot be changed (read only)" },
185  {0x7005, "Operation data is write-protected at this time (state)" },
186  {0x7006, "Operation data is smaller than the minimum input value" },
187  {0x7007, "Operation data is smaller than the maximum input value" },
188  {0x7008, "Invalid operation data:Configured IDN will not be supported" },
189  {0x7009, "Operation data write protected by a password" },
190  {0x700A, "Operation data is write protected, it is configured cyclically" },
191  {0x700B, "Invalid indirect addressing: (e.g., data container, list handling)" },
192  {0x700C, "Operation data is write protected, due to other settings" },
193  {0x700D, "Reserved" },
194  {0x7010, "Procedure command already active" },
195  {0x7011, "Procedure command not interruptible" },
196  {0x7012, "Procedure command at this time not executable (state)" },
197  {0x7013, "Procedure command not executable (invalid or false parameters)" },
198  {0x7014, "No data state" },
199  {0x8001, "No default value" },
200  {0x8002, "Default value transmission too long" },
201  {0x8004, "Default value cannot be changed, read only" },
202  {0x800A, "Invalid drive number" },
203  {0x800A, "General error" },
204  {0x800A, "No element addressed" },
205  {0xffff, "Unknown" }
206 };
207 
210  {0x0000, "No error" },
211  {0x0001, "Syntax of 6 octet Mailbox Header is wrong" },
212  {0x0002, "The mailbox protocol is not supported" },
213  {0x0003, "Channel Field contains wrong value"},
214  {0x0004, "The service is no supported"},
215  {0x0005, "Invalid mailbox header"},
216  {0x0006, "Length of received mailbox data is too short"},
217  {0x0007, "No more memory in slave"},
218  {0x0008, "The length of data is inconsistent"},
219  {0xffff, "Unknown"}
220 };
221 
227 const char* ec_sdoerror2string( uint32 sdoerrorcode)
228 {
229  int i = 0;
230 
231  while ( (ec_sdoerrorlist[i].errorcode != 0xffffffffUL) &&
232  (ec_sdoerrorlist[i].errorcode != sdoerrorcode) )
233  {
234  i++;
235  }
236 
238 }
239 
245 char* ec_ALstatuscode2string( uint16 ALstatuscode)
246 {
247  int i = 0;
248 
249  while ( (ec_ALstatuscodelist[i].ALstatuscode != 0xffff) &&
250  (ec_ALstatuscodelist[i].ALstatuscode != ALstatuscode) )
251  {
252  i++;
253  }
254 
255  return (char *) ec_ALstatuscodelist[i].ALstatuscodedescription;
256 }
257 
263 char* ec_soeerror2string( uint16 errorcode)
264 {
265  int i = 0;
266 
267  while ( (ec_soeerrorlist[i].errorcode != 0xffff) &&
268  (ec_soeerrorlist[i].errorcode != errorcode) )
269  {
270  i++;
271  }
272 
273  return (char *) ec_soeerrorlist[i].errordescription;
274 }
275 
281 char* ec_mbxerror2string( uint16 errorcode)
282 {
283  int i = 0;
284 
285  while ( (ec_mbxerrorlist[i].errorcode != 0xffff) &&
286  (ec_mbxerrorlist[i].errorcode != errorcode) )
287  {
288  i++;
289  }
290 
291  return (char *) ec_mbxerrorlist[i].errordescription;
292 }
293 
299 char* ecx_err2string(const ec_errort Ec)
300 {
301  char timestr[20];
302  sprintf(timestr, "Time:%12.3f", Ec.Time.sec + (Ec.Time.usec / 1000000.0) );
303  switch (Ec.Etype)
304  {
306  {
307  sprintf(estring, "%s SDO slave:%d index:%4.4x.%2.2x error:%8.8x %s\n",
308  timestr, Ec.Slave, Ec.Index, Ec.SubIdx, (unsigned)Ec.AbortCode, ec_sdoerror2string(Ec.AbortCode));
309  break;
310  }
312  {
313  sprintf(estring, "%s EMERGENCY slave:%d error:%4.4x\n",
314  timestr, Ec.Slave, Ec.ErrorCode);
315  break;
316  }
318  {
319  sprintf(estring, "%s PACKET slave:%d index:%4.4x.%2.2x error:%d\n",
320  timestr, Ec.Slave, Ec.Index, Ec.SubIdx, Ec.ErrorCode);
321  break;
322  }
324  {
325  sprintf(estring, "%s SDO slave:%d index:%4.4x.%2.2x error:%8.8x %s\n",
326  timestr, Ec.Slave, Ec.Index, Ec.SubIdx, (unsigned)Ec.AbortCode, ec_sdoerror2string(Ec.AbortCode));
327  break;
328  }
330  {
331  sprintf(estring, "%s SoE slave:%d IDN:%4.4x error:%4.4x %s\n",
332  timestr, Ec.Slave, Ec.Index, (unsigned)Ec.AbortCode, ec_soeerror2string(Ec.ErrorCode));
333  break;
334  }
336  {
337  sprintf(estring, "%s MBX slave:%d error:%4.4x %s\n",
338  timestr, Ec.Slave, Ec.ErrorCode, ec_mbxerror2string(Ec.ErrorCode));
339  break;
340  }
341  default:
342  {
343  sprintf(estring, "%s error:%8.8x\n",
344  timestr, (unsigned)Ec.AbortCode);
345  break;
346  }
347  }
348  return (char*) estring;
349 }
350 
357 {
358  ec_errort Ec;
359 
360  if (ecx_poperror(context, &Ec))
361  {
362  return ecx_err2string(Ec);
363  }
364  else
365  {
366  return "";
367  }
368 }
369 
370 #ifdef EC_VER1
371 char* ec_elist2string(void)
372 {
373  return ecx_elist2string(&ecx_context);
374 }
375 #endif
ec_ALstatuscodelist
const ec_ALstatuscodelist_t ec_ALstatuscodelist[]
Definition: ethercatprint.c:97
ec_sdoerrorlist_t::errordescription
char errordescription[EC_MAXERRORNAME+1]
Definition: ethercatprint.c:28
estring
char estring[EC_MAXERRORNAME]
Definition: ethercatprint.c:58
ec_mbxerror2string
char * ec_mbxerror2string(uint16 errorcode)
Definition: ethercatprint.c:281
ec_soeerrorlist_t::errorcode
uint16 errorcode
Definition: ethercatprint.c:44
ethercatmain.h
Headerfile for ethercatmain.c.
EC_ERR_TYPE_PACKET_ERROR
@ EC_ERR_TYPE_PACKET_ERROR
Definition: ethercattype.h:466
uint32
uint32_t uint32
Definition: osal.h:30
EC_ERR_TYPE_SOE_ERROR
@ EC_ERR_TYPE_SOE_ERROR
Definition: ethercattype.h:471
ec_ALstatuscodelist_t
Definition: ethercatprint.c:32
ec_errort::SubIdx
uint8 SubIdx
Definition: ethercattype.h:489
ec_ALstatuscodelist_t::ALstatuscodedescription
char ALstatuscodedescription[EC_MAXERRORNAME+1]
Definition: ethercatprint.c:37
ec_errort::Etype
ec_err_type Etype
Definition: ethercattype.h:491
ec_sdoerrorlist
const ec_sdoerrorlist_t ec_sdoerrorlist[]
Definition: ethercatprint.c:61
ec_errort::Slave
uint16 Slave
Definition: ethercattype.h:485
ec_elist2string
char * ec_elist2string(void)
Definition: ethercatprint.c:371
ec_mbxerrorlist_t::errordescription
char errordescription[EC_MAXERRORNAME+1]
Definition: ethercatprint.c:55
ec_errort::AbortCode
int32 AbortCode
Definition: ethercattype.h:495
ec_errort
Definition: ethercattype.h:478
uint16
uint16_t uint16
Definition: osal.h:29
ec_soeerror2string
char * ec_soeerror2string(uint16 errorcode)
Definition: ethercatprint.c:263
ec_sdoerror2string
const char * ec_sdoerror2string(uint32 sdoerrorcode)
Definition: ethercatprint.c:227
ec_errort::ErrorCode
uint16 ErrorCode
Definition: ethercattype.h:499
ec_mbxerrorlist_t
Definition: ethercatprint.c:50
ec_errort::Time
ec_timet Time
Definition: ethercattype.h:481
ec_soeerrorlist_t::errordescription
char errordescription[EC_MAXERRORNAME+1]
Definition: ethercatprint.c:46
ecx_poperror
boolean ecx_poperror(ecx_contextt *context, ec_errort *Ec)
Definition: ethercatmain.c:180
EC_ERR_TYPE_SDO_ERROR
@ EC_ERR_TYPE_SDO_ERROR
Definition: ethercattype.h:464
ec_sdoerrorlist_t::errorcode
uint32 errorcode
Definition: ethercatprint.c:26
ec_errort::Index
uint16 Index
Definition: ethercattype.h:487
ecx_context
Definition: ethercatmain.h:384
ec_mbxerrorlist
const ec_mbxerrorlist_t ec_mbxerrorlist[]
Definition: ethercatprint.c:209
EC_MAXERRORNAME
#define EC_MAXERRORNAME
Definition: ethercatprint.c:20
ecx_elist2string
char * ecx_elist2string(ecx_contextt *context)
Definition: ethercatprint.c:356
ec_sdoerrorlist_t
Definition: ethercatprint.c:23
ec_timet::usec
uint32 usec
Definition: osal.h:39
ecx_err2string
char * ecx_err2string(const ec_errort Ec)
Definition: ethercatprint.c:299
EC_ERR_TYPE_EMERGENCY
@ EC_ERR_TYPE_EMERGENCY
Definition: ethercattype.h:465
ethercattype.h
General typedefs and defines for EtherCAT.
ec_soeerrorlist
const ec_soeerrorlist_t ec_soeerrorlist[]
Definition: ethercatprint.c:154
ec_ALstatuscodelist_t::ALstatuscode
uint16 ALstatuscode
Definition: ethercatprint.c:35
ec_ALstatuscode2string
char * ec_ALstatuscode2string(uint16 ALstatuscode)
Definition: ethercatprint.c:245
ec_mbxerrorlist_t::errorcode
uint16 errorcode
Definition: ethercatprint.c:53
ec_soeerrorlist_t
Definition: ethercatprint.c:41
ec_timet::sec
uint32 sec
Definition: osal.h:38
EC_ERR_TYPE_MBX_ERROR
@ EC_ERR_TYPE_MBX_ERROR
Definition: ethercattype.h:472
EC_ERR_TYPE_SDOINFO_ERROR
@ EC_ERR_TYPE_SDOINFO_ERROR
Definition: ethercattype.h:467


soem
Author(s): Arthur Ketels and M.J.G. van den Molengraft
autogenerated on Wed Mar 2 2022 01:01:49