[etherlab-users] Accessing the EtherCAT master from a Xenomai driver
Asier Tamayo
asier.tamayo at onaedm.com
Mon Jan 13 10:33:01 CET 2014
Hello all,
Is it possible to access to the EtherCAT master from a Xenomai real-time driver? Has anyone managed to do it? I am trying to follow the functions of the Xenomai example, but I find some problems I can't see how to resolve.
For instance, as the Xenomai example is a user space application, it has no problem calling ecrt_master_activate(), which eventually calls rtdm_mmap_to_user(). However, in the RTDM driver, this function is called with a user_info value set to NULL.
Besides, I also find that some functions have to be called in non-realtime context. For instance, in ecrt_master_slave_config(), which allocates memory.
[A couple of moths ago, I asked about "Accessing the EtherCAT master from 2 tasks". Finally, I decided to create a RTDM driver that would execute the EtherCAT cycle and could be called from different tasks.]
Best regards,
Asier
> -----Mensaje original-----
> De: etherlab-users-bounces at etherlab.org [mailto:etherlab-users-
> bounces at etherlab.org] En nombre de Asier Tamayo
> Enviado el: viernes, 15 de noviembre de 2013 13:50
> Para: etherlab-users at etherlab.org
> Asunto: Re: [etherlab-users] Accessing the EtherCAT master from 2 tasks
>
> Hello all,
>
> Jürgen, Richard, thank you for your answers.
>
> I think the different threads approach is very interesting. However, the
> tasks are completely independent, and this solution would create a mess in
> my code: I want to keep what is different in different programs (even
> developed by different programmers).
>
> > Each board, and I presume each one is a master,
> >
> Maybe I haven't explained it correctly. My main board (running the
> EtherCAT master) has only one Ethernet connector, which connects to a
> Bechoff EK1100 device, which in turn is connected to other Beckhoff
> devices. I can only run an EtherCAT master. Am I correct?
>
> So, I think I may finally create a RTDM driver that both tasks can talk
> to. I will anyway take into account many of your suggestions regarding the
> locks...
>
> Best regards,
>
>
> Asier
>
>
> > -----Mensaje original-----
> > De: etherlab-users-bounces at etherlab.org [mailto:etherlab-users-
> > bounces at etherlab.org] En nombre de Richard Hacker
> > Enviado el: viernes, 15 de noviembre de 2013 11:10
> > Para: etherlab-users at etherlab.org
> > Asunto: Re: [etherlab-users] Accessing the EtherCAT master from 2 tasks
> >
> > Each board, and I presume each one is a master, can be accessed by a
> > separate process. They are identified by ecrt_request_master(0) and
> > ecrt_request_master(1). The masters run autonomously so you will not
> > have adverse effects using 2 masters in 2 processes, you don't even need
> > locking.
> >
> > Using domains having different sample times from the same master is
> > another case. Then you will need to do threading as well as locking when
> > accessing the domain queue, i.e. when using ecrt_domain_process() and
> > ecrt_domain_queue().
> >
> > Am 11/14/2013 02:36 PM, schrieb Jürgen Kunz:
> > > Hello Aiser,
> > >
> > > you can do this in one process with different threads. One of your
> > > thread, maybe your main thread, calls ecrt_request_master(). You
> > > register each EtherCAT board in a separate domain. Then you are able
> to
> > > access the different boards individually through the different
> domains.
> > > The only thing you have to consider is that every time you call the
> > > master with one thread, you need to lock it with a global mutex, so
> that
> > > it cannot be accessed the same time by different threads.
> > >
> > > Best regards,
> > > Jürgen
> > >
> > > Am 14.11.2013 13:37, schrieb Asier Tamayo:
> > >>
> > >> Hello all,
> > >>
> > >> I'm a new user to the EtherCAT Master, so I beg your pardon if this
> > >> question has already been answered or it is a RT*M type question. I'm
> > >> using the master with Xenomai.
> > >>
> > >> I want to access EtherCAT from two different tasks, each one
> accessing
> > >> to different EtherCAT boards. Is there any way I can do it? The
> > >> ecrt_request_master() function reserves the EtherCAT master for
> > >> exclusive use, and therefore I can't call it again from the second
> > >> task. Do I have to create a Xenomai RTDM driver that would reserve
> the
> > >> master for itself and then let the tasks execute ioctl's to that
> > >> driver? Is it possible?
> > >>
> > >> Best regards,
> > >>
> > >> Asier
> > >>
> > >>
> > >>
> > >> _______________________________________________
> > >> etherlab-users mailing list
> > >> etherlab-users at etherlab.org
> > >> http://lists.etherlab.org/mailman/listinfo/etherlab-users
> > >
> > > --
> > > Dipl.-Inform. Jürgen Kunz
> > >
> > > Technische Universität Darmstadt <http://www.tu-darmstadt.de>
> > > FG Simulation, Systemoptimierung und Robotik
> > > <http://www.sim.tu-darmstadt.de>
> > > Hochschulstr. 10
> > > 64289 Darmstadt
> > >
> > > Tel.: ++49 (0) 6151-16-70383
> > > Fax: ++49 (0) 6151-16-6648
> > > E-Mail: kunz(at)sim.tu-darmstadt.de
> > > Homepage: http://www.sim.tu-darmstadt.de
> > >
> > >
> > > _______________________________________________
> > > etherlab-users mailing list
> > > etherlab-users at etherlab.org
> > > http://lists.etherlab.org/mailman/listinfo/etherlab-users
> > >
> >
> > Mit freundlichem Gruß
> >
> > Richard Hacker
> >
> > --
> > ------------------------------------------------------------------------
> >
> > Richard Hacker M.Sc.
> > richard.hacker at igh-essen.com
> > Tel.: +49 201 / 36014-16
> >
> > Ingenieurgemeinschaft IgH
> > Gesellschaft für Ingenieurleistungen mbH
> > Heinz-Bäcker-Str. 34
> > D-45356 Essen
> >
> > Amtsgericht Essen HRB 11500
> > USt-Id.-Nr.: DE 174 626 722
> > Geschäftsführung:
> > - Dr.-Ing. T. Finke,
> > - Dr.-Ing. W. Hagemeister
> > Tel.: +49 201 / 360-14-0
> > http://www.igh-essen.com
> >
> > ------------------------------------------------------------------------
> > _______________________________________________
> > etherlab-users mailing list
> > etherlab-users at etherlab.org
> > http://lists.etherlab.org/mailman/listinfo/etherlab-users
> _______________________________________________
> etherlab-users mailing list
> etherlab-users at etherlab.org
> http://lists.etherlab.org/mailman/listinfo/etherlab-users
More information about the Etherlab-users
mailing list