Giter Site home page Giter Site logo

soem's People

Contributors

alberth avatar alex-brinkman avatar alexkalmuk avatar arthurketels avatar berkaydeniz avatar deadzen avatar eglimi avatar hefloryd avatar jassarsson avatar lbckmnn avatar lounick avatar magnaboscol avatar mheden avatar mizoguch-ken avatar nakarlsson avatar notofug avatar ntd avatar qboticslabs avatar rhdlilj avatar rtl-johanna avatar rtmagj avatar schlumpf avatar seanyen avatar shabbyx avatar stefanpoeter avatar strongly-typed avatar torstenrobitzki avatar wanga avatar windsgo avatar zchen24 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

soem's Issues

netpacket/packet.h: no such file or directory

I am trying to make a library for QNX momentics IDE 5.0 and got the following:

Installing the build libraries
Scanning dependencies of target soem
[ 4%] Building C object CMakeFiles/soem.dir/C_/SOEM-master/oshw/linux/nicdrv.c.o
C:/SOEM-master/oshw/linux/nicdrv.c:80:30: fatal error: netpacket/packet.h: No such file or directory
compilation terminated.
cc: C:/qnx660/host/win32/x86//usr/lib/gcc/i486-pc-nto-qnx6.6.0/4.7.3/cc1 caught signal 1
make[2]: *** [CMakeFiles/soem.dir/C_/SOEM-master/oshw/linux/nicdrv.c.o] Error 1
make[1]: *** [CMakeFiles/soem.dir/all] Error 2
make: *** [all] Error 2
sh-3.1$

Windows compilation

To compile successfully under Windows 7 with Visual Studio 2015 I had to make the following modification to CMakeLists.txt

if(WIN32)
   set(OS "win32")
   include_directories(oshw/win32/wpcap/Include)
   link_directories(${CMAKE_SOURCE_DIR}/oshw/win32/wpcap/Lib)
elseif(UNIX)

to

if(WIN32)
   set(OS "win32")
   include_directories(oshw/win32/wpcap/Include)
   link_directories(${CMAKE_SOURCE_DIR}/oshw/win32/wpcap/Lib)
   add_definitions(-DWIN32)
   add_definitions(-DWPCAP)
elseif(UNIX)


Question about SOEM

I begin to learn SOEM a month ago.But when I try to run the simple_test or red_test,
there is a problem I can't solve,since I have little know knowledge about SOEM.

I run SOEM-1.3.1 on Ubuntu 14.04,with 3.16.0-RTAI, connect to the
servo driver R88D-KN15H-ECT of OMRON.

At first,I try to run example,simple_test program,but it shows a error.It can find all slaves,and initial config the slaves.But when it go to ec_config_map(&IOmap) , it happens the error, that slaves can't change the status from PreOP to SafeOP,shows the information "Slave 1 State=0x12 StatusCode=0x0028:Synchronisation not supported"

\code
char IOmap[4096];
 ...
ec_config_map(&IOmap);
ec_configdc();
...
\endcode

After searching for this problem,I found a similar question,so I naturally modify the code,according to the post,change the order of command as following.when I run this program,it successfully changed the status of slave from PreOP to SafeOP,and says"Operational state reached for all slaves".But a few seconds later,I read the status of slave,the information shows"Slave 1 State=0x14 StatusCode=0x001a:Synchronization Error",and the ecatcheck thread always printf "ERROR : slave 1 is in SAFE_OP + ERROR, attempting ack".I think someting wrong make the slave drop form OP to SAFE_OP,but I can't found the reason.

\code
...
// Configure Distributed Clocks
ec_configdc();
ec_dcsync0(1, TRUE, 1000000U, 0);
// Configure IOMAP
ec_config_map(&IOmap);

// TI suggested work-around;    set the system time delay to 1 ns for first DC slave (ref).
uint32 sysTimeDelay = 1;
ec_FPWR(0x1001, 0x928, sizeof(sysTimeDelay), &sysTimeDelay, EC_TIMEOUTRET);
...
\endcode

That is all of what I faced.If it is the error of DC,or something else?I wonder if I miss some
operation,resulting in the error.Can anyone help me,please!

PDO CA Read not working on Elmo Twitter

I'm using the Elmo Twitter for motor control and have gotten SOEM to read the sensors. The trick was to disable Complete Access reading of the PDO assignment.

I'm manually configuring the PDO assignment before calling ecx_config_map_group(), as in the following pseudo code. Using pseudo code because we call SOEM trough a java -> C interface.

context = ecx_create_context();
ecx_init(context, iface);
ecx_config_init(context, FALSE);

// configure PDOS

// Set the size of the SM configuration array to zero, allows writing to the elements
uint8 indexBuffer;
uint16 sdoBuffer;

// Write zero to index first
indexBuffer = 0;
ecx_SDOwrite(context, 1, 0x1C12, 0x0, FALSE, 1, indexBuffer, EC_TIMEOUTRXM);

foreach PDO 1...n
   sdoBuffer = PDO address
   ecx_SDOwrite(context, 1, 0x1C12, PDO, FALSE, 2, sdoBuffer, EC_TIMEOUTRXM); 



void* ioMap = malloc();
ecx_config_map_group(context, ioMap, FALSE);

The size of the ioMap doesn't take output data into account. Adding the following snippet before ecx_config_map_group makes the system work

         // Disable Complete Access reading of SDO configuration.
         uint16 config = ec_slave.CoEdetails;
         config &= ~ECT_COEDET_SDOCA;
         ec_slave.CoEdetails = config;

SDO read/write and state machine from different threads

So I have implemented my master to have two threads, the main EtherCAT loop and the householding thread. The EtherCAT loop runs send/receive in a realtime context with proper timing. The householding does state checking for ethercat slaves as in the following psuedocode (it does more, but this is the main part)

while(true)
{
if(not switched to OP OR expected working counter is not received working counter)
readstate(0)
for each slave
 if(slave in SAFE_OP)
  read ECT_REG_DCSYSDIFF
  if ECT_REG_DCSYSDIFF < 5000
    switch slave to OP
  end if
end if
end for
for each SDO I want to access
  access SDO
end for

sleep(10ms);
}

I have two issues with this system:

  1. The access SDO sometimes blocks or times out the cyclic PDO exchange. This happens on the Elmo Twitter Slave.
  2. I'm developing a new slave using the Infineon XMC4300 and the Beckhoff SSC. If multiple slaves are connected and I read the ECT_REG_DCSYSDIFF In parallel the slave will loose datagrams and refuse to go in OP mode.

I'm wondering if reading registries in parallel is acceptable and what happens if a datagram is on the line and I send a new one before it gets back to the master. It seems that datagrams get dropped or I get wrong expected working counters when this happens.

Question about "ecx_siifind" function

  • Why we do a = ECT_SII_START << 1; ?
  • In code we have:
    context->slavelist[slave].CoEdetails = ecx_siigetbyte(context, slave, ssigen + 0x07); context->slavelist[slave].FoEdetails = ecx_siigetbyte(context, slave, ssigen + 0x08); context->slavelist[slave].EoEdetails = ecx_siigetbyte(context, slave, ssigen + 0x09); context->slavelist[slave].SoEdetails = ecx_siigetbyte(context, slave, ssigen + 0x0a);
    do "0x07->0x0a" have relative with "ETG.1000 EtherCAT Specification, Part 6, table 21"
    Parameter Byte address
    COE detail 0x0005
    FOE detail 0x0006
    EOE detail 0x0007

outputs of fmmu1 cannot update

Hi,
I am use SOEM-1.3.1 to control 2 AC motors. The protocol of servo driver is CoE. I use the codes of simple_test.c to control the drivers and motors. The configuration and initialization of servo drivers are successfully. Now I have one question:
The fmmu1 used to output the processdata to master. But, the outputs cannot update. For example, one of processdata is status word, the output of its value is 0x250 that it just reflect the drivers is power on. And I use the function of ec_SDOread to read this status word, the return value is 0x1637 that it is the correct value. The value of status word in fmmu1 is not update to 0x1637, and other outputs in fmmu1 are not update. When I use twincat, the outputs of fmmu1 are correct.

Do you have any idea?

ecx_dcsync01: slave fails going to OP with 0x002C: fatal sync error

Since I make use of the functions ecx_dcsync0 and ecx_dcsync01, the terminals EL3104 and (if I remember correctly) also EL3154 fail to go into OP with error 0x002C: fatal sync error. This always happens when using one of the OpMode "DC-Synchron" or "DC-Synchron (input based)", which are specified in the ESI XML file.

The first time I start the system everything works, but the second time (and third and so on) it fails. Using wireshark I noticed that TwinCAT resets register 0x0981 long before the DC system is configured. I think this corresponds to the function ecx_set_slaves_to_default. I included the following code

static void ecx_set_slaves_to_default(ecx_contextt *context)
{
...
b = 0x00;
ecx_BWR(context->port, 0x0000, ECT_REG_DCSYNCACT, sizeof(b), &b), EC_TIMEOUTRET3);
...
}

and since then everything works fine. Is somebody able to reproduce this?

Thanks
Vincent

ecx_readPDOassign and ecx_readPDOassignCA succeed altough ecx_SDOread fails

Since I am working on a Windows system, it sometimes happens that the EtherCAT frames is not received within the timeout. The function ecx_SDOread then returns a working counter < 1. ecx_readPDOassign and ecx_readPDOassign only check once if ecx_SDOread was successful altough it is called multiple times. Like in #50, this leads to incorrect sync manager length calculation.

I am not sure, if there is an easy solution. But I think, there should be some feedback to the user.
What do you think?

Best regards,
Vincent

Rearrange test applications

The separation of test applications in Win32/Linux is obsolete (currently the source under the Linux tree is built when building for Win32). So, remove sub directories and move the source one step "up" in the hierarchy.

OMRON NX-ECC02: Invalid input configuration or Invalid output configuration at init

Hi
I'm using 6 OMRON NX-ECC02 slaves (all Slaves configured with 2*8Digital Out and 8 DMS-LoadCell converters). In normal cases the system runs without problems.
But sometimes the Switch to SAFE_OP fails with one or more slaves in error status "0x30 Invalid input configuration" or "0x29 Invalid output configuration".
Sometimes this error is gone by restarting the program. A complete power cycle at the bus is needed (Power off->Power on).

Thread-safety of ecx_config_map_group and its subfunctions

Depending on the constant MAX_MAPT, the function ecx_config_map_group calls ecx_map_coe_soe either sequentially for each slave or in parallel using MAX_MAPT threads.

If the current slave supports complete access ecx_map_coe_soe calls ecx_readPDOmapCA and then ecx_readPDOassignCA.

The last two functions rely on the default contexts' fields SMcomtype, PDOassign and PDOdesc. These three fields seeem to be not thread safe, they are modified concurrently by e.g 8 threads. This leads to incorrect sync manager length calculation and then prevents the corresponding slave to get into OP.

To solve the issue, I modified ethercatmain.c from

/** SyncManager Communication Type struct to store data of one slave */
static ec_SMcommtypet   ec_SMcommtype;
/** PDO assign struct to store data of one slave */
static ec_PDOassignt    ec_PDOassign;
/** PDO description struct to store data of one slave */
static ec_PDOdesct      ec_PDOdesc;

...

ecx_contextt  ecx_context = {
...
    &ec_SMcommtype,  // .SMcommtype    =
    &ec_PDOassign,   // .PDOassign     =
    &ec_PDOdesc,     // .PDOdesc       =
...
};

to

/** SyncManager Communication Type struct to store data of one slave */
static ec_SMcommtypet   ec_SMcommtype[EC_MAXSLAVE];
/** PDO assign struct to store data of one slave */
static ec_PDOassignt    ec_PDOassign[EC_MAXSLAVE];
/** PDO description struct to store data of one slave */
static ec_PDOdesct      ec_PDOdesc[EC_MAXSLAVE];

...

ecx_contextt  ecx_context = {
...
    &ec_SMcommtype[0],  // .SMcommtype    =
    &ec_PDOassign[0],   // .PDOassign     =
    &ec_PDOdesc[0],     // .PDOdesc       =
...
};

Additionally I replaced all occurences of SMcommtype->n to SMcommtype[Slave].n and similiar for PDOassign and PDOdesc.

Maybe someone can have a look into this.

Thank you
Vincent

Trouble setting slave state

Hi,

In my efforts to learn SOEM, I have stumbled this problem. First, here is the gist of what I do in the beginning of a test program:

ec_init(ifname);
ec_config_init(FALSE);
ec_config_map(&IOmap);
ec_configdc();

At this point, I can see the slave alright. I then try to change the state, which doesn't work. Imagine the code above is followed by:

printf("0x%02X\n", ec_slave[1].state);
ec_statecheck(SLAVE, EC_STATE_SAFE_OP,  EC_TIMEOUTSTATE * 4);
printf("0x%02X\n", ec_slave[1].state);

Now if I use 0 for SLAVE, which according to documentation means "all slaves", the state of slave 1 doesn't change. However, if I use 1 for SLAVE, so I only change the state of the first slave, the state changes correctly.

In other words, broadcast-setting the state doesn't seem to work. What am I doing wrong?

Using library under windows

Hello there,
I am having trouble building the examples under windows. When I try to run cmake .. -G "NMake Makefiles" I get:
https://pastebin.com/qNedEEym

I dont know what is the case, I tried running it from regular cmd and visual studio console with same effect. I was not sure either this only builds the example, so I tried to add all of the .h files and .c files to my Qt creator project but there I cannot compile:

zrzut ekranu 2015-10-13 13 59 54

Do you know maybe what could be the case here? Do I have to run the build scripts in order to use the library within my code? I would really appreciate all help regarding this!

Grouping Slaves

Basically I want to know when a part of the ethercat network is not reachable. I think groups are ment to do that?!

If I see it correctly I can group slaves by assigning a groupid to the slave but when does that need to happen? Before the ecx_config_map_group call or after?

Does grouping affect the mapped addresses and should I do a ecx_send_processdata_group for every group or is it handled by the ecx_send_processdata?

Thanks in advance,
Stefan

Cannot configure Distributed Clocks SYNC0

I've noticed there aren't any example applications that demonstrate Distributed Clocks functionality.

When trying to make a simple example application using SYNC0 (by modifying simple_test) the EtherCAT slave (in this case, an AM3359 ICEv2 evaluation board) continues to use PDO sync, and does not trigger SYNC0 at all. I've put the line "ec_dcsync0(1, TRUE, 1000000U, 0);" before trying to set the slave state to Operational.

TwinCAT v2.11 is able to successfully configure the EtherCAT slave in Distributed Clocks mode and cause the SYNC0 triggers.

What is the proper way of configuring and initializing Distributed Clocks with SOEM? When is the function "ec_dcsync0" supposed to be called?

License clarification

In the license there is the following exception to the GPL

 * As a special exception, if other files instantiate templates or use macros
 * or inline functions from this file, or you compile this file and link it
 * with other works to produce a work based on this file, this file does not
 * by itself cause the resulting work to be covered by the GNU General Public
 * License. However the source code for this file must still be made available
 * in accordance with section (3) of the GNU General Public License.

To clarify

  • If we statically link to the library, will the resulting combination be considered GPL?
  • If we dynamically link to the library, will the resulting combination be considered GPL?

If I understand the exception correctly the answer to both questions is no.

Slaveinfo bugs with more than 1 slave with CoE - "The object does not exist in the object directory"

I tested slaveinfo demo with various Beckhoff IO modules sets. I seems that in case there is more than 1 slave with CoE support in the chain, some bug is triggered, causing The object does not exist in the object directory and Not all slaves reached safe operational state error messages. Tested on x86 linux and Windows - same bahaviour.

Maybe the real cause is different than CoE, I plan to discover it more.

Example of output:

# ./slaveinfo eth1
SOEM (Simple Open EtherCAT Master)
Slaveinfo
Starting slaveinfo
ec_init on eth1 succeeded.
Time:    1458.837 SDO slave:3 index:1a14.00 error:06020000 The object does not exist in the object directory
Time:    1458.838 SDO slave:3 index:1a18.00 error:06020000 The object does not exist in the object directory
Time:    1458.839 SDO slave:3 index:1a1c.00 error:06020000 The object does not exist in the object directory
3 slaves found and configured.
Calculated workcounter 6
Not all slaves reached safe operational state.
Slave 3 State=12 StatusCode=  1e : Invalid input configuration

Slave:1
 Name:EK1100
 Output size: 0bits
 Input size: 0bits
 State: 4
 Delay: 0[ns]
 Has DC: 1
 DCParentport:0
 Activeports:1.1.0.0
 Configured address: 1001
 Man: 00000002 ID: 044c2c52 Rev: 00120000
 FMMUfunc 0:0 1:0 2:0 3:0
 MBX length wr: 0 rd: 0 MBX protocols : 00
 CoE details: 00 FoE details: 00 EoE details: 00 SoE details: 00
 Ebus current: -2000[mA]
 only LRD/LWR:0

Slave:2
 Name:EL1258
 Output size: 256bits
 Input size: 3072bits
 State: 4
 Delay: 145[ns]
 Has DC: 1
 DCParentport:1
 Activeports:1.1.0.0
 Configured address: 1002
 Man: 00000002 ID: 04ea3052 Rev: 00100000
 SM0 A:1000 L: 256 F:00010026 Type:1
 SM1 A:1100 L: 256 F:00010022 Type:2
 SM2 A:1200 L:  32 F:00010024 Type:3
 SM3 A:1900 L: 384 F:00010020 Type:4
 FMMU0 Ls:00000000 Ll:  32 Lsb:0 Leb:7 Ps:1200 Psb:0 Ty:02 Act:01
 FMMU1 Ls:000000f0 Ll: 384 Lsb:0 Leb:7 Ps:1900 Psb:0 Ty:01 Act:01
 FMMUfunc 0:1 1:3 2:3 3:0
 MBX length wr: 256 rd: 256 MBX protocols : 0c
 CoE details: 27 FoE details: 01 EoE details: 00 SoE details: 00
 Ebus current: 130[mA]
 only LRD/LWR:0

Slave:3
 Name:EL2258
 Output size: 1664bits
 Input size: 160bits
 State: 18
 Delay: 300[ns]
 Has DC: 1
 DCParentport:1
 Activeports:1.0.0.0
 Configured address: 1003
 Man: 00000002 ID: 08d23052 Rev: 00110000
 SM0 A:1000 L: 256 F:00010026 Type:1
 SM1 A:1100 L: 256 F:00010022 Type:2
 SM2 A:1200 L: 208 F:00010024 Type:3
 SM3 A:1900 L:  20 F:00010020 Type:4
 FMMU0 Ls:00000020 Ll: 208 Lsb:0 Leb:7 Ps:1200 Psb:0 Ty:02 Act:01
 FMMU1 Ls:00000270 Ll:  20 Lsb:0 Leb:7 Ps:1900 Psb:0 Ty:01 Act:01
 FMMUfunc 0:1 1:3 2:3 3:0
 MBX length wr: 256 rd: 256 MBX protocols : 0c
 CoE details: 27 FoE details: 01 EoE details: 00 SoE details: 00
 Ebus current: 130[mA]
 only LRD/LWR:0
End slaveinfo, close socket
End program

After the Calculated workcounter 6 output, there is a few seconds delay. Number of initial SDO errors differs with each execution randomly.

Enviromental problems

Hello there,
I still havent solved my problem with building the library under windows- for the time being I have build it on another computer and copied the results to my pc. The problem is I cannot find the connected slaves, and they are working. For now here is the status:

  • 2 slaves connected to beaglebone black running Debian. I can run slaveinfo demo and identify both slaves.
  • 2 slaves connected to windows pc. I can run slaveinfo but cant find 2 slaves.
  • 2 slaves connected to a linux virtual machine. I have connected a usb->ethernet dongle and shared it for the VM. In the linux VM i see the additional interface as eth1. I can run slaveinfo but like on windows, I cannot find the 2 slaves...

Could you please advice me some troubleshooting? I would really apreciate it.

Wago 750-354 read Input

Hello, I have a problem with the configuration of the I / O module Wago 750-354.
When I try to read the inputs instead of 8Byte I see only 6, which have nothing to do. Do I need a special configuration?
With Beckhoff modules did not have to do anything.

Separate threads for SDO and state control

On a general purpose CPU (Intel x86), is it recommended to do state control (PRE-OP -> .. -> OP) in a separate thread?

Also, because SDO requests are blocking, would those also be called from a separate thread and if yes, would this affect the main PDO communication?

osal.c: absolute vs. relative time (Windows)

On Windows systems, the function ecx_configdc uses osal_current_time() to initialize the mastertime variable:

mastertime = osal_current_time();

The function osal_current_time calls osal_gettimeofday which relies on QueryPerformanceFrequency and QueryPerformanceCounter. When precise but relative time is needed (e.g. for timers), QueryPerformanceCounter is a good choice. But for initialization of DC, an absolute time would be more meaningful.

Here is a guidance on how to get time stamps in windows. In section Guidance for acquiring time stamps you find the following statements:

When you need time stamps with a resolution of 1 microsecond or better and you don't need the time stamps to be synchronized to an external time reference, choose QueryPerformanceCounter, KeQueryPerformanceCounter, or KeQueryInterruptTimePrecise.

[...]

If resolution of 10 to 16 milliseconds is sufficient, you can use GetTickCount64, QueryInterruptTime, QueryUnbiasedInterruptTime, KeQueryInterruptTime, or KeQueryUnbiasedInterruptTime to obtain time stamps that aren't synchronized to an external time reference. For UTC-synchronized time stamps, use GetSystemTimeAsFileTime or KeQuerySystemTime.

The Ke*-functions are for kernel mode, which is not applicable here.

So, for versions <= Windows 7, there is a trade-off between precision and synchronization:

QueryPerformanceCounter: precise, not synchronized (relative time since windows boot)
GetSystemTimeAsFileTime: unprecise, UTC synchronized

So I would propose to use GetSystemTimeAsFileTime for DC initialization and GetSystemTimeAsPreciseFileTime when version >= Windows 8 because it combines both advantages.

In windows 7, I use the following function:

int osal_getabsolutetimeofday(struct timeval *tv, struct timezone *tz)
{
    FILETIME SystemTime;
    int64 SystemTime64, usecs;
    int64 Offset = -134774LL * 86400LL * 1000LL * 1000LL * 10LL; // Difference between 1601 and 1970 in 100 ns.

    timeBeginPeriod(1);
    GetSystemTimeAsFileTime(&SystemTime);
    timeEndPeriod(1);

    SystemTime64 = ((int64)(SystemTime.dwHighDateTime) << 32) + (int64)SystemTime.dwLowDateTime;
    SystemTime64 = SystemTime64 + Offset;
    usecs = SystemTime64 / 10;

    tv->tv_sec = (long)(usecs / 1000000);
    tv->tv_usec = (long)(usecs - (tv->tv_sec * 1000000));

    return 1;
}

This function is a workaround and I posted it just as an example. Some comments:

  • I am not sure if timeBeginPeriod(1) and timeEndPeriod(1) have any effect. I think they would have an effect, if they have been called long before, e.g. during software startup because the underlying timer gets updated the next time when the OS wakes up (after 1 ms). So it is likely that the old time (~15 ms ago) is provided.
  • I am calculating from year 1601 to 1970 instead of 2000 to be compatible with ecx_configdc.

One comment to the original function osal_gettimeofday. I think timeBeginPeriod(1) has no effect, since QueryPerformanceCounter does not depend on the multimedia timer and QueryPerformanceFrequency is determined and fixed during operating system boot.

int osal_gettimeofday (struct timeval *tv, struct timezone *tz)
{
   int64_t wintime, usecs;
   if(!sysfrequency)
   {
      timeBeginPeriod(1); // May this line has no effect
      QueryPerformanceFrequency((LARGE_INTEGER *)&sysfrequency);
      qpc2usec = 1000000.0 / sysfrequency;
   }
   QueryPerformanceCounter((LARGE_INTEGER *)&wintime);
   usecs = (int64_t)((double)wintime * qpc2usec);
   tv->tv_sec = (long)(usecs / 1000000);
   tv->tv_usec = (long)(usecs - (tv->tv_sec * 1000000));

   return 1;
}

Thank you
Vincent

Setting SM & PDI watchdogs

I used to have some code that set the SM and PDI watchdogs back when SOEM was hosted at BerliOS. I can't find it any more and the BerliOS mailing lists/forums seem to have disappeared.

Can anyone suggest a way to set the SM and PDI watchdog timeout for a slave using SOEM?

Using ecx_RxPDO(..) and ecx_TxPDO(...) function

Hi,

When I see the implementation of the functions ecx_RxPDO(..) and ecx_TxPDO(...) I don't understand their interests and how to use them.

Is it possible to create a non blocking mailbox communication with these functions (send / receive only the mailbox request with one call, and when the slave is ready, send / receive the mailbox response with a second call) ?

Best regards

What does DCTime correspond to

I'm trying to wrap my head around DC clocks and I was wondering what the context->DCtime variable corresponds to. From testing it seems to get changed when ecx_receive_processdata is called, but it seems to correspond to the execution of the ecx_send_processdata call.

The question is, what is the corresponding time on the PC?

A) Moment the datagram gets send by ecx_send_processdata call (aka master clock compensated by transmission delays).
B) Moment the datagram reaches the master clock (aka no compensation for transmission delay)
C) something else

The goal is to synchronize the DC Sync0 pulse to to SYNC moment in the following psuedocode

while(true)
{
       wait for next period
       SYNC
       ecx_send_processdata
       ecx_processdata_receive
       do control, non-deterministic execution time < cycle time

}

Reconfiguring slaves with DC Sync enabled

I'm trying to reconfigure slaves with DC enabled after a power cycle. I have a statemachine that will wait for the 0x92c register to be below a certain value to make sure the clocks are synchronized.

I can successfully get the slave back in safe_op using recover and reconfig, however the value of 0x92c is very large (-2126202406ns).

In my PO2SO function I do (actually I split up the ecx_reconfig_slave function in two parts to avoid having to use a callback, but functionality equivalent)

ecx_dcsync0(context, slave, 0, 0, 0)
[configure PDOs]
ecx_dcsync0(context, slave, 1, 1000000, 0)
[write some SDOs]

Should I call ecx_configdc before going in SafeOP or is there another way that does not affect the other slaves? Currently it seems unreliable where slaves refuse to go into OP mode.

Or is recovering slaves in DC Sync mode a bad idea and we should not bother?

simple_test: Invalid input configuration at PREOP

Hello,

I am using SOEM from master branch with NanoTec N5 motor controllers:

http://en.nanotec.com/products/1597-n5-motor-controller-for-canopen-ethercat-or-ethernetip/

When I run simple_test, I see the following:

# ./simple_test eth1
SOEM (Simple Open EtherCAT Master)
Simple test
Starting simple test
ec_init on eth1 succeeded.
2 slaves found and configured.
Slaves mapped, state to SAFE_OP.
segments : 1 : 36 0 0 0
Request operational state for all slaves
Calculated workcounter 6
Not all slaves reached operational state.
Slave 1 State=0x12 StatusCode=0x001e : Invalid input configuration
Slave 2 State=0x12 StatusCode=0x001e : Invalid input configuration

Request init state for all slaves
End simple test, close socket
End program

slaveinfo says the following:

SOEM (Simple Open EtherCAT Master)
Slaveinfo
Starting slaveinfo
ec_init on eth1 succeeded.
2 slaves found and configured.
Calculated workcounter 6
Not all slaves reached safe operational state.
Slave 1 State=12 StatusCode=  1e : Invalid input configuration
Slave 2 State=12 StatusCode=  1e : Invalid input configuration

Slave:1
 Name:N5
 Output size: 88bits
 Input size: 56bits
 State: 18
 Delay: 0[ns]
 Has DC: 1
 DCParentport:0
 Activeports:0.1.0.0
 Configured address: 1001
 Man: 0000026c ID: 00000002 Rev: 00000001
 SM0 A:1000 L: 128 F:00010026 Type:1
 SM1 A:1080 L: 128 F:00010022 Type:2
 FMMU0 Ls:00000000 Ll:  11 Lsb:0 Leb:7 Ps:0000 Psb:0 Ty:02 Act:01
 FMMU1 Ls:00000016 Ll:   7 Lsb:0 Leb:7 Ps:0000 Psb:0 Ty:01 Act:01
 FMMUfunc 0:0 1:0 2:0 3:0
 MBX length wr: 128 rd: 128 MBX protocols : 0c
 CoE details: 00 FoE details: 00 EoE details: 00 SoE details: 00
 Ebus current: 0[mA]
 only LRD/LWR:0

Slave:2
 Name:N5
 Output size: 88bits
 Input size: 56bits
 State: 18
 Delay: 740[ns]
 Has DC: 1
 DCParentport:1
 Activeports:1.1.0.0
 Configured address: 1002
 Man: 0000026c ID: 00000002 Rev: 00000001
 SM0 A:1000 L: 128 F:00010026 Type:1
 SM1 A:1080 L: 128 F:00010022 Type:2
 FMMU0 Ls:0000000b Ll:  11 Lsb:0 Leb:7 Ps:0000 Psb:0 Ty:02 Act:01
 FMMU1 Ls:0000001d Ll:   7 Lsb:0 Leb:7 Ps:0000 Psb:0 Ty:01 Act:01
 FMMUfunc 0:0 1:0 2:0 3:0
 MBX length wr: 128 rd: 128 MBX protocols : 0c
 CoE details: 00 FoE details: 00 EoE details: 00 SoE details: 00
 Ebus current: 0[mA]
 only LRD/LWR:0
End slaveinfo, close socket
End program

What is the reason for "invalid input configuration" could be?

Build on ARM platform

Building on ARM Cortex-A9 Linux (debian wheezy, gcc 4.6.3) - complete without errors, but with many warnings. At least slaveinfo does not work (sometimes detect no slaves, sometimes correct number of slaves, but with a totally bad data and long run time).

I plan trying to fix this.

Make output:

--- Entering /root/soem/osal
--- Entering /root/soem/osal/linux
--- Compiling osal.c
osal.c: In function ‘osal_time_diff’:
osal.c:69:4: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits]
--- Create library libosal.a
--- Leaving /root/soem/osal/linux
--- Leaving /root/soem/osal
--- Entering /root/soem/oshw
--- Entering /root/soem/oshw/linux
--- Compiling nicdrv.c
--- Compiling oshw.c
--- Create library liboshw.a
--- Leaving /root/soem/oshw/linux
--- Leaving /root/soem/oshw
--- Entering /root/soem/soem
--- Compiling ecat.c
ecat.c: In function ‘ecat_net_init’:
ecat.c:10:3: warning: implicit declaration of function ‘calloc’ [-Wimplicit-function-declaration]
ecat.c:10:22: warning: incompatible implicit declaration of built-in function ‘calloc’ [enabled by default]
ecat.c:55:5: warning: implicit declaration of function ‘free’ [-Wimplicit-function-declaration]
ecat.c:55:5: warning: incompatible implicit declaration of built-in function ‘free’ [enabled by default]
ecat.c:60:5: warning: incompatible implicit declaration of built-in function ‘free’ [enabled by default]
ecat.c: At top level:
ecat.c:347:3: warning: suggest parentheses around arithmetic in operand of ‘|’ [-Wparentheses]
ecat.c:348:3: warning: suggest parentheses around arithmetic in operand of ‘|’ [-Wparentheses]
ecat.c:349:3: warning: suggest parentheses around arithmetic in operand of ‘|’ [-Wparentheses]
ecat.c:350:3: warning: suggest parentheses around arithmetic in operand of ‘|’ [-Wparentheses]
ecat.c:351:3: warning: suggest parentheses around arithmetic in operand of ‘|’ [-Wparentheses]
ecat.c: In function ‘ecat_net_receive’:
ecat.c:396:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
ecat.c: In function ‘ecat_slave_get_status’:
ecat.c:645:9: warning: overflow in implicit constant conversion [-Woverflow]
--- Compiling ethercatbase.c
--- Compiling ethercatcoe.c
--- Compiling ethercatconfig.c
--- Compiling ethercatdc.c
--- Compiling ethercatfoe.c
--- Compiling ethercatmain.c
--- Compiling ethercatprint.c
--- Compiling ethercatsoe.c
--- Create library libsoem.a
--- Leaving /root/soem/soem
--- Entering /root/soem/test
--- Entering /root/soem/test/linux
--- Compiling ebox.c
ebox.c: In function ‘ecatthread’:
ebox.c:284:8: warning: variable ‘rc’ set but not used [-Wunused-but-set-variable]
ebox.c: In function ‘main’:
ebox.c:348:8: warning: variable ‘iret1’ set but not used [-Wunused-but-set-variable]
--- Linking ebox
/usr/bin/ld: warning: obj/linux/ebox.o uses 2-byte wchar_t yet the output is to use 4-byte wchar_t; use of wchar_t values across objects may fail
/usr/bin/ld: warning: /root/soem/lib/linux/libsoem.a(ethercatcoe.o) uses 2-byte wchar_t yet the output is to use 4-byte wchar_t; use of wchar_t values across objects may fail
/usr/bin/ld: warning: /root/soem/lib/linux/libsoem.a(ethercatconfig.o) uses 2-byte wchar_t yet the output is to use 4-byte wchar_t; use of wchar_t values across objects may fail
/usr/bin/ld: warning: /root/soem/lib/linux/libsoem.a(ethercatdc.o) uses 2-byte wchar_t yet the output is to use 4-byte wchar_t; use of wchar_t values across objects may fail
/usr/bin/ld: warning: /root/soem/lib/linux/libsoem.a(ethercatmain.o) uses 2-byte wchar_t yet the output is to use 4-byte wchar_t; use of wchar_t values across objects may fail
/usr/bin/ld: warning: /root/soem/lib/linux/libsoem.a(ethercatsoe.o) uses 2-byte wchar_t yet the output is to use 4-byte wchar_t; use of wchar_t values across objects may fail
/usr/bin/ld: warning: /root/soem/lib/linux/libsoem.a(ethercatbase.o) uses 2-byte wchar_t yet the output is to use 4-byte wchar_t; use of wchar_t values across objects may fail
/usr/bin/ld: warning: /root/soem/lib/linux/liboshw.a(nicdrv.o) uses 2-byte wchar_t yet the output is to use 4-byte wchar_t; use of wchar_t values across objects may fail
/usr/bin/ld: warning: /root/soem/lib/linux/liboshw.a(oshw.o) uses 2-byte wchar_t yet the output is to use 4-byte wchar_t; use of wchar_t values across objects may fail
/usr/bin/ld: warning: /root/soem/lib/linux/libosal.a(osal.o) uses 2-byte wchar_t yet the output is to use 4-byte wchar_t; use of wchar_t values across objects may fail
--- Compiling eepromtool.c
eepromtool.c: In function ‘eeprom_read’:
eepromtool.c:214:11: warning: variable ‘wkc’ set but not used [-Wunused-but-set-variable]
eepromtool.c: In function ‘eeprom_write’:
eepromtool.c:271:8: warning: variable ‘ret’ set but not used [-Wunused-but-set-variable]
eepromtool.c:268:11: warning: variable ‘wkc’ set but not used [-Wunused-but-set-variable]
eepromtool.c: In function ‘eeprom_writealias’:
eepromtool.c:302:8: warning: variable ‘wkc’ set but not used [-Wunused-but-set-variable]
--- Linking eepromtool
/usr/bin/ld: warning: obj/linux/eepromtool.o uses 2-byte wchar_t yet the output is to use 4-byte wchar_t; use of wchar_t values across objects may fail
/usr/bin/ld: warning: /root/soem/lib/linux/libsoem.a(ethercatbase.o) uses 2-byte wchar_t yet the output is to use 4-byte wchar_t; use of wchar_t values across objects may fail
/usr/bin/ld: warning: /root/soem/lib/linux/libsoem.a(ethercatmain.o) uses 2-byte wchar_t yet the output is to use 4-byte wchar_t; use of wchar_t values across objects may fail
/usr/bin/ld: warning: /root/soem/lib/linux/liboshw.a(nicdrv.o) uses 2-byte wchar_t yet the output is to use 4-byte wchar_t; use of wchar_t values across objects may fail
/usr/bin/ld: warning: /root/soem/lib/linux/liboshw.a(oshw.o) uses 2-byte wchar_t yet the output is to use 4-byte wchar_t; use of wchar_t values across objects may fail
/usr/bin/ld: warning: /root/soem/lib/linux/libosal.a(osal.o) uses 2-byte wchar_t yet the output is to use 4-byte wchar_t; use of wchar_t values across objects may fail
--- Compiling red_test.c
red_test.c: In function ‘ecatthread’:
red_test.c:201:8: warning: variable ‘rc’ set but not used [-Wunused-but-set-variable]
red_test.c:200:22: warning: unused variable ‘tp’ [-Wunused-variable]
red_test.c: In function ‘main’:
red_test.c:316:15: warning: variable ‘iret2’ set but not used [-Wunused-but-set-variable]
red_test.c:316:8: warning: variable ‘iret1’ set but not used [-Wunused-but-set-variable]
--- Linking red_test
/usr/bin/ld: warning: obj/linux/red_test.o uses 2-byte wchar_t yet the output is to use 4-byte wchar_t; use of wchar_t values across objects may fail
/usr/bin/ld: warning: /root/soem/lib/linux/libosal.a(osal.o) uses 2-byte wchar_t yet the output is to use 4-byte wchar_t; use of wchar_t values across objects may fail
/usr/bin/ld: warning: /root/soem/lib/linux/libsoem.a(ethercatconfig.o) uses 2-byte wchar_t yet the output is to use 4-byte wchar_t; use of wchar_t values across objects may fail
/usr/bin/ld: warning: /root/soem/lib/linux/libsoem.a(ethercatdc.o) uses 2-byte wchar_t yet the output is to use 4-byte wchar_t; use of wchar_t values across objects may fail
/usr/bin/ld: warning: /root/soem/lib/linux/libsoem.a(ethercatmain.o) uses 2-byte wchar_t yet the output is to use 4-byte wchar_t; use of wchar_t values across objects may fail
/usr/bin/ld: warning: /root/soem/lib/linux/libsoem.a(ethercatprint.o) uses 2-byte wchar_t yet the output is to use 4-byte wchar_t; use of wchar_t values across objects may fail
/usr/bin/ld: warning: /root/soem/lib/linux/libsoem.a(ethercatsoe.o) uses 2-byte wchar_t yet the output is to use 4-byte wchar_t; use of wchar_t values across objects may fail
/usr/bin/ld: warning: /root/soem/lib/linux/libsoem.a(ethercatbase.o) uses 2-byte wchar_t yet the output is to use 4-byte wchar_t; use of wchar_t values across objects may fail
/usr/bin/ld: warning: /root/soem/lib/linux/libsoem.a(ethercatcoe.o) uses 2-byte wchar_t yet the output is to use 4-byte wchar_t; use of wchar_t values across objects may fail
/usr/bin/ld: warning: /root/soem/lib/linux/liboshw.a(nicdrv.o) uses 2-byte wchar_t yet the output is to use 4-byte wchar_t; use of wchar_t values across objects may fail
/usr/bin/ld: warning: /root/soem/lib/linux/liboshw.a(oshw.o) uses 2-byte wchar_t yet the output is to use 4-byte wchar_t; use of wchar_t values across objects may fail
--- Compiling simple_test.c
simple_test.c: In function ‘simpletest’:
simple_test.c:40:29: warning: variable ‘wkc_count’ set but not used [-Wunused-but-set-variable]
simple_test.c: In function ‘main’:
simple_test.c:235:9: warning: unused variable ‘iret1’ [-Wunused-variable]
--- Linking simple_test
/usr/bin/ld: warning: obj/linux/simple_test.o uses 2-byte wchar_t yet the output is to use 4-byte wchar_t; use of wchar_t values across objects may fail
/usr/bin/ld: warning: /root/soem/lib/linux/libosal.a(osal.o) uses 2-byte wchar_t yet the output is to use 4-byte wchar_t; use of wchar_t values across objects may fail
/usr/bin/ld: warning: /root/soem/lib/linux/libsoem.a(ethercatconfig.o) uses 2-byte wchar_t yet the output is to use 4-byte wchar_t; use of wchar_t values across objects may fail
/usr/bin/ld: warning: /root/soem/lib/linux/libsoem.a(ethercatdc.o) uses 2-byte wchar_t yet the output is to use 4-byte wchar_t; use of wchar_t values across objects may fail
/usr/bin/ld: warning: /root/soem/lib/linux/libsoem.a(ethercatmain.o) uses 2-byte wchar_t yet the output is to use 4-byte wchar_t; use of wchar_t values across objects may fail
/usr/bin/ld: warning: /root/soem/lib/linux/libsoem.a(ethercatprint.o) uses 2-byte wchar_t yet the output is to use 4-byte wchar_t; use of wchar_t values across objects may fail
/usr/bin/ld: warning: /root/soem/lib/linux/libsoem.a(ethercatsoe.o) uses 2-byte wchar_t yet the output is to use 4-byte wchar_t; use of wchar_t values across objects may fail
/usr/bin/ld: warning: /root/soem/lib/linux/libsoem.a(ethercatbase.o) uses 2-byte wchar_t yet the output is to use 4-byte wchar_t; use of wchar_t values across objects may fail
/usr/bin/ld: warning: /root/soem/lib/linux/libsoem.a(ethercatcoe.o) uses 2-byte wchar_t yet the output is to use 4-byte wchar_t; use of wchar_t values across objects may fail
/usr/bin/ld: warning: /root/soem/lib/linux/liboshw.a(nicdrv.o) uses 2-byte wchar_t yet the output is to use 4-byte wchar_t; use of wchar_t values across objects may fail
/usr/bin/ld: warning: /root/soem/lib/linux/liboshw.a(oshw.o) uses 2-byte wchar_t yet the output is to use 4-byte wchar_t; use of wchar_t values across objects may fail
--- Compiling slaveinfo.c
--- Linking slaveinfo
/usr/bin/ld: warning: obj/linux/slaveinfo.o uses 2-byte wchar_t yet the output is to use 4-byte wchar_t; use of wchar_t values across objects may fail
/usr/bin/ld: warning: /root/soem/lib/linux/libsoem.a(ethercatcoe.o) uses 2-byte wchar_t yet the output is to use 4-byte wchar_t; use of wchar_t values across objects may fail
/usr/bin/ld: warning: /root/soem/lib/linux/libsoem.a(ethercatconfig.o) uses 2-byte wchar_t yet the output is to use 4-byte wchar_t; use of wchar_t values across objects may fail
/usr/bin/ld: warning: /root/soem/lib/linux/libsoem.a(ethercatdc.o) uses 2-byte wchar_t yet the output is to use 4-byte wchar_t; use of wchar_t values across objects may fail
/usr/bin/ld: warning: /root/soem/lib/linux/libsoem.a(ethercatmain.o) uses 2-byte wchar_t yet the output is to use 4-byte wchar_t; use of wchar_t values across objects may fail
/usr/bin/ld: warning: /root/soem/lib/linux/libsoem.a(ethercatprint.o) uses 2-byte wchar_t yet the output is to use 4-byte wchar_t; use of wchar_t values across objects may fail
/usr/bin/ld: warning: /root/soem/lib/linux/libsoem.a(ethercatsoe.o) uses 2-byte wchar_t yet the output is to use 4-byte wchar_t; use of wchar_t values across objects may fail
/usr/bin/ld: warning: /root/soem/lib/linux/libsoem.a(ethercatbase.o) uses 2-byte wchar_t yet the output is to use 4-byte wchar_t; use of wchar_t values across objects may fail
/usr/bin/ld: warning: /root/soem/lib/linux/liboshw.a(nicdrv.o) uses 2-byte wchar_t yet the output is to use 4-byte wchar_t; use of wchar_t values across objects may fail
/usr/bin/ld: warning: /root/soem/lib/linux/liboshw.a(oshw.o) uses 2-byte wchar_t yet the output is to use 4-byte wchar_t; use of wchar_t values across objects may fail
/usr/bin/ld: warning: /root/soem/lib/linux/libosal.a(osal.o) uses 2-byte wchar_t yet the output is to use 4-byte wchar_t; use of wchar_t values across objects may fail
--- Compiling firm_update.c
--- Linking firm_update
/usr/bin/ld: warning: obj/linux/firm_update.o uses 2-byte wchar_t yet the output is to use 4-byte wchar_t; use of wchar_t values across objects may fail
/usr/bin/ld: warning: /root/soem/lib/linux/libsoem.a(ethercatbase.o) uses 2-byte wchar_t yet the output is to use 4-byte wchar_t; use of wchar_t values across objects may fail
/usr/bin/ld: warning: /root/soem/lib/linux/libsoem.a(ethercatconfig.o) uses 2-byte wchar_t yet the output is to use 4-byte wchar_t; use of wchar_t values across objects may fail
/usr/bin/ld: warning: /root/soem/lib/linux/libsoem.a(ethercatfoe.o) uses 2-byte wchar_t yet the output is to use 4-byte wchar_t; use of wchar_t values across objects may fail
/usr/bin/ld: warning: /root/soem/lib/linux/libsoem.a(ethercatmain.o) uses 2-byte wchar_t yet the output is to use 4-byte wchar_t; use of wchar_t values across objects may fail
/usr/bin/ld: warning: /root/soem/lib/linux/libsoem.a(ethercatsoe.o) uses 2-byte wchar_t yet the output is to use 4-byte wchar_t; use of wchar_t values across objects may fail
/usr/bin/ld: warning: /root/soem/lib/linux/libsoem.a(ethercatcoe.o) uses 2-byte wchar_t yet the output is to use 4-byte wchar_t; use of wchar_t values across objects may fail
/usr/bin/ld: warning: /root/soem/lib/linux/liboshw.a(nicdrv.o) uses 2-byte wchar_t yet the output is to use 4-byte wchar_t; use of wchar_t values across objects may fail
/usr/bin/ld: warning: /root/soem/lib/linux/liboshw.a(oshw.o) uses 2-byte wchar_t yet the output is to use 4-byte wchar_t; use of wchar_t values across objects may fail
/usr/bin/ld: warning: /root/soem/lib/linux/libosal.a(osal.o) uses 2-byte wchar_t yet the output is to use 4-byte wchar_t; use of wchar_t values across objects may fail
--- Leaving /root/soem/test/linux
--- Leaving /root/soem/test

Setting up Qt Creator with SOEM

Hello there,
I am trying to set up QT Creator to work with the SOEM library. I think I got everything set up properly but i still cannot build the project as it says it cannot find the .obj files. I am using MSVC 2013 compiller.

osal.obj:-1: error: LNK2019: unresolved external symbol __imp_timeBeginPeriod referenced in function osal_gettimeofday
nicdrv.obj:-1: error: LNK2019: unresolved external symbol __imp_timeEndPeriod referenced in function ecx_closenic
nicdrv.obj:-1: error: LNK2019: unresolved external symbol __imp_htons referenced in function ec_setupheader
oshw.obj:-1: error: LNK2001: unresolved external symbol __imp_htons
nicdrv.obj:-1: error: LNK2019: unresolved external symbol __imp_ntohs referenced in function ecx_inframe
oshw.obj:-1: error: LNK2001: unresolved external symbol __imp_ntohs

It cannot find osal.obj, nicdrv.obj etc. Should they be generated while building or should I copy and rename the files from CMake firectory (osal.c.obj etc)?
I would really apreciate all help, I am struggling with this since yesterday :(.

Windows 10

I'm having issues getting my program to run on Windows 10. Can anyone confirm if they have tested this platform? I've seen reports of issues with Winpcap NDIS 5 issues, and network filter driver changes to the network stack, then reports of Microsoft reverting some but not all changes, such that Wireshark works but many custom drivers that use the winpcap do not.

When running my app, or the slaveinfo app the program reports "no slaves found!":

SOEM (Simple Open EtherCAT Master)
Slaveinfo
Starting slaveinfo
ec_init on \Device\NPF_{C20966BE-86CE-4CC8-B9CE-C5A6BFEA12F7} succeeded.
No slaves found!
End slaveinfo, close socket
End program

multi threaded concurrent acces on one master

Hi,
Is the SOEM thread safe ? Is it by example possible to have one thread (with high priority) dedicated to the cyclic communication (PDO) and other threads that access "from time to time" to a slave register or an CoE Object dictionary (SDO) ?

I see that the access to a new index (function ecx_getindex(...)) is protected by a region (nameless mutex, INtime implementation). But I feel that a part of ecx_outframe(..) (hpeGetTransmitterState(..) call to hpeStartTransmitter(..) call) and ecx_inframe(..) (ecx_recvpkt(..) call to the end of the function) should also be protected ?
And I see that the struct ecx_portt contains two mutex not used (tx_region and rx_region).

Can you give me more information about it ?

Best regards

Slaves do not reach safe operational state LAN925

Hello there,
I have managed to make the library work properly under windows after a while. For my project I have build mysalfe 2 boards based on LAN9252 chips. I am not an expert in etherCat, as I just started using it. When I run slaveinfo.exe with the devices I see (while debugging) that they are still in state EC_STATE_INIT not in EC_STATE_SAFE_OP (but that it also known from the console output). But then again it says "No error".

m:\Github\SOEM\build\test\linux\slaveinfo>slaveinfo.exe \Device\NPF_{934C2F50-AC76-478A-BADE-D108A734FA6B} -SDO
SOEM (Simple Open EtherCAT Master)
Slaveinfo
Starting slaveinfo
ec_init on \Device\NPF_{934C2F50-AC76-478A-BADE-D108A734FA6B} succeeded.
2 slaves found and configured.
Calculated workcounter 0
Not all slaves reached safe operational state.
Slave 1 State= 1 StatusCode=   0 : No error
Slave 2 State= 0 StatusCode=   0 : No error

Slave:1
 Name:? M:ffffffff I:ffffffff
 Output size: 0bits
 Input size: 0bits
 State: 1
 Delay: 0[ns]
 Has DC: 1
 DCParentport:0
 Activeports:1.1.0.0
 Configured address: 1001
 Man: ffffffff ID: ffffffff Rev: ffffffff
 SM0 A:ffff L:65535 F:00010026 Type:1
 SM1 A:ffff L:65535 F:00010022 Type:2
 FMMUfunc 0:0 1:0 2:0 3:0
 MBX length wr: 65535 rd: 65535 MBX protocols : ffff
 CoE details: 00 FoE details: 00 EoE details: 00 SoE details: 00
 Ebus current: 0[mA]
 only LRD/LWR:0

Slave:2
 Name:? M:ffffffff I:ffffffff
 Output size: 0bits
 Input size: 0bits
 State: 1
 Delay: 740[ns]
 Has DC: 1
 DCParentport:1
 Activeports:1.0.0.0
 Configured address: 1002
 Man: ffffffff ID: ffffffff Rev: ffffffff
 SM0 A:ffff L:65535 F:00010026 Type:1
 SM1 A:ffff L:65535 F:00010022 Type:2
 FMMUfunc 0:0 1:0 2:0 3:0
 MBX length wr: 65535 rd: 65535 MBX protocols : ffff
 CoE details: 00 FoE details: 00 EoE details: 00 SoE details: 00
 Ebus current: 0[mA]
 only LRD/LWR:0
End slaveinfo, close socket
End program

I was wondering what has to be done to enable the slaves to go into operational state? I havent configured them with software yet at any point, they are set to defaults. Are there any additional steps I should take? I would appreciate all help!

Any plan to support EoE?

Hi there,

are there any plans to support Ethernet over Ethercat in the futur ?
If not, do you have a link to the specs of the protocol. This would help me understand the code and maybe try to implement it if nobody wants to do it.

Have a nice day

Problem with ec_init() under VxWorks

I am trying to start the SOEM software under VxWorks 6.9. Compilation works fine I am using the Linux version. I do not have any undefined symbols after loading and starting the application. After starting the application I always have a problem with the bind() function in ecx_setupnic( in nicdrv.c) which returns with error 45 (S_errno_EOPNOTSUPP). Any ideas?

Jitter while sending 1024 bytes with three slaves connected to SOEM.

1.) Configured three Ethercat slaves each sending 1024bytes & receiving 128 bytes process data every cycle. ( Slave = Microchip LAN9252)
2.) Our master is SOEM running on TI AM3359 / LINUX RT . ( version = 1.3.1, version = Linux 4.4 PREMPT RT )
3.) We setup cycle time on SOEM roughly at 2 milliseconds. ( using the simple_test example)

We are noticing a jitter roughly around 650 microseconds on the Wireshark capture & attached it too. We kindly request you to let us know are there ways we could reduce the jitter to absolute minimum or zero or could you suggest us a different hardware / dev kit for SOEM.

Note:
soem_am3359_linuxRT_2000usec_1024bytes.png to soem_am3359_linuxRT_2000usec_1024bytes.pcapng

soem_am3359_linuxrt_2000usec_1024bytes

What is the significance of SubIndex when CA is TRUE?

In ecx_SDOread() and ecxSDOwrite(), the parameter CA says:

FALSE = single subindex. TRUE = Complete Access, all subindexes read/written.

And the parameter SubIndex says:

Subindex to read, must be 0 or 1 if CA is used

What is the difference between 0 and 1 if CA is used?

SOEM with EK1100, EL6751 , EL6731 and EL 6752

Hi,

I am working on implementing the simple test code on the master slave configuration that i have, following are the layout:
RaspberryPi(Master) -> EK1100 (slave) --> EL6751 (CANOpen)
|--> EL6731 (ProfiBUS)
|--> EL6752 (DeviceNET)
|--> BK 1120 (EtherCAT Slave IO)

i am able to configure set and reset ios in BK1120, but the other ones are still giving errors. I have checked the manufacturer manual and it appears that the configuration is not correct. in the code, the configuration is curried out by ec_config_init(false); but i need to configure each one at a time and i need to know what is the ec_contextx for that. do you have any idea?

Question on ec_foewrite

Hi,
I'm using the foewrite to send several files to a slave. The function works well, it sends files and the slave receives them. But I have noticed that often the function returns 0, or -5. What does it mean? is there a document that explains the return values of foewrite?
I also noticed that in the example on foewrite, after calling the function, there are the following lines:
ec_slave[slave].state = EC_STATE_INIT;
ec_writestate(slave);
These lines are important? If so, why? I haven't written in my code.
I'm sorry if the questions may be stupid, but I'm working with the EtherCAT few months.
Thank you

SOEM takes the max txPDO size as the default while sending process data.

Hi ,

Tried to configure 4 EtherCAT slave with different ESI configuration.

SLAVE1 = 1024 bytes of txPDO 64 bytes of rxPDO
SLAVE2 = 64 bytes of txPDO 64 bytes of rxPDO
SLAVE3 = 64 bytes of txPDO 64 bytes of rxPDO
SLAVE4 = 64 bytes of txPDO 64 bytes of rxPDO.

When i ran the slaveinfo test program , it detected all four slaves with txPDO size 1024 bytes. Any suggestions regarding how to run the above mentioned configuration would be of a great help.

Using SOEM with INtime 6

Hello,

I would like use the Simple Open Ethercat Master with the OSRT INtime (v. 6.0), and I have several questions about it :

Is the SOEM currently compatible with INtime ? When I look the sources it seems to me that the osal for Intime is not complete and the build configuration too.
Can you give me more information about it ?

The implementation of the oshw (nicdrv) with hpe2 interface is really interesting. Is it functional ?

Best regards

Force byte alignment

In the way our control code is setup (a struct per slave mapped to the PDO map) it is pretty much impossible to use bit-orientated slaves. Is there a way to force SOEM to always byte align slaves?

Use three time for set output and get input

Hi,
I'm a beginner in EtherCAT. I used SOEM to test my slave. In slave code I put input = output.
But I must use three time send and receive to get right input.

ec_send_processdata();
wkc = ec_receive_processdata(EC_TIMEOUTRET);

Do you have any idea?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.