How: Add more (Beckhoff) devices to EtherCAT HAL driver?

More
13 May 2021 09:32 - 13 May 2021 11:37 #208718 by Stormholt
Hello i am having trouble with writing a driver for the EL3202 2 channel input terminal pt100.

I have both the el3202 and the el3314 physically and have created drivers for both of them, and the drivers are extremely identical. The el3314 works perfectly however not the el3202. The values I get from the value pdo entry corresponds to the full status. I don't understand how the device gets this value, as the driver is mapped according to the cstruct. Every half second the value changes from 0 to -32768. In Twincat the device works perfectly.

I am hoping someone might have an idea as to why the value reads from the wrong address.

I have attached the .c .h and cstruct of the el3202 and the .c of the el3314. as well as pictures of the hal results and the twincat. lcec.0.1 is the el3314 and lcec.0.2 is the el3202

Thank you in advance

EDIT:
Also if i provoke an error like removing a pin, the error LED lights up but does not indicate error in hal.
Last edit: 13 May 2021 11:37 by Stormholt. Reason: Addtional info

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

More
13 May 2021 12:40 #208730 by Grotius
Hi Stormhold,

Can you attach the lcec_el3314.h file?

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

More
13 May 2021 12:44 #208731 by Stormholt
Hello Grotius

here you go, thank you for looking into my problem.
Attachments:
The following user(s) said Thank You: Grotius

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

More
13 May 2021 13:16 - 13 May 2021 13:30 #208735 by Grotius
Hi Stormhold,There are no compile errors or warnings. Everything ok.If i compare the 2 files. I see at line 72 there is a diff. At 170 there is a diff.For the rest it looks good.
1

2

3

4


[edit]
Look at line 69.
Attachments:
Last edit: 13 May 2021 13:30 by Grotius.
The following user(s) said Thank You: Stormholt

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

More
17 May 2021 07:35 #209200 by Stormholt
Indeed line 69 is curious, however looking at both the cstruct of both devices and using Twincat the pdo entries are correct. Also i did try changing that and some other entries and it showed no results.

line 170 to 175 are some old test code that i thought i removed.

Are there any other tools useful in debugging ethercat devices ?

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

More
17 May 2021 11:36 #209214 by Grotius
Hi Stormhold,

You can write a driver following the ethercat source examples. The mini.c is a example that worked for me in the past.
If it works over there, you are one step ahead.

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

More
02 Jun 2021 14:10 - 03 Jun 2021 07:11 #210997 by Stormholt
I have identified the problem. however not the solution.

Whenever i use a device with 3xxx in its name, then devices after that in the stack will fail. So when i used both el3314 and el3202, the device with the highest slave address(furthest to the right in EK1100) will fail
Or if i have a stack like: EL2004, EL3004, EL1004, EL3314, EL3202, then every device after EL3004 will fail.
Using wireshark i can see that data from the failing device are not sent.
In linuxcnc, failing devices show weird values often depending on the first terminal in the stack. I suspect Ethercat, expecting x bytes from the failing device(s), will wrap-around reading from the next datagram resulting in mysterious values.

I cannot figure out the root of the problem, perhaps the drivers compromise each other.

any insight is appreciated

Edit: attached drivers for 3xxx devices
Last edit: 03 Jun 2021 07:11 by Stormholt. Reason: Device drivers

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

More
05 Jun 2021 14:41 #211217 by Grotius
Hi Stromhold,

What if we remove the "xxx"' in all the code, and just compile it with the correct driver names?
Did you already try this out?

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

Time to create page: 0.208 seconds
Powered by Kunena Forum