Ethercat HAL driver

More
21 Feb 2018 20:11 #106285 by chimeno
Replied by chimeno on topic Ethercat HAL driver
Hello,
someone can help me, I have a doubt with this part of the file code, I think this serves for the home function, I do not understand its operation, I can not find any concrete example of how to connect it to the .hal file.

thanks
Chimeno

// update raw position counter
pos_cnt = EC_READ_S32(&pd[hal_data->pos_mot_pdo_os]);
pos_cnt_rel = pos_cnt - hal_data->home_raw;
*(hal_data->enc_raw) = pos_cnt;
*(hal_data->enc_raw_rel) = pos_cnt_rel;
*(hal_data->on_home_neg) = (pos_cnt_rel <= 0);
*(hal_data->on_home_pos) = (pos_cnt_rel >= 0);

pos_cnt <<= 8;
pos_cnt_diff = pos_cnt - hal_data->last_pos_cnt;
hal_data->last_pos_cnt = pos_cnt;
hal_data->pos_cnt += pos_cnt_diff;

rel_count = ((long long) pos_cnt_rel) << 8;

// check for index edge
if (*(hal_data->index_ena)) {
index_tmp = (hal_data->pos_cnt >> 32) & 0xffffffff;
if (hal_data->do_init || !hal_data->last_index_ena) {
hal_data->index_ref = index_tmp;
} else if (index_tmp > hal_data->index_ref) {
hal_data->index_cnt = (long long)index_tmp << 32;
*(hal_data->index_ena) = 0;
} else if (index_tmp < hal_data->index_ref) {
hal_data->index_cnt = (long long)hal_data->index_ref << 32;
*(hal_data->index_ena) = 0;
}
}
hal_data->last_index_ena = *(hal_data->index_ena);

// handle initialization
if (hal_data->do_init || *(hal_data->pos_reset)) {
hal_data->do_init = 0;
hal_data->index_cnt = hal_data->pos_cnt;
}

// compute net counts
net_count = hal_data->pos_cnt - hal_data->index_cnt;

// update raw counter pins
*(hal_data->pos_raw_hi) = (net_count >> 32) & 0xffffffff;
*(hal_data->pos_raw_lo) = net_count & 0xffffffff;

// scale count to make floating point position
*(hal_data->pos_fb) = ((double) net_count) * hal_data->pos_scale_cnt;
*(hal_data->pos_fb_rel) = ((double) rel_count) * hal_data->pos_scale_cnt;
Attachments:

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

More
28 Feb 2018 19:26 #106745 by chimeno
Replied by chimeno on topic Ethercat HAL driver

Hello,
someone can help me, I have a doubt with this part of the file code, I think this serves for the home function, I do not understand its operation, I can not find any concrete example of how to connect it to the .hal file.

thanks
Chimeno

// update raw position counter
pos_cnt = EC_READ_S32(&pd[hal_data->pos_mot_pdo_os]);
pos_cnt_rel = pos_cnt - hal_data->home_raw;
*(hal_data->enc_raw) = pos_cnt;
*(hal_data->enc_raw_rel) = pos_cnt_rel;
*(hal_data->on_home_neg) = (pos_cnt_rel <= 0);
*(hal_data->on_home_pos) = (pos_cnt_rel >= 0);

pos_cnt <<= 8;
pos_cnt_diff = pos_cnt - hal_data->last_pos_cnt;
hal_data->last_pos_cnt = pos_cnt;
hal_data->pos_cnt += pos_cnt_diff;

rel_count = ((long long) pos_cnt_rel) << 8;

// check for index edge
if (*(hal_data->index_ena)) {
index_tmp = (hal_data->pos_cnt >> 32) & 0xffffffff;
if (hal_data->do_init || !hal_data->last_index_ena) {
hal_data->index_ref = index_tmp;
} else if (index_tmp > hal_data->index_ref) {
hal_data->index_cnt = (long long)index_tmp << 32;
*(hal_data->index_ena) = 0;
} else if (index_tmp < hal_data->index_ref) {
hal_data->index_cnt = (long long)hal_data->index_ref << 32;
*(hal_data->index_ena) = 0;
}
}
hal_data->last_index_ena = *(hal_data->index_ena);

// handle initialization
if (hal_data->do_init || *(hal_data->pos_reset)) {
hal_data->do_init = 0;
hal_data->index_cnt = hal_data->pos_cnt;
}

// compute net counts
net_count = hal_data->pos_cnt - hal_data->index_cnt;

// update raw counter pins
*(hal_data->pos_raw_hi) = (net_count >> 32) & 0xffffffff;
*(hal_data->pos_raw_lo) = net_count & 0xffffffff;

// scale count to make floating point position
*(hal_data->pos_fb) = ((double) net_count) * hal_data->pos_scale_cnt;
*(hal_data->pos_fb_rel) = ((double) rel_count) * hal_data->pos_scale_cnt;




hello again, you can expand the scale, now I need to use the scale correctly.

regards
Chimeno
Attachments:

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

More
16 Mar 2018 06:36 #107412 by Automata27
Replied by Automata27 on topic Ethercat HAL driver
Hi,

i am using panasonic A6 drives with linuxcnc ethercat hal driver using lcec & lcec_ conf...currently i am facing issue of ethercat synch or dc ( distributed clocks) issue on my system...

details are posted at this ethercat synch & dc problem along with xml file and output waveform attached...

is anyone aware of such issue??

Thanks,
Regards.

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

More
20 Mar 2018 16:47 #107626 by ChrisB
Replied by ChrisB on topic Ethercat HAL driver
Hi
i have 5 Kollmorgen Servostar 300 and a ek1100 and 3 EL 2008 and 2 EL 1018.
My problem is, that the ethercat commandlinetool does not find the ek and the el moules.
When i just plug in the 5 servocontroller i find the 5 slaves.
The leds are flashing. When i plug in all in a row, no slave is found.
Could someone imagine what the problem is?
Thanks

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

More
20 Mar 2018 18:50 #107634 by ChrisB
Replied by ChrisB on topic Ethercat HAL driver
I found the solution.
I changed the sequence. I connected the servocontroller first and ek1100.
Now i can find all slaves.
But i dont understand the problem
Servocontroller use coe

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

More
20 Mar 2018 19:41 #107636 by chimeno
Replied by chimeno on topic Ethercat HAL driver
Hello ChrisB,
It may be that the secondary channel of the EK1100 is closed or for some reason or does not work well.
regards
Chimeno

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

More
27 Mar 2018 16:45 #107970 by sqmathlete
Replied by sqmathlete on topic Ethercat HAL driver
@Chris B

Just a thought...what type of cables are you using to chain the servo's and the EK1100 Bus Coupler? Patch or Crossover?

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

More
30 Mar 2018 09:33 - 30 Mar 2018 09:39 #108094 by ChrisB
Replied by ChrisB on topic Ethercat HAL driver
Hi
i use Patchcables.
Now i solved the problem more ore less. i changed the networkcard. i used the 8169 chip and now i use the 8193c with the 8139too kernel driver. I read that some people had problems with the 8169 chip.
Now the slaves are found by the cmd-ethercat-tool in any combination.

But up to now i am very close to get it running.
With a small sync problem oder config problem.
But i can't find the mistake.

When i start linuxcnc my kollmorgen S300 has an errror. F29 invalid ECAT actual-value mapping length
So it seems to be a problem with my xml config.
I attach my config and the output of the cmd tool and my hal and ini file. And the pdos output

And how can i config the dcsync?


The IO's work well
0 0:0 OP + EK1100 EtherCAT Coupler (2A E-Bus)
1 0:1 OP + EL1018 8Ch. Dig. Input 24V, 10�s
2 0:2 OP + EL1018 8Ch. Dig. Input 24V, 10�s
3 0:3 OP + EL1018 8Ch. Dig. Input 24V, 10�s
4 0:4 OP + EL2008 8Ch. Dig. Output 24V, 0.5A
5 0:5 OP + EL2008 8Ch. Dig. Output 24V, 0.5A
6 0:6 PREOP E S700 EtherCAT Drive (CoE)
Last edit: 30 Mar 2018 09:39 by ChrisB.

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

More
30 Mar 2018 10:49 #108099 by sirop
Replied by sirop on topic Ethercat HAL driver

Hi
i use Patchcables.


When i start linuxcnc my kollmorgen S300 has an errror. F29 invalid ECAT actual-value mapping length
So it seems to be a problem with my xml config.
I attach my config and the output of the cmd tool and my hal and ini file. And the pdos output

<pdoEntry idx="6040" subIdx="0" bitLen="16" halPin="Control_word" halType="bit"/>
and
<pdoEntry idx="6041" subIdx="0" bitLen="16" halPin="Status word" halType="bit"/>
So in both cases you map 16 bit pdoEntry to halType="bit" . Does this make sense?

I would use smth. like halType="u32" for control and status word, or if you need bitwise operation on control and status word,
then use halType="complex" as in github.com/sittner/linuxcnc-ethercat/blo...ercat-conf_X.xml#L98 .

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

More
30 Mar 2018 14:17 #108107 by sqmathlete
Replied by sqmathlete on topic Ethercat HAL driver
@ChrisB

I went through a similar issue a while back in this thread. My understanding is that if you see the slave in the PREOP state then you are able to communicate with the slave. I think that the problem is that you have not changed the amplifier control word (in hex) from
0x06 =>0x07=>0x0F,(in that order) i.e. you have not followed the 402 protocol to change the "state" to OP.
Try:
in xml file
define the control word

use halType="complex" as in github.com/sittner/linuxcnc-ethercat/blo...ercat-conf_X.xml#L98 .


define the status word as u32 or complex depending on what you want to do with it

in hal
halcmd setp SwitchOn 1
halcmd setp EnableVoltage 1
net quickstop QuickStop => connected to estop chain via classicladder
net enable enableop => some pin that you can control with classicladder or linuxcnc enable pin

If you look at Sittner's hal file, he does it a little differently but I think the amp should switch to the OP state either way.

Regards,
Dan
The following user(s) said Thank You: Nico2017

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

Time to create page: 0.187 seconds
Powered by Kunena Forum