Getting BK1120 (EtherCAT to Kbus) coupler operational

More
10 Apr 2022 12:05 #239817 by GuiHue
Dear all,

with the help of all the documented findings in this board, I was able to quite quickly get a basic EtherCAT config on Deb10 with linuxcnc master working. Thank you!

Now for something that still eludes me: I have a number of KL components (specifically the quite expensive encoders) and a BK1120 EtherCAT to KBus coupler. I would love to get that to work.

My current status:

I have three tests setups:
1) EK1100+EL2008
2) BK1120 with KL2022+KL9010
3) EK1100+EL2008 and BK110 with KL2022+KL9010

Deb10 with linuxcnc-ethercat (sittner) and linuxcnc master is working fine. I even added some components from another repo to lcec.

When I hook up EK1100+EL2008  (System 1) to the master, "ethercat slaves" shows them both. With a simple config (based on sim.axis axis.ini) and a short ethercat-conf.xml I get those to work and can control them through hal.

When I hook up System 2 (or System 3, I will focus on 2) things become complicated:
In TwinCat3 I can scan the EtherCAT Bus, set it to free run and interact with the components (i.e. toggle the outputs on KL2022).
On the linxucnc system for test system 2 and 3 I cannot reach OP state with BK1120. 

"ethercat pdos" on System 2  returns nothing 
"ethercat sdos" on System 2  returns the following:
Warning: Spoiler!


A simple linuxcnc setup with the following added to the hal of the standard sim.axis/axis.ini
loadusr -W lcec_conf ethercat-conf.xml
loadrt lcec
addf lcec.read-all servo-thread
addf lcec.write-all servo.thread
is able to start system 3 just fine. While it starts the following is sent to DMESG:
Warning: Spoiler!


Used ethercat-conf.xml is attached to this post.

TwinCAT3 Export of the system 2 (BK1120 only) is attached as well.

Now the points that elude me at this time:
Why does bk1120 not respond to "ethercat pdos"?
What further information to I need to add to the generic component in ethercat-conf.xml? I assume it needs some sort of init features but I don't understand which/how/where to find them?

Any help is greatly appreciated! Also, help pointing me to documentation on the finer details of setting up a complex component using linuxcnc-ethercat. I have not found much on that topic.
 
Attachments:

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

More
10 Apr 2022 13:50 #239823 by db1981
i will try to explain. I hope this will be "human" readable my native language is c ....

Why does bk1120 not respond to "ethercat pdos"?

this is related to :

[  +0.031169] EtherCAT WARNING 0-2: PDOs configured for SM2, but slave does not provide the sync manager information!


This slave does not contain the neccesary register information in its SII Eeprom that is needed by Etherlabmaster to configure the card.
I am not shure why, this is the first "Beckhoff" Device i got noticed off. 
This tells us that the SII Eeprom is empty/faulty or not completly written.

Etherlabmaster instead of other Masters like Twincat, Soem etc. is at the moment not capable to do an "blind" configuring of the slaves. In Etherlabmaster all basic setup is related to the content of the SII Eeprom. The commandline tools like pdos are only related to the initial readout of the eeprom at connect or startup from the master.  If you have an Device that changes its pdo configuration for example after sdo startup commands, "ethercat pdos" will still display the "wrong" initial readout of the eeprom. Because there is actually no way to do an "ethercat rescan" after the threat from lcec has been started. 

there are a two options:

 
-connect all your devices to your Twincat project an rewrite the EEprom from the card.

-recompile your etherlabmaster and load the SII Content for this card from file at startup, instead of readout. I have explained this 2-3 times search for "enable-sii-overwrite" in this forum.
 
The following user(s) said Thank You: GuiHue

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

More
10 Apr 2022 15:02 #239828 by GuiHue
Once again, thank for trying to explain that to mere mortals. The explanaition makes sense to me.

Option 1: I guess I understand the idea, but I'm not sure how to go about it.
Is this the approach described here: etherlab.org/en/ethercat/faq.php#incomplete-sii

Between now and my original post, I have come across a few old post on an etherlab mailing list (>10 years) that seem to relate to the same issue.Unfortunately, they were never resolved (i.e. a solution - if found - was never posted to the list).

In the meantime, using twincat3 i played around a bit: In BK1120 tree > EtherCAT > Advanced Settings > ESC > e2PROM I was able to write e2PROM to achieve a higher product revision. Ever since, BK1120 responds to pdos by answering:
Warning: Spoiler!

Following your explanaition, I consider this to be  a first win. Also, BK1120 actually identifies as such in ethercat slaves list.

Next I tried to setup the system in TwinCAT3 (BK1120+2KL2022:
Again going EtherCAT (on Submenu of BK1120) > Advanced ... Hex Editor
Upload
Save to file (I got a binary)
Next, using the command in the link above:
ethercat sii_write -p0 file.bin
This leads me to the above response of pdos again.

I guess I am still missing something.

Output of dmesg while starting linuxcnc:
Warning: Spoiler!


using this xml (essentially empty of pdos):
Warning: Spoiler!


Option 2 hasn't revealed any hits yet. I guess i need to vary the search. From what I found on other boards: I still need that correct sii image: not sure how just yet.

 

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

More
10 Apr 2022 16:36 #239831 by db1981
i don't think that the "ethercat pdos" command will ever work with this card....
The pdos configuration is created at power on, when the coupler reads out the attached bus cards. You can try to power on the devices, and connect the ethercat cable after a few seconds. Maybe this will return an pdo information, or try ethercat "rescan or reboot" a few seconds after power on.

Important is that the master now has read out addresses for the syncmanagers.
You now have to map all pdos or use gaps to get the right byte order.
This has to include the pdos "coupler state" , "coupler control" and the 14 Bit "align" for SM2/3 in the order them are listed in your export xml file.
<slave idx="2" type="generic" name="BK1120" vid="00000002" pid="04602c22" configPdos="true">
<syncManager idx="0" dir="out"> </syncManager>
<syncManager idx="1" dir="in"> </syncManager>
<syncManager idx="2" dir="out">
  <pdo idx="16ff">
    <pdoEntry idx="f200" subIdx="01" bitLen="16" halPin="coupler_control" halType="u32"/>
  </pdo>
  <pdo idx="1600">
    <pdoEntry idx="6000" subIdx="01" bitLen="1" halPin="Out_220_01" halType="bit"/>
    <pdoEntry idx="6000" subIdx="02" bitLen="1" halPin="Out_220_02" halType="bit"/>
  </pdo>
  <pdo idx="1701">
    <pdoEntry idx="00" subIdx="00" bitLen="14"/>
  </pdo>
</syncManager>
<syncManager idx="3" dir="in">
  <pdo idx="1aff">
    <pdoEntry idx="f100" subIdx="01" bitLen="16" halPin="coupler_status" halType="u32"/>
  </pdo>
</syncManager>
</slave>

What happens if your start your config with the ethercat xml from the first post ?
The following user(s) said Thank You: GuiHue

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

More
10 Apr 2022 21:11 #239858 by GuiHue
Thanks again!

I tried to go through your questions one by one:

1) rescan/ network after power on: no effect. Your  right with the pdos statement.

3) What happens with the xml from the first post?
Linuxcnc starts, dmesg reports as follows:
Warning: Spoiler!


3) Your xml:
Linuxcnc starts fine
ethercat becomes quite chatty in dmesg:
Warning: Spoiler!


BK1120 goes into OP!
I can set either of the two pins using halcmd setp (and the effect applies to the real world as well) Awesome!

However, there are further questions:
With regard  to pages 69 and 70 of: download.beckhoff.com/download/Document/.../BK11x0_BK1250en.pdf
I had expected the indexes to be 7000 instead of 6000 as KL2022 is an output.
Changing the index accordingly seems to work just fine. How is this possible?

I had been puzzled as to how you arrived at the indexes you have used. I then looked into the twincat export and all pieces came together.
The relevant entries are the TxPdo and RxPdo parts in their specific order and relating to SM0-SM3. Dang - now it's easy.

Wow - thanks to your input I can now soldier on. I'll have to have  alook and some of the error messages (see dump above) but things seems to work.
XML for a single KL5101 encoder on the kbus:
Warning: Spoiler!


Excerpt of relevant TC3 Dump:
Warning: Spoiler!


Very happy for know - mor eto be tested at the end of the week.

Thanks again!

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

More
11 Apr 2022 13:39 #239922 by db1981

However, there are further questions:
With regard  to pages 69 and 70 of: download.beckhoff.com/download/Document/.../BK11x0_BK1250en.pdf
I had expected the indexes to be 7000 instead of 6000 as KL2022 is an output.
Changing the index accordingly seems to work just fine. How is this possible?


KL2022 is an output device, but an ethercat input from your BK1120 Coupler

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

More
11 Apr 2022 13:44 #239923 by db1981
hmm, not all documentation is error free....
The following user(s) said Thank You: GuiHue

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

Time to create page: 5.018 seconds
Powered by Kunena Forum