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

More
5 years 5 months ago #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.

Please Log in to join the conversation.

More
5 years 5 months ago #208730 by Grotius
Hi Stormhold,

Can you attach the lcec_el3314.h file?

Please Log in to join the conversation.

More
5 years 5 months ago #208731 by Stormholt
Hello Grotius

here you go, thank you for looking into my problem.

Please Log in to join the conversation.

More
5 years 5 months ago #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

Attachment not found


2

Attachment not found


3

Attachment not found


4

Attachment not found



[edit]
Look at line 69.

Please Log in to join the conversation.

More
5 years 5 months ago #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 to join the conversation.

More
5 years 5 months ago #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 to join the conversation.

More
5 years 4 months ago #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

Please Log in to join the conversation.

More
5 years 4 months ago #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 to join the conversation.

Time to create page: 1.352 seconds
Powered by Kunena Forum