Closed ergial23 closed 3 years ago
Keep it simple and stick to a single thread to start with, check test/linux/red_test.c.
Below, implement your application state machine in that loop.
If that is not possible , you need to synchronize the access of the IOmap, since below functions will access the IOmap (read and write), if you access the IOmap from another thread you need to handle that.
ec_send_processdata();
ec_receive_processdata(EC_TIMEOUTRET)
wkc = ec_receive_processdata(EC_TIMEOUTRET);
dorun++;
/* if we have some digital output, cycle */
if( digout ) *digout = (uint8) ((dorun / 16) & 0xff);
if (ec_slave[0].hasdc)
{
/* calulate toff to get linux time and DC synced */
ec_sync(ec_DCtime, cycletime, &toff);
}
ec_send_processdata();
I have introduced the state machine in the cyclic loop but now, due to the wait time between states, the communication fails and there is an application watchdog failure. I understand that there is a synchronization problem so, should I introduce the ec_sync and ecatthread functions you mentioned, even if I use the ec_send_processdata in only one thread? It's being quite difficult for me to understand what is done in those functions so any help would be great. Thanks in advance.
You need to keep the processdata loop going at < 100ms cycle time, otherwise the slaves watchdogs will trip and they'll enter SAFEOP, eg "outputs" get disabled.
Perfect, thanks but the data sheet of the actuator says that I must set the time more than twice the communication cycle time for the interval between the signals, when the signals are continuously input, so how can I manage that?
Cycle time is relative, you conrtol what cycle time you'll run at.
@ergial23 , can this issue be closed?
close due to inactivity
Hi guys, since I'm new to SOEM and ethercat I'm a little bit lost in the way the IO map is updated and how I could send the target position to an actuator via etherCAT. Readind the tutorial and the issues closed, this is what I've been trying:
Executing the slaveinfo -map this is the output I get:
Therefore, in order to send the target position to the actuator I created the following structure:
Then, once we are in SAFE-OP
out_ac = (out_actuador*) ec_slave[1].outputs;
and finally, in order to send the target position we should send the next sequence:I'm trying to adapt the simple_test code and introduce that in the cyclic loop but I have not been able to do that, since, in order to remain in OP state, I have to keep sending data to the actuator, I left the cyclic loop this way:
and then I created another thread in wich the IO map is updated but this doesn't work.
Sorry for the inconviniece. Since I'm a little bit lost here, any help would be great, thanks. This is the ESI file: SMC JXCE1_V10.txt