ethercatprint.c
Go to the documentation of this file.
1 /*
2  * Simple Open EtherCAT Master Library
3  *
4  * File : ethercatprint.c
5  * Version : 1.3.0
6  * Date : 24-02-2013
7  * Copyright (C) 2005-2013 Speciaal Machinefabriek Ketels v.o.f.
8  * Copyright (C) 2005-2013 Arthur Ketels
9  * Copyright (C) 2008-2009 TU/e Technische Universiteit Eindhoven
10  *
11  * SOEM is free software; you can redistribute it and/or modify it under
12  * the terms of the GNU General Public License version 2 as published by the Free
13  * Software Foundation.
14  *
15  * SOEM is distributed in the hope that it will be useful, but WITHOUT ANY
16  * WARRANTY; without even the implied warranty of MERCHANTABILITY or
17  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
18  * for more details.
19  *
20  * As a special exception, if other files instantiate templates or use macros
21  * or inline functions from this file, or you compile this file and link it
22  * with other works to produce a work based on this file, this file does not
23  * by itself cause the resulting work to be covered by the GNU General Public
24  * License. However the source code for this file must still be made available
25  * in accordance with section (3) of the GNU General Public License.
26  *
27  * This exception does not invalidate any other reasons why a work based on
28  * this file might be covered by the GNU General Public License.
29  *
30  * The EtherCAT Technology, the trade name and logo EtherCAT are the intellectual
31  * property of, and protected by Beckhoff Automation GmbH. You can use SOEM for
32  * the sole purpose of creating, using and/or selling or otherwise distributing
33  * an EtherCAT network master provided that an EtherCAT Master License is obtained
34  * from Beckhoff Automation GmbH.
35  *
36  * In case you did not receive a copy of the EtherCAT Master License along with
37  * SOEM write to Beckhoff Automation GmbH, Eiserstraße 5, D-33415 Verl, Germany
38  * (www.beckhoff.com).
39  */
40 
50 #include <stdio.h>
51 #include "oshw.h"
52 #include "ethercattype.h"
53 #include "ethercatmain.h"
54 
55 #define EC_MAXERRORNAME 127
56 
58 typedef struct
59 {
63  char errordescription[EC_MAXERRORNAME + 1];
65 
67 typedef struct
68 {
72  char ALstatuscodedescription[EC_MAXERRORNAME + 1];
74 
76 typedef struct
77 {
81  char errordescription[EC_MAXERRORNAME + 1];
83 
85 typedef struct
86 {
90  char errordescription[EC_MAXERRORNAME + 1];
92 
94 
97  {0x00000000, "No error" },
98  {0x05030000, "Toggle bit not changed" },
99  {0x05040000, "SDO protocol timeout" },
100  {0x05040001, "Client/Server command specifier not valid or unknown" },
101  {0x05040005, "Out of memory" },
102  {0x06010000, "Unsupported access to an object" },
103  {0x06010001, "Attempt to read to a write only object" },
104  {0x06010002, "Attempt to write to a read only object" },
105  {0x06010003, "Subindex can not be written, SI0 must be 0 for write access" },
106  {0x06010004, "SDO Complete access not supported for variable length objects" },
107  {0x06010005, "Object length exceeds mailbox size" },
108  {0x06010006, "Object mapped to RxPDO, SDO download blocked" },
109  {0x06020000, "The object does not exist in the object directory" },
110  {0x06040041, "The object can not be mapped into the PDO" },
111  {0x06040042, "The number and length of the objects to be mapped would exceed the PDO length" },
112  {0x06040043, "General parameter incompatibility reason" },
113  {0x06040047, "General internal incompatibility in the device" },
114  {0x06060000, "Access failed due to a hardware error" },
115  {0x06070010, "Data type does not match, length of service parameter does not match" },
116  {0x06070012, "Data type does not match, length of service parameter too high" },
117  {0x06070013, "Data type does not match, length of service parameter too low" },
118  {0x06090011, "Subindex does not exist" },
119  {0x06090030, "Value range of parameter exceeded (only for write access)" },
120  {0x06090031, "Value of parameter written too high" },
121  {0x06090032, "Value of parameter written too low" },
122  {0x06090036, "Maximum value is less than minimum value" },
123  {0x08000000, "General error" },
124  {0x08000020, "Data cannot be transferred or stored to the application" },
125  {0x08000021, "Data cannot be transferred or stored to the application because of local control" },
126  {0x08000022, "Data cannot be transferred or stored to the application because of the present device state" },
127  {0x08000023, "Object dictionary dynamic generation fails or no object dictionary is present" },
128  {0xffffffff, "Unknown" }
129 };
130 
133  {0x0000 , "No error" },
134  {0x0001 , "Unspecified error" },
135  {0x0002 , "No memory" },
136  {0x0011 , "Invalid requested state change" },
137  {0x0012 , "Unknown requested state" },
138  {0x0013 , "Bootstrap not supported" },
139  {0x0014 , "No valid firmware" },
140  {0x0015 , "Invalid mailbox configuration" },
141  {0x0016 , "Invalid mailbox configuration" },
142  {0x0017 , "Invalid sync manager configuration" },
143  {0x0018 , "No valid inputs available" },
144  {0x0019 , "No valid outputs" },
145  {0x001A , "Synchronization error" },
146  {0x001B , "Sync manager watchdog" },
147  {0x001C , "Invalid sync Manager types" },
148  {0x001D , "Invalid output configuration" },
149  {0x001E , "Invalid input configuration" },
150  {0x001F , "Invalid watchdog configuration" },
151  {0x0020 , "Slave needs cold start" },
152  {0x0021 , "Slave needs INIT" },
153  {0x0022 , "Slave needs PREOP" },
154  {0x0023 , "Slave needs SAFEOP" },
155  {0x0024 , "Invalid input mapping" },
156  {0x0025 , "Invalid output mapping" },
157  {0x0026 , "Inconsistent settings" },
158  {0x0027 , "Freerun not supported" },
159  {0x0028 , "Synchronisation not supported" },
160  {0x0029 , "Freerun needs 3buffer mode" },
161  {0x002A , "Background watchdog" },
162  {0x002B , "No valid Inputs and Outputs" },
163  {0x002C , "Fatal sync error" },
164  {0x002D , "No sync error" }, // was "Invalid Output FMMU Configuration"
165  {0x002E , "Invalid input FMMU configuration" },
166  {0x0030 , "Invalid DC SYNC configuration" },
167  {0x0031 , "Invalid DC latch configuration" },
168  {0x0032 , "PLL error" },
169  {0x0033 , "DC sync IO error" },
170  {0x0034 , "DC sync timeout error" },
171  {0x0035 , "DC invalid sync cycle time" },
172  {0x0035 , "DC invalid sync0 cycle time" },
173  {0x0035 , "DC invalid sync1 cycle time" },
174  {0x0042 , "MBX_EOE" },
175  {0x0043 , "MBX_COE" },
176  {0x0044 , "MBX_FOE" },
177  {0x0045 , "MBX_SOE" },
178  {0x004F , "MBX_VOE" },
179  {0x0050 , "EEPROM no access" },
180  {0x0051 , "EEPROM error" },
181  {0x0060 , "Slave restarted locally" },
182  {0x0061 , "Device identification value updated" },
183  {0x00f0 , "Application controller available" },
184  {0xffff , "Unknown" }
185 };
186 
189  {0x0000, "No error" },
190  {0x1001, "No IDN" },
191  {0x1009, "Invalid access to element 1" },
192  {0x2001, "No Name" },
193  {0x2002, "Name transmission too short" },
194  {0x2003, "Name transmission too long" },
195  {0x2004, "Name cannot be changed (read only)" },
196  {0x2005, "Name is write-protected at this time" },
197  {0x3002, "Attribute transmission too short" },
198  {0x3003, "Attribute transmission too long" },
199  {0x3004, "Attribute cannot be changed (read only)" },
200  {0x3005, "Attribute is write-protected at this time" },
201  {0x4001, "No units" },
202  {0x4002, "Unit transmission too short" },
203  {0x4003, "Unit transmission too long" },
204  {0x4004, "Unit cannot be changed (read only)" },
205  {0x4005, "Unit is write-protected at this time" },
206  {0x5001, "No minimum input value" },
207  {0x5002, "Minimum input value transmission too short" },
208  {0x5003, "Minimum input value transmission too long" },
209  {0x5004, "Minimum input value cannot be changed (read only)" },
210  {0x5005, "Minimum input value is write-protected at this time" },
211  {0x6001, "No maximum input value" },
212  {0x6002, "Maximum input value transmission too short" },
213  {0x6003, "Maximum input value transmission too long" },
214  {0x6004, "Maximum input value cannot be changed (read only)" },
215  {0x6005, "Maximum input value is write-protected at this time" },
216  {0x7002, "Operation data transmission too short" },
217  {0x7003, "Operation data transmission too long" },
218  {0x7004, "Operation data cannot be changed (read only)" },
219  {0x7005, "Operation data is write-protected at this time (state)" },
220  {0x7006, "Operation data is smaller than the minimum input value" },
221  {0x7007, "Operation data is smaller than the maximum input value" },
222  {0x7008, "Invalid operation data:Configured IDN will not be supported" },
223  {0x7009, "Operation data write protected by a password" },
224  {0x700A, "Operation data is write protected, it is configured cyclically" },
225  {0x700B, "Invalid indirect addressing: (e.g., data container, list handling)" },
226  {0x700C, "Operation data is write protected, due to other settings" },
227  {0x700D, "Reserved" },
228  {0x7010, "Procedure command already active" },
229  {0x7011, "Procedure command not interruptible" },
230  {0x7012, "Procedure command at this time not executable (state)" },
231  {0x7013, "Procedure command not executable (invalid or false parameters)" },
232  {0x7014, "No data state" },
233  {0x8001, "No default value" },
234  {0x8002, "Default value transmission too long" },
235  {0x8004, "Default value cannot be changed, read only" },
236  {0x800A, "Invalid drive number" },
237  {0x800A, "General error" },
238  {0x800A, "No element addressed" },
239  {0xffff, "Unknown" }
240 };
241 
244  {0x0000, "No error" },
245  {0x0001, "Syntax of 6 octet Mailbox Header is wrong" },
246  {0x0002, "The mailbox protocol is not supported" },
247  {0x0003, "Channel Field contains wrong value"},
248  {0x0004, "The service is no supported"},
249  {0x0005, "Invalid mailbox header"},
250  {0x0006, "Length of received mailbox data is too short"},
251  {0x0007, "No more memory in slave"},
252  {0x0008, "The lenght of data is inconsistent"},
253  {0xffff, "Unknown"}
254 };
255 
261 char* ec_sdoerror2string( uint32 sdoerrorcode)
262 {
263  int i = 0;
264 
265  while ( (ec_sdoerrorlist[i].errorcode != 0xfffffffful) &&
266  (ec_sdoerrorlist[i].errorcode != sdoerrorcode) )
267  {
268  i++;
269  }
270 
271  return (char*) ec_sdoerrorlist[i].errordescription;
272 }
273 
279 char* ec_ALstatuscode2string( uint16 ALstatuscode)
280 {
281  int i = 0;
282 
283  while ( (ec_ALstatuscodelist[i].ALstatuscode != 0xffff) &&
284  (ec_ALstatuscodelist[i].ALstatuscode != ALstatuscode) )
285  {
286  i++;
287  }
288 
289  return (char *) ec_ALstatuscodelist[i].ALstatuscodedescription;
290 }
291 
297 char* ec_soeerror2string( uint16 errorcode)
298 {
299  int i = 0;
300 
301  while ( (ec_soeerrorlist[i].errorcode != 0xffff) &&
302  (ec_soeerrorlist[i].errorcode != errorcode) )
303  {
304  i++;
305  }
306 
307  return (char *) ec_soeerrorlist[i].errordescription;
308 }
309 
315 char* ec_mbxerror2string( uint16 errorcode)
316 {
317  int i = 0;
318 
319  while ( (ec_mbxerrorlist[i].errorcode != 0xffff) &&
320  (ec_mbxerrorlist[i].errorcode != errorcode) )
321  {
322  i++;
323  }
324 
325  return (char *) ec_mbxerrorlist[i].errordescription;
326 }
327 
334 {
335  ec_errort Ec;
336  char timestr[20];
337 
338  if (ecx_poperror(context, &Ec))
339  {
340  sprintf(timestr, "Time:%12.3f", Ec.Time.sec + (Ec.Time.usec / 1000000.0) );
341  switch (Ec.Etype)
342  {
344  {
345  sprintf(estring, "%s SDO slave:%d index:%4.4x.%2.2x error:%8.8x %s\n",
346  timestr, Ec.Slave, Ec.Index, Ec.SubIdx, Ec.AbortCode, ec_sdoerror2string(Ec.AbortCode));
347  break;
348  }
350  {
351  sprintf(estring, "%s EMERGENCY slave:%d error:%4.4x\n",
352  timestr, Ec.Slave, Ec.ErrorCode);
353  break;
354  }
356  {
357  sprintf(estring, "%s PACKET slave:%d index:%4.4x.%2.2x error:%d\n",
358  timestr, Ec.Slave, Ec.Index, Ec.SubIdx, Ec.ErrorCode);
359  break;
360  }
362  {
363  sprintf(estring, "%s SDO slave:%d index:%4.4x.%2.2x error:%8.8x %s\n",
364  timestr, Ec.Slave, Ec.Index, Ec.SubIdx, Ec.AbortCode, ec_sdoerror2string(Ec.AbortCode));
365  break;
366  }
368  {
369  sprintf(estring, "%s SoE slave:%d IDN:%4.4x error:%4.4x %s\n",
370  timestr, Ec.Slave, Ec.Index, Ec.AbortCode, ec_soeerror2string(Ec.ErrorCode));
371  break;
372  }
374  {
375  sprintf(estring, "%s MBX slave:%d error:%4.4x %s\n",
376  timestr, Ec.Slave, Ec.ErrorCode, ec_mbxerror2string(Ec.ErrorCode));
377  break;
378  }
379  default:
380  {
381  sprintf(estring, "%s error:%8.8x\n",
382  timestr, Ec.AbortCode);
383  }
384  }
385  return (char*) estring;
386  }
387  else
388  {
389  return "";
390  }
391 }
392 
393 #ifdef EC_VER1
394 char* ec_elist2string(void)
395 {
396  return ecx_elist2string(&ecx_context);
397 }
398 #endif
char * ec_ALstatuscode2string(uint16 ALstatuscode)
char errordescription[EC_MAXERRORNAME+1]
Definition: ethercatprint.c:63
uint32 usec
Definition: osal.h:56
uint8 SubIdx
Definition: ethercattype.h:503
const ec_sdoerrorlist_t ec_sdoerrorlist[]
Definition: ethercatprint.c:96
uint16_t uint16
Definition: osal.h:34
char * ec_soeerror2string(uint16 errorcode)
char estring[EC_MAXERRORNAME]
Definition: ethercatprint.c:93
General typedefs and defines for EtherCAT.
ec_err_type Etype
Definition: ethercattype.h:505
uint16 Slave
Definition: ethercattype.h:499
#define EC_MAXERRORNAME
Definition: ethercatprint.c:55
char * ecx_elist2string(ecx_contextt *context)
const ec_soeerrorlist_t ec_soeerrorlist[]
char ALstatuscodedescription[EC_MAXERRORNAME+1]
Definition: ethercatprint.c:72
int32 AbortCode
Definition: ethercattype.h:509
ec_timet Time
Definition: ethercattype.h:495
uint16 ErrorCode
Definition: ethercattype.h:513
uint16 Index
Definition: ethercattype.h:501
char errordescription[EC_MAXERRORNAME+1]
Definition: ethercatprint.c:81
Headerfile for ethercatmain.c.
uint32 sec
Definition: osal.h:55
uint32_t uint32
Definition: osal.h:35
char * ec_sdoerror2string(uint32 sdoerrorcode)
char errordescription[EC_MAXERRORNAME+1]
Definition: ethercatprint.c:90
const ec_ALstatuscodelist_t ec_ALstatuscodelist[]
boolean ecx_poperror(ecx_contextt *context, ec_errort *Ec)
Definition: ethercatmain.c:214
char * ec_mbxerror2string(uint16 errorcode)
const ec_mbxerrorlist_t ec_mbxerrorlist[]


youbot_driver
Author(s): Jan Paulus
autogenerated on Mon Jun 10 2019 15:46:24