Cannot use ethercat terminals sending more than 1 byte.

More
04 Jun 2021 08:22 - 04 Jun 2021 11:19 #211133 by Stormholt
Dear forum

I have been trying to use more ethercat terminals. A lot of them do not have drivers implemented for them. The ones i have that dont have drivers are EL2014, El3004, EL3202, EL3314. I have created the driver using the mighty Grotius forum.linuxcnc.org/27-driver-boards/3559...-how-to-installguide . The drivers work fine on their own, verified by using twincat in windows. The problems occur when the terminals are connected serially in the EK1100.
Lets say I have the terminals connected like this: Ek1100, EL2004(1byte of data), EL2014(4byte of data), EL1002(1byte of data), I will only receive 5 bytes. Additionally the EL1002 will have its hal values controlled by what the first terminal shows.
By testing with different terminals i have found the pattern to be: All devices after a device that sends more than 1 byte will not have its data sent/read, but rather show values based on the very first terminal. If i had a stack like this:EL2014(4byte of data), EL2004(1byte of data), EL1002(1byte of data) i would get 4 bytes, and like this: EL2004(1byte of data), EL1002(1byte of data), EL2014(4byte of data) i will get 6 bytes and every thing working fine.

All devices go into OP state and there are no error messages. I have looked a little in the linuxcnc-ethercat source code and inserted some print calls to see that the pdo_entry_count is correct, every slaves is iterated through, but the master process data length is not correct.

I suspect the drivers i have written to create some kind of issue, but i have stared myself blind trying to find the root of the problem.

Any help is appreciated! I have attached the drivers i have written
Last edit: 04 Jun 2021 11:19 by Stormholt.

Please Log in or Create an account to join the conversation.

More
06 Jun 2021 17:30 #211310 by db1981
Hello Stormholt,

i have taken a few look on your code and can't see nothing what is obivousily wrong.
(its hard to look only at the code and to not be able to test it.....)

I would have seperated the channel data and build it to react dynamic on the channel count, to cover all el201X.

dmesg tells nothing? Did you set "ethercat debug 1" ?

Please Log in or Create an account to join the conversation.

More
06 Jun 2021 20:18 - 06 Jun 2021 21:16 #211346 by Grotius
Hi Stormhold,

In file el2202.h there is a error. It misses the lcec.h include.
Maybe that will fix the rest in the compile sequence.

And a idea can be. Just compile the lcec.so lib with only the drivers you actually use. It this works oke. You know a little more.

attached a lcec.so and lcec.conf with only inside :
obj-m += lcec.o
lcec-objs := \
    lcec_main.o \
    lcec_class_enc.o \
    lcec_generic.o \
    lcec_el2xxx.o \
    lcec_el2014.o

I hope this works.
To test in a stack like : EL2014(4byte of data), EL2004(1byte of data).
Attachments:
Last edit: 06 Jun 2021 21:16 by Grotius.

Please Log in or Create an account to join the conversation.

More
08 Jun 2021 07:05 #211483 by Stormholt
@db1981 yes indeed no info from dmesg have used both ethercat debug 1 and 2.
I will try with seperated channel data!

@Grotius: good spot! i will try compiling as you have specified!

Thank you both for you help on this!

Please Log in or Create an account to join the conversation.

More
08 Jun 2021 07:31 #211484 by Stormholt
When modifying the Kbuild to only the device used, like your example, get an error :
lcec: dlopen: /usr/lib/linuxcnc/modules/lcec.so: undefned symbol: lcec_ax5200_init 
and after adding lcec_ax5200.o \ to the compile:
lcec: dlopen: /usr/lib/linuxcnc/modules/lcec.so: undefned symbol: lcec_el1152_init 

Please Log in or Create an account to join the conversation.

More
08 Jun 2021 08:22 #211487 by db1981
compiling only single modules in this way will not work..

you have to delete the unused driver data_types in lcec_conf.c and .h .

Did you add your types to lcec_conf? i forgot this to ask before...

Please Log in or Create an account to join the conversation.

More
08 Jun 2021 08:29 #211488 by Grotius
Hi Stormhold,

It looks like a run error.
Maybe add some include's to the lcec_main.c, and some lcec names + data over there. I did not do that. :woohoo:

Attached my qt project.
1. open -> qt-test.creator
2. edit config.mk (Set path to the halcomplie executable and lcnc main makefile)
3. edit configure.mk (Set path to the halcomplie executable).
4. edit qt-test.includes (Set path to several includes)
5. Cntr+r (run)
6. When compiled you get the lcec.so and lcec_conf.
7. When doing a new compile just delete the lcec.so and lcec_conf before. ( or do a make clean )
8. Warning's about "set an executable in the custom run configuration" are not important.
Attachments:

Please Log in or Create an account to join the conversation.

More
08 Jun 2021 13:56 - 08 Jun 2021 13:59 #211507 by Stormholt
@db1981 i believe i add the drivers correctly, i have attached files i edit when adding new drivers

Furthermore, this i how i build after changes:
cd /home/linuxcnc-ethercat

sudo make clean
sudo make
sudo make install 

sudo cp -f src/lcec_conf ~/vaerkscnc-dev/config/         #Same path as .ini
sudo cp -f src/lcec.so /usr/lib/linuxcnc/modules/
Attachments:
Last edit: 08 Jun 2021 13:59 by Stormholt.

Please Log in or Create an account to join the conversation.

More
08 Jun 2021 15:01 #211514 by Stormholt
@Grotius i dont have/cant find similar paths for the include files:
May have something to do with linuxcnc being installed from apt.
The most similar i have are:
/usr/include/linuxcnc
/usr/lib/linuxcnc
/home/linuxcnc-ethercat/src
With which i get an error: :-1: error: You need to set an executable in the custom run configuration.
I have checked that the .mk files points to an executable halcompile

Please Log in or Create an account to join the conversation.

More
08 Jun 2021 15:48 - 08 Jun 2021 15:59 #211519 by Grotius
Hi Stormhold,

You are almost there ! Hold on.

error: You need to set an executable in the custom run configuration.
This is no issue. Just look if Qt has compiled the lcec.so.
Qt gives this message because it expect's to start a executable like a program. But there is no. It's just a library.
I get the same message. I just check if lcec.so is compiled.

When for example i start a executable like a c++ hal program, you can set this in the build configuration.
I don't get the message. And the executable program
is then designed to load the lcec.so and then check the library values. Somewhere i did a example of that in a bash file.
You can start a simple bash file to check your library values. Like a bash file that does a halcommand with loadrt lcec.so

The most important includepath is that where halcompile lives. Mabye in c: $ sudo find . -name halcompile
This will problably be a /bin dir. For info, halcompile is a python program. So you could do a : $ python3 halcompile ...

May have something to do with linuxcnc being installed from apt..
Ah. If you have no dev version. You have to check your c: path for the spread around files. :blink:
That's why i suggested a lcnc install in opt/linuxcnc before. Andy is with me.
Last edit: 08 Jun 2021 15:59 by Grotius.

Please Log in or Create an account to join the conversation.

Time to create page: 0.092 seconds
Powered by Kunena Forum