Hi all,

I'm new to to the EtherLab project, and to the EtherCAT world in
general, so my apologies in advance if the questions are dumb.

I'm interested in master development, so I checked the two more popular
opensource choices: SOEM and this one (I called it IgH ethercat).
To have a real taste, I implemented two similar test programs on top of
both. The full source code is available on Github:

    https://github.com/ntd/ethercatest

To measure the roundtrip time, i.e. the time needed to send a packet
and receive its response, I have something similar to this pseudocode:

    start = g_get_monotonic_time();

    ecrt_domain_queue(domain);
    ecrt_master_send(master);
    do {
        g_usleep(5);
        ecrt_master_receive(master);
        ecrt_domain_process(domain);
        ecrt_domain_state(domain, &state);
    } while (state.wc_state != EC_WC_COMPLETE);

    roundtrip = g_get_monotonic_time() - start;

Here are my questions.

1. I had to add a 5 us delay to avoid hogging the CPU. Without it,
   every 5/10000 iteration, I was getting a 40 ms (milliseconds!)
   roundtrip. This maybe has nothing to do with EtherLab but... has
   anyone experienced this kind of behavior?

2. Is there a way to do the same without this awful polling loop?
   Callbacks? Anything else?

3. I have a function (fieldbus_automapping) that clears any previous
   PDO mapping and remap everything by using what returned by
   ecrt_master_get_pdo_entry(). This seems quite an obvious candidate
   for `libethercat` but, being a novice in EtherCAT, I'm fearing to say
   rubbish. Does that function existence make any sense? Is it worth to
   be included in `libethercat`?

4. Similar to the previous question: I have a function
   (fieldbus_autoconfigure, more a proof-of-concept than a real
   function) that sequentially registers the outputs and the inputs
   into the process data. Is it too much "high-level" to be upstreamed?

Ciao.
-- 
Nicola


-- 
Etherlab-users mailing list
Etherlab-users@etherlab.org
https://lists.etherlab.org/mailman/listinfo/etherlab-users

Reply via email to