0
votes

I have EK1101, EL6002, EL2034 modules which is based on network devices. These modules are connected PC Ethernet port via ethernet cable. I have tested these modules with some application program, its working fine on my PC.

EK1101 working as a Coupler. It connects PC Ethernet Port and Other slave modules( EL6002, EL2034,..)

EL6002 working as a RS232 communication. EL2034 working as digital I/O. Similarly we have more than 10 different devices. These modules interfaced with EK1101 coupler at same time.

How can i implement as Linux driver? and start?Do I modify the existing network driver or start new driver from scratch? what type of i need to write, character or network driver? If its character driver how can i transfer data through Ethernet port?

1
If talking to it from an application program (via sockets) is working, why in the world would you want to write your own driver? Just install a user application as a background service and you're good.Ben Voigt
Thanks for your answer, application program requires root permission. I need to execute our application without root permission.Bala Subramanian
Installing a driver requires root permission... run a service with root permission and let your unprivileged application communicate with it.Ben Voigt
yes, we can access a driver in application without root permission by changing permission(chmod) command. so better to implement as driver.Bala Subramanian
No, definitely not better to implement as driver. Drivers are more difficult to develop and debug, faults are not isolated, and they are specific to a particular kernel version. Instead, run a user-mode process as root, and one as the unprivileged user, and let them talk to each other using any of the usual IPC mechanisms.Ben Voigt

1 Answers

0
votes

Using the serial slice (EL6002) you can only send 22 bytes (each direction) per exchange for each port. At full serial bandwidth (115k) updating at 1kHz, you won't be able to miss an update without starving the transmitter and/or dropping data on the receiver. If that's a concern you will probably need to claim exclusive control over the Ethernet port being used to master the EtherCAT loop. This requires some form of root permissions, otherwise someone can always try to send packets over the port, affecting your timings. You haven't given much detail about your application or timing requirements, so maybe that's not critical for you.

I've been using the Etherlab IgH open source stack, which requires root permissions to load its kernel module which implements the underlying stack. Once that's done you can set everything else up to run from user space without root permissions.

Once your application acquires access to the master stack, you setup a data exchange domain (what TwinCat calls a task) and you will have a region of shared memory that can be used to monitor the EtherCAT frame data. Your application is responsible for deciding when to send and receive domain updates.