[etherlab-users] DC, mode B not working

Miceli Jean-Pierre jean-pierre.miceli at heig-vd.ch
Tue Jan 22 19:00:50 CET 2019


Hi all,


I'm working on a kernel module which should control Beckhoff IN/OUT modules. The network is formed by a coupler (EK1100), digital inputs (EL1252) and digital outputs (EL2252).

For the EL2252, I have to make it work with DC in ModeB. I read most of the documentation/info available on this forum, but I cannot get a working configuration: or it does not work at all or there is a period glitch some time (the output switch on period to late).


Here is the my cyclic task only ethercat related function (full code attached):


while (!kthread_should_stop()) {
    usleep_range(period_time, period_time);

    // receive process data
    ecrt_master_receive(master);
    ecrt_domain_process(domain1);

    /* cyclic operations (read/write regs) */

    ecrt_domain_queue(domain1);
#if 1
    now = get_boot_time_ns();
    app_time += app_period + (now - sleep_time);
    ecrt_master_application_time(master, app_time);

    /* Get the reference clock from the DC master (first slave with DC) */
    ecrt_master_reference_clock_time(master, &ref_time);

    /* Sync other slaves with this reference time */
    ecrt_master_sync_slave_clocks(master);
#else
    /* Time method seem great but don't work... */

    /* Get the reference clock from the DC master (first slave with DC) */
    ecrt_master_reference_clock_time(master, &ref_time);

    /* Sync other slaves with this reference time */
    app_time += app_period + ref_time;
    ecrt_master_application_time(master, app_time);

    ecrt_master_sync_slave_clocks(master);
#endif

    ecrt_master_send(master);

    /* Update app_period... */


Any suggestion on what is wrong with my code/understanding ?


The way to toggle an output on the EL2252 is:

  1.  Set output state and Time the output should change
  2.  Activation

In my code, the output changes state each 10ms (just for the experiment)



Linux: RT-Preempt on Debian Wheezy (kernel 3.2)

Driver: e1000e


Thanks for your help

J-P
-------------- next part --------------
A non-text attachment was scrubbed...
Name: beckhoff_module_modeB.c
Type: text/x-csrc
Size: 12754 bytes
Desc: beckhoff_module_modeB.c
URL: <http://lists.etherlab.org/pipermail/etherlab-users/attachments/20190122/a3918a4c/attachment-0003.c>


More information about the Etherlab-users mailing list