Ethercat HAL driver
19 Feb 2021 16:40 - 20 Feb 2021 17:30 #199455
by jc2ktr
when you put it like that it makes a lot of sense
I snucked my hal configuration from multiple sources together, without fully understanding how it works.
I will adapt my hal config and let you know how it behaves then, could only get better from now on, have so many learned in the last days/weeks.
@db1981 after your mentioned Changes of the HAL-Config the Axis runs super smooth and noise free. Only one problem is still there. When i do a cyclic position loop like G1 F2000 X0 to G1 F2000 X100 with 20 repeats. after a short time The drive gets in Error state with F2037 Excessive position command difference, In TwinCAT is this no Problem since now.
Replied by jc2ktr on topic Ethercat HAL driver
okay....
lcec.read_all (reading from hardware) has to be the first addf line in the hal.
lcec.write_all (write to hardware) must be the last addf line in the hal.
when you put it like that it makes a lot of sense
I snucked my hal configuration from multiple sources together, without fully understanding how it works.
I will adapt my hal config and let you know how it behaves then, could only get better from now on, have so many learned in the last days/weeks.
@db1981 after your mentioned Changes of the HAL-Config the Axis runs super smooth and noise free. Only one problem is still there. When i do a cyclic position loop like G1 F2000 X0 to G1 F2000 X100 with 20 repeats. after a short time The drive gets in Error state with F2037 Excessive position command difference, In TwinCAT is this no Problem since now.
Last edit: 20 Feb 2021 17:30 by jc2ktr. Reason: Edit
Please Log in or Create an account to join the conversation.
22 Feb 2021 16:57 #199723
by bkt
Replied by bkt on topic Ethercat HAL driver
@db1981 It is el5151 00x0 twincat configurator see it as el5151 0000 0025 and I see there are 2 configuration "1600/1601 - 1A00/1A01" these seems ok ... but not see any value changing inside online tab on twincat configurator (I use twincat configurator because more easy than twincat3). On twincat configurator I can send el5151 in OP mode ... but in linuxcnc is anytime on PREOP when all other slaves is in OP mode.
There are any reasons? Is only because is not set the right xml or there are other reasons?
regards
There are any reasons? Is only because is not set the right xml or there are other reasons?
regards
Please Log in or Create an account to join the conversation.
22 Feb 2021 17:45 - 22 Feb 2021 17:46 #199735
by db1981
Replied by db1981 on topic Ethercat HAL driver
under the tab "process Data" , is an button "predefined PDO Assignment" there choose "standart 32 Bit" and run the configuration. this will change the pdo content of 1A00.
After this it should work with linuxcnc.
at the moment this is obiviously configured as "standart 16 Bit"...
After this it should work with linuxcnc.
at the moment this is obiviously configured as "standart 16 Bit"...
Last edit: 22 Feb 2021 17:46 by db1981.
Please Log in or Create an account to join the conversation.
22 Feb 2021 18:24 #199746
by db1981
Replied by db1981 on topic Ethercat HAL driver
@bkt
sorry forget it.
I've got the same proplem by testing now.
Beckhoff changed the Pdo configuration between firmware 0024 and 0025. This will not work at the moment.
I will discuss this with sascha tomorrow.
sorry forget it.
I've got the same proplem by testing now.
Beckhoff changed the Pdo configuration between firmware 0024 and 0025. This will not work at the moment.
I will discuss this with sascha tomorrow.
The following user(s) said Thank You: bkt
Please Log in or Create an account to join the conversation.
22 Feb 2021 18:36 #199748
by bkt
Replied by bkt on topic Ethercat HAL driver
Seems I'm a very lucky man. ....... Thanks for the advice and I hope in your or Chimeno help tomorrow.
Good Night
Good Night
Please Log in or Create an account to join the conversation.
22 Feb 2021 18:48 #199751
by db1981
Replied by db1981 on topic Ethercat HAL driver
the changes for this are only to edit 4 lines of codes, but then it is hardcoded for this revision of the card.
because of that this will not stay an single case in the future, we should implement an solution in lcec_conf for handling/detect this firmware rev. stuff.
because of that this will not stay an single case in the future, we should implement an solution in lcec_conf for handling/detect this firmware rev. stuff.
The following user(s) said Thank You: bkt
Please Log in or Create an account to join the conversation.
23 Feb 2021 07:38 - 23 Feb 2021 08:03 #199801
by bkt
does this mean that you will need to create an xml file specifically for the el5151 element? Or more clean solution is write a new custom driver called el5151_25 and use it on my xml instead the old one?
P.S.: I launch these command: ethercat xml -p6 (my el5151) and obtain these xml
The problem is ethercat-xml see SubIdx=20 and SubIdx=17 as UINT32 but on ethrcat-pdos command these SubIdx seems nr.11 and 14? is these the problem? Different number of SubIdx detected or stored?
If I read lcec_el5151.c I see these part:
That is the same thart i see on ethercet configurator .... same idx, same pin, same data type .... so seems lcec_el5151.c was ok .... but these part is no understand from my side, so not understand if work or not for me:
I appreciate some little expalanation so maybe I have some ideas about.
regards
bkt
Replied by bkt on topic Ethercat HAL driver
but then it is hardcoded for this revision of the card.
does this mean that you will need to create an xml file specifically for the el5151 element? Or more clean solution is write a new custom driver called el5151_25 and use it on my xml instead the old one?
P.S.: I launch these command: ethercat xml -p6 (my el5151) and obtain these xml
Warning: Spoiler!
<?xml version="1.0" ?>
<EtherCATInfo>
<!-- Slave 6 -->
<Vendor>
<Id>2</Id>
</Vendor>
<Descriptions>
<Devices>
<Device>
<Type ProductCode="#x141f3052" RevisionNo="#x00190000">EL5151</Type>
<Name><![CDATA[EL5151 1K. Inc. Encoder]]></Name>
<Sm Enable="1" StartAddress="#x1000" ControlByte="#x26" DefaultSize="128" />
<Sm Enable="1" StartAddress="#x1080" ControlByte="#x22" DefaultSize="128" />
<Sm Enable="1" StartAddress="#x1100" ControlByte="#x24" DefaultSize="6" />
<Sm Enable="1" StartAddress="#x1180" ControlByte="#x20" DefaultSize="14" />
<RxPdo Sm="2" Fixed="1" Mandatory="1">
<Index>#x1600</Index>
<Name></Name>
<Entry>
<Index>#x7000</Index>
<SubIndex>1</SubIndex>
<BitLen>1</BitLen>
<Name></Name>
<DataType>BOOL</DataType>
</Entry>
<Entry>
<Index>#x7000</Index>
<SubIndex>2</SubIndex>
<BitLen>1</BitLen>
<Name></Name>
<DataType>BOOL</DataType>
</Entry>
<Entry>
<Index>#x7000</Index>
<SubIndex>3</SubIndex>
<BitLen>1</BitLen>
<Name></Name>
<DataType>BOOL</DataType>
</Entry>
<Entry>
<Index>#x7000</Index>
<SubIndex>4</SubIndex>
<BitLen>1</BitLen>
<Name></Name>
<DataType>BOOL</DataType>
</Entry>
<Entry>
<Index>#x0000</Index>
<BitLen>4</BitLen>
</Entry>
<Entry>
<Index>#x0000</Index>
<BitLen>8</BitLen>
</Entry>
<Entry>
<Index>#x7000</Index>
<SubIndex>17</SubIndex>
<BitLen>32</BitLen>
<Name></Name>
<DataType>UINT32</DataType>
</Entry>
</RxPdo>
<TxPdo Sm="3" Fixed="1" Mandatory="1">
<Index>#x1a00</Index>
<Name></Name>
<Entry>
<Index>#x6000</Index>
<SubIndex>1</SubIndex>
<BitLen>1</BitLen>
<Name></Name>
<DataType>BOOL</DataType>
</Entry>
<Entry>
<Index>#x6000</Index>
<SubIndex>2</SubIndex>
<BitLen>1</BitLen>
<Name></Name>
<DataType>BOOL</DataType>
</Entry>
<Entry>
<Index>#x6000</Index>
<SubIndex>3</SubIndex>
<BitLen>1</BitLen>
<Name></Name>
<DataType>BOOL</DataType>
</Entry>
<Entry>
<Index>#x0000</Index>
<BitLen>4</BitLen>
</Entry>
<Entry>
<Index>#x6000</Index>
<SubIndex>8</SubIndex>
<BitLen>1</BitLen>
<Name></Name>
<DataType>BOOL</DataType>
</Entry>
<Entry>
<Index>#x6000</Index>
<SubIndex>9</SubIndex>
<BitLen>1</BitLen>
<Name></Name>
<DataType>BOOL</DataType>
</Entry>
<Entry>
<Index>#x6000</Index>
<SubIndex>10</SubIndex>
<BitLen>1</BitLen>
<Name></Name>
<DataType>BOOL</DataType>
</Entry>
<Entry>
<Index>#x6000</Index>
<SubIndex>11</SubIndex>
<BitLen>1</BitLen>
<Name></Name>
<DataType>BOOL</DataType>
</Entry>
<Entry>
<Index>#x0000</Index>
<BitLen>1</BitLen>
</Entry>
<Entry>
<Index>#x6000</Index>
<SubIndex>13</SubIndex>
<BitLen>1</BitLen>
<Name></Name>
<DataType>BOOL</DataType>
</Entry>
<Entry>
<Index>#x6000</Index>
<SubIndex>14</SubIndex>
<BitLen>1</BitLen>
<Name></Name>
<DataType>BOOL</DataType>
</Entry>
<Entry>
<Index>#x0000</Index>
<BitLen>1</BitLen>
</Entry>
<Entry>
<Index>#x6000</Index>
<SubIndex>16</SubIndex>
<BitLen>1</BitLen>
<Name></Name>
<DataType>BOOL</DataType>
</Entry>
<Entry>
<Index>#x6000</Index>
<SubIndex>17</SubIndex>
<BitLen>32</BitLen>
<Name></Name>
<DataType>UINT32</DataType>
</Entry>
<Entry>
<Index>#x6000</Index>
<SubIndex>18</SubIndex>
<BitLen>32</BitLen>
<Name></Name>
<DataType>UINT32</DataType>
</Entry>
</TxPdo>
<TxPdo Sm="3" Fixed="1" Mandatory="1">
<Index>#x1a02</Index>
<Name></Name>
<Entry>
<Index>#x6000</Index>
<SubIndex>20</SubIndex>
<BitLen>32</BitLen>
<Name></Name>
<DataType>UINT32</DataType>
</Entry>
</TxPdo>
</Device>
</Devices>
</Descriptions>
</EtherCATInfo>
The problem is ethercat-xml see SubIdx=20 and SubIdx=17 as UINT32 but on ethrcat-pdos command these SubIdx seems nr.11 and 14? is these the problem? Different number of SubIdx detected or stored?
If I read lcec_el5151.c I see these part:
Warning: Spoiler!
static ec_pdo_entry_info_t lcec_el5151_in[] = {
{0x6000, 0x01, 1}, // Latch C valid
{0x6000, 0x02, 1}, // Latch extern valid
{0x6000, 0x03, 1}, // Set counter done
{0x0000, 0x00, 4}, // Gap
{0x6000, 0x08, 1}, // Extrapolation stall
{0x6000, 0x09, 1}, // Status of input A
{0x6000, 0x0a, 1}, // Status of input B
{0x6000, 0x0b, 1}, // Status of input C
{0x0000, 0x00, 1}, // Gap
{0x6000, 0x0d, 1}, // Status of extern latch
{0x1c32, 0x20, 1}, // Sync error
{0x0000, 0x00, 1}, // Gap
{0x1800, 0x09, 1}, // TxPDO Toggle
{0x6000, 0x11, 32}, // Counter value
{0x6000, 0x12, 32} // Latch value
};
static ec_pdo_entry_info_t lcec_el5151_period[] = {
{0x6000, 0x14, 32} // Period value
};
static ec_pdo_entry_info_t lcec_el5151_out[] = {
{0x7000, 0x01, 1}, // Enable latch C
{0x7000, 0x02, 1}, // Enable latch extern on positive edge
{0x7000, 0x03, 1}, // Set counter
{0x7000, 0x04, 1}, // Enable latch extern on negative edge
{0x0000, 0x00, 4}, // Gap
{0x0000, 0x00, 8}, // Gap
{0x7000, 0x11, 32} // Set counter value
};
static ec_pdo_info_t lcec_el5151_pdos_out[] = {
{0x1600, 7, lcec_el5151_out}
};
static ec_pdo_info_t lcec_el5151_pdos_in[] = {
{0x1A00, 15, lcec_el5151_in},
{0x1A02, 1, lcec_el5151_period}
};
That is the same thart i see on ethercet configurator .... same idx, same pin, same data type .... so seems lcec_el5151.c was ok .... but these part is no understand from my side, so not understand if work or not for me:
Warning: Spoiler!
// initialize POD entries
LCEC_PDO_INIT(pdo_entry_regs, slave->index, slave->vid, slave->pid, 0x6000, 0x01, &hal_data->latch_c_valid_pdo_os, &hal_data->latch_c_valid_pdo_bp);
LCEC_PDO_INIT(pdo_entry_regs, slave->index, slave->vid, slave->pid, 0x6000, 0x02, &hal_data->latch_ext_valid_pdo_os, &hal_data->latch_ext_valid_pdo_bp);
LCEC_PDO_INIT(pdo_entry_regs, slave->index, slave->vid, slave->pid, 0x6000, 0x03, &hal_data->set_count_done_pdo_os, &hal_data->set_count_done_pdo_bp);
LCEC_PDO_INIT(pdo_entry_regs, slave->index, slave->vid, slave->pid, 0x6000, 0x08, &hal_data->expol_stall_pdo_os, &hal_data->expol_stall_pdo_bp);
LCEC_PDO_INIT(pdo_entry_regs, slave->index, slave->vid, slave->pid, 0x6000, 0x09, &hal_data->ina_pdo_os, &hal_data->ina_pdo_bp);
LCEC_PDO_INIT(pdo_entry_regs, slave->index, slave->vid, slave->pid, 0x6000, 0x0a, &hal_data->inb_pdo_os, &hal_data->inb_pdo_bp);
LCEC_PDO_INIT(pdo_entry_regs, slave->index, slave->vid, slave->pid, 0x6000, 0x0b, &hal_data->inc_pdo_os, &hal_data->inc_pdo_bp);
LCEC_PDO_INIT(pdo_entry_regs, slave->index, slave->vid, slave->pid, 0x6000, 0x0d, &hal_data->inext_pdo_os, &hal_data->inext_pdo_bp);
LCEC_PDO_INIT(pdo_entry_regs, slave->index, slave->vid, slave->pid, 0x1c32, 0x20, &hal_data->sync_err_pdo_os, &hal_data->sync_err_pdo_bp);
LCEC_PDO_INIT(pdo_entry_regs, slave->index, slave->vid, slave->pid, 0x1800, 0x09, &hal_data->tx_toggle_pdo_os, &hal_data->tx_toggle_pdo_bp);
LCEC_PDO_INIT(pdo_entry_regs, slave->index, slave->vid, slave->pid, 0x6000, 0x11, &hal_data->count_pdo_os, NULL);
LCEC_PDO_INIT(pdo_entry_regs, slave->index, slave->vid, slave->pid, 0x6000, 0x12, &hal_data->latch_pdo_os, NULL);
LCEC_PDO_INIT(pdo_entry_regs, slave->index, slave->vid, slave->pid, 0x6000, 0x14, &hal_data->period_pdo_os, NULL);
LCEC_PDO_INIT(pdo_entry_regs, slave->index, slave->vid, slave->pid, 0x7000, 0x01, &hal_data->ena_latch_c_pdo_os, &hal_data->ena_latch_c_pdo_bp);
LCEC_PDO_INIT(pdo_entry_regs, slave->index, slave->vid, slave->pid, 0x7000, 0x02, &hal_data->ena_latch_ext_pos_pdo_os, &hal_data->ena_latch_ext_pos_pdo_bp);
LCEC_PDO_INIT(pdo_entry_regs, slave->index, slave->vid, slave->pid, 0x7000, 0x03, &hal_data->set_count_pdo_os, &hal_data->set_count_pdo_bp);
LCEC_PDO_INIT(pdo_entry_regs, slave->index, slave->vid, slave->pid, 0x7000, 0x04, &hal_data->ena_latch_ext_neg_pdo_os, &hal_data->ena_latch_ext_neg_pdo_bp);
LCEC_PDO_INIT(pdo_entry_regs, slave->index, slave->vid, slave->pid, 0x7000, 0x11, &hal_data->set_count_val_pdo_os, NULL);
I appreciate some little expalanation so maybe I have some ideas about.
regards
bkt
Last edit: 23 Feb 2021 08:03 by bkt.
Please Log in or Create an account to join the conversation.
23 Feb 2021 09:13 #199804
by db1981
Replied by db1981 on topic Ethercat HAL driver
the custom driver for the el5151 needs to be modified. It has to check for the revision of the card and then use the corespondending pdo mapping.
If you look at this:
and here:
beckhoff changed :
0x1c32, 0x20 to 0x6000 , 0x0E and
0x1800, 0x09 to 0x6000 , 0x10
sizes are the same...
so if you are firm with this, you can change these 4 lines, compile and test it.
If you look at this:
static ec_pdo_entry_info_t lcec_el5151_in[] = {
{0x6000, 0x01, 1}, // Latch C valid
{0x6000, 0x02, 1}, // Latch extern valid
{0x6000, 0x03, 1}, // Set counter done
{0x0000, 0x00, 4}, // Gap
{0x6000, 0x08, 1}, // Extrapolation stall
{0x6000, 0x09, 1}, // Status of input A
{0x6000, 0x0a, 1}, // Status of input B
{0x6000, 0x0b, 1}, // Status of input C
{0x0000, 0x00, 1}, // Gap
{0x6000, 0x0d, 1}, // Status of extern latch
!!!{0x1c32, 0x20, 1}, // Sync error
{0x0000, 0x00, 1}, // Gap
!!!{0x1800, 0x09, 1}, // TxPDO Toggle
{0x6000, 0x11, 32}, // Counter value
{0x6000, 0x12, 32} // Latch value
};
and here:
LCEC_PDO_INIT(pdo_entry_regs, slave->index, slave->vid, slave->pid,!!! 0x1c32, 0x20!!!, &hal_data->sync_err_pdo_os, &hal_data->sync_err_pdo_bp);
LCEC_PDO_INIT(pdo_entry_regs, slave->index, slave->vid, slave->pid,!!! 0x1800, 0x09!!!, &hal_data->tx_toggle_pdo_os, &hal_data->tx_toggle_pdo_bp);
beckhoff changed :
0x1c32, 0x20 to 0x6000 , 0x0E and
0x1800, 0x09 to 0x6000 , 0x10
sizes are the same...
so if you are firm with this, you can change these 4 lines, compile and test it.
The following user(s) said Thank You: bkt
Please Log in or Create an account to join the conversation.
23 Feb 2021 12:08 #199815
by bkt
I'm not very ... but I don't see any other chances for my incremental encoder .... is there any?
Replied by bkt on topic Ethercat HAL driver
so if you are firm with this, you can change these 4 lines, compile and test it.
I'm not very ... but I don't see any other chances for my incremental encoder .... is there any?
Please Log in or Create an account to join the conversation.
23 Feb 2021 12:34 #199820
by db1981
Replied by db1981 on topic Ethercat HAL driver
ok, then i will prepare this ...
-which linuxcnc version ?
-debian?
-RIP version oder installed linuxcnc?
-which linuxcnc version ?
-debian?
-RIP version oder installed linuxcnc?
Please Log in or Create an account to join the conversation.
Time to create page: 0.227 seconds