[etherlab-users] Problems with Pdo entry with index 0x0000
Jordi Blanch
jordi_blanch at encopim.com
Tue Nov 5 17:04:18 CET 2013
Hello Richard,
thank you very much for your answer. We will solve the issue as you
mention.
Best regards.
On Tue, 05 Nov 2013 16:36:26 +0100, Richard Hacker <ha at igh-essen.com>
wrote:
> Hello,
>
> I understand your problem when registering gaps. Actually the code in
> the ethercat master does not do the right thing by testing on index.
> Actually it should be testing for reg->bit_position instead. I will
> communicate this with the developer.
>
> Meanwhile you could use ecrt_domain_reg_pdo_entry() manually just as
> you find it in the master code in domain.c.
> ecrt_domain_reg_pdo_entry_list() is just a convenience function
> anyway. There is nothing secret about it.
>
> Richard
>
> Am 11/04/2013 06:40 PM, schrieb Thomas Bitsky Jr:
>> Here is an example of a working PDO definition that accounts for gaps for an EL3356 Strain Gauge Card. Note that index and sub-index are 0, but the length still has to be the correct value. Does this answer your question or am I missing a deeper issue you're experiencing?
>>
>> To get the right layout for complicated cards, I typically cheat and fire up TwinCAT in a virtual machine, insert the card into an offline project, then use the PDOs tab to determine the layout. I also use the Startup tab to see what I need to send the card on startup so that it's using the PDO layout I'm expecting.
>>
>> For example, for this card:
>>
>> //
>> // Register startup configuration for the hardware
>> //
>>
>> ecrt_slave_config_sdo8( sg->sc, 0x1C12, 0, 0 ); /* clear sm pdo 0x1c12 */
>> ecrt_slave_config_sdo8( sg->sc, 0x1C13, 0, 0 ); /* clear sm pdo 0x1c12 */
>>
>>
>> ecrt_slave_config_sdo16( sg->sc, 0x1C12, 1, 0x1600 ); /* download pdo 1C12 index */
>> ecrt_slave_config_sdo8( sg->sc, 0x1C12, 0, 1 ); /* set number of RxPDO */
>>
>> ecrt_slave_config_sdo16( sg->sc, 0x1C13, 1, 0x1A00 ); /* download pdo 1C13 index */
>>
>> #if 0
>> ecrt_slave_config_sdo16( sg->sc, 0x1C13, 2, 0x1A01 ); /* download pdo 1C13 index */
>> #endif
>> ecrt_slave_config_sdo16( sg->sc, 0x1C13, 2, 0x1A02 ); /* download pdo 1C13 index */
>>
>> ecrt_slave_config_sdo8( sg->sc, 0x1C13, 0, 2 ); /* set number of TxPDO */
>>
>>
>> Which yields the following PDO layout:
>>
>>
>> /* Master 0, Slave 3, "EL3356-0010"
>> * Vendor ID: 0x00000002
>> * Product code: 0x0d1c3052
>> * Revision number: 0x0014000a
>> */
>>
>> static ec_pdo_entry_info_t kl3356_pdo_entries[] = {
>> {0x7000, 0x01, 1}, /* Start calibration */
>> {0x7000, 0x02, 1}, /* Disable calibration */
>> {0x7000, 0x03, 1}, /* Input freeze */
>> {0x7000, 0x04, 1}, /* Sample mode */
>> {0x7000, 0x05, 1}, /* Tara */
>> {0x0000, 0x00, 11}, /* Gap */
>> {0x0000, 0x00, 1}, /* Gap */
>> {0x6000, 0x02, 1}, /* Overrange */
>> {0x0000, 0x00, 1}, /* Gap */
>> {0x6000, 0x04, 1}, /* Data invalid */
>> {0x0000, 0x00, 2}, /* Gap */
>> {0x6000, 0x07, 1}, /* Error */
>> {0x6000, 0x08, 1}, /* Calibration in progress */
>> {0x6000, 0x09, 1}, /* Steady state */
>> {0x0000, 0x00, 4}, /* Gap */
>> {0x1c32, 0x20, 1}, /* Sync error */
>> {0x0000, 0x00, 1}, /* Gap */
>> {0x1800, 0x09, 1},
>> #if 0
>> {0x6000, 0x11, 32}, /* Value */
>> #endif
>> {0x6000, 0x12, 32}, /* Real32 Value */
>>
>> };
>>
>> static ec_pdo_info_t kl3356_pdos[] = {
>> {0x1600, 6, kl3356_pdo_entries + 0}, /* RMB RxPDO-Map Control */
>> {0x1a00, 12, kl3356_pdo_entries + 6}, /* RMB TxPDO-Map Status */
>> #if 0
>> {0x1a01, 1, kl3356_pdo_entries + 18}, /* RMB TxPDO-Map Value (INT32) */
>> #endif
>> {0x1a02, 1, kl3356_pdo_entries + 18}, /* RMB TxPDO-Map Value (REAL32) */
>> };
>>
>> static ec_sync_info_t kl3356_syncs[] = {
>> {0, EC_DIR_OUTPUT, 0, NULL, EC_WD_DISABLE},
>> {1, EC_DIR_INPUT, 0, NULL, EC_WD_DISABLE},
>> {2, EC_DIR_OUTPUT, 1, kl3356_pdos + 0, EC_WD_DISABLE},
>> {3, EC_DIR_INPUT, 2, kl3356_pdos + 1, EC_WD_DISABLE},
>> {0xff}
>> };
>>
>>
>> Thanks!
>>
>> -----Original Message-----
>> From: etherlab-users-bounces at etherlab.org [mailto:etherlab-users-bounces at etherlab.org] On Behalf Of Jordi Blanch
>> Sent: Wednesday, October 30, 2013 9:37 AM
>> To: etherlab-users at etherlab.org
>> Subject: [etherlab-users] Problems with Pdo entry with index 0x0000
>>
>> Hello,
>>
>> I was trying to configure a Beckhoff module (EL3356-0010) for load cell, and part of the configuration XML I get is this:
>>
>> <RxPdo Sm="2" Fixed="1" Mandatory="1">
>> <Index>#x1600</Index>
>> <Name>RMB RxPDO-Map Control</Name> ....
>> <Entry>
>> <Index>#x7000</Index>
>> <SubIndex>5</SubIndex>
>> <BitLen>1</BitLen>
>> <Name></Name>
>> <DataType>BOOL</DataType>
>> </Entry>
>> <Entry>
>> <Index>#x0000</Index>
>> <BitLen>11</BitLen>
>> </Entry>
>> </RxPdo>
>> <TxPdo Sm="3" Fixed="1" Mandatory="1">
>> <Index>#x1a00</Index>
>> <Name>RMB TxPDO-Map Status</Name>
>> <Entry>
>> <Index>#x0000</Index>
>> <BitLen>1</BitLen>
>> </Entry>
>> <Entry>
>> <Index>#x6000</Index>
>> <SubIndex>2</SubIndex>
>> <BitLen>1</BitLen>
>> <Name></Name>
>> <DataType>BOOL</DataType>
>> </Entry>
>> <Entry>
>> <Index>#x0000</Index>
>> <BitLen>1</BitLen>
>> </Entry>
>> <Entry>
>> <Index>#x6000</Index>
>> <SubIndex>4</SubIndex>
>> <BitLen>1</BitLen>
>> <Name></Name>
>> <DataType>BOOL</DataType>
>> </Entry>
>> <Entry>
>> <Index>#x0000</Index>
>> <BitLen>2</BitLen>
>> </Entry>
>> <Entry>
>> <Index>#x6000</Index>
>> <SubIndex>7</SubIndex>
>> <BitLen>1</BitLen>
>> <Name></Name>
>> <DataType>BOOL</DataType>
>> </Entry>
>> ...
>>
>> As you can see there are several PDO-Entry with 0x0 index, they are simply GAPs in the data array.
>> The problem comes when I try to set the PDO's, master does not correctly calculate offsets because in the function ecrt_domain_reg_pdo_entry_list, the loop exit condition while going through the ec_pdo_entry_reg_t list is "reg-> index", so it stops the loop when it finds the first one of these GAPs, so NOT having gone through all the records.
>>
>> int ecrt_domain_reg_pdo_entry_list(ec_domain_t *domain,
>> const ec_pdo_entry_reg_t *regs) { ...
>> EC_MASTER_DBG(domain->master, 1,
>> "ecrt_domain_reg_pdo_entry_list("
>> "domain = 0x%p, regs = 0x%p)\n", domain, regs);
>>
>> for (reg = regs; reg->index; reg++) {
>> sc = ecrt_master_slave_config_err(domain->master, reg->alias,
>> reg->position, reg->vendor_id, reg->product_code); ...
>>
>> return 0;
>> }
>>
>> In my case, changing the GAP index to 0x1 works, but is this finish condition correct? How do you deal with these GAPs in the list?
>>
>> Thank you very much.
>>
>> --
>> Jordi Blanch Carles
>> Unidad de Ensayo y Control
>>
>> ENCOPIM S.L.
>> Carretera de Ripollet a Santiga, 104.
>> P.I. Els Pinetons
>> E-08291 RIPOLLET (Barcelona)
>> Tel: (+34) 935 94 23 47
>> Fax: (+34) 935 94 64 15
>>
>> ==========================================================
>> La información contenida en la presente transmisión es confidencial y su uso únicamente está permitido a su(s) destinatario(s). Si Ud. no es la persona destinataria de la presente transmisión, rogamos nos lo comunique de manera inmediata por teléfono (+34 935 942 347) y destruya cualquier copia de la misma (tanto digitales como en papel).
>>
>> The information contained in this transmission is confidential and is intended only for the use of the addressee(s). If you are not the designated recipient of this transmission, please advise us immediately by telephone (+34 935 942 347) and destroy any copies (digital and paper).
>> ======================================================
>>
>> _______________________________________________
>> etherlab-users mailing list
>> etherlab-users at etherlab.org
>> http://lists.etherlab.org/mailman/listinfo/etherlab-users
>> _______________________________________________
>> etherlab-users mailing list
>> etherlab-users at etherlab.org
>> http://lists.etherlab.org/mailman/listinfo/etherlab-users
>>
>
> Mit freundlichem Gruß
>
> Richard Hacker
>
> --
> ------------------------------------------------------------------------
>
> Richard Hacker M.Sc.
> richard.hacker at igh-essen.com
> Tel.: +49 201 / 36014-16
>
> Ingenieurgemeinschaft IgH
> Gesellschaft für Ingenieurleistungen mbH
> Heinz-Bäcker-Str. 34
> D-45356 Essen
>
> Amtsgericht Essen HRB 11500
> USt-Id.-Nr.: DE 174 626 722
> Geschäftsführung:
> - Dr.-Ing. T. Finke,
> - Dr.-Ing. W. Hagemeister
> Tel.: +49 201 / 360-14-0
> http://www.igh-essen.com
>
> ------------------------------------------------------------------------
>
> Mit freundlichem Gruß
>
> Richard Hacker
--
Jordi Blanch Carles
Unidad de Ensayo y Control
ENCOPIM S.L.
Carretera de Ripollet a Santiga, 104.
P.I. Els Pinetons
E-08291 RIPOLLET (Barcelona)
Tel: (+34) 935 94 23 47
Fax: (+34) 935 94 64 15
==========================================================
La información contenida en la presente transmisión es confidencial y
su uso únicamente está permitido a su(s) destinatario(s). Si Ud. no es
la persona destinataria de la presente transmisión, rogamos nos lo
comunique de manera inmediata por teléfono (+34 935 942 347) y destruya
cualquier copia de la misma (tanto digitales como en papel).
The information contained in this transmission is confidential and is
intended only for the use of the addressee(s). If you are not the
designated recipient of this transmission, please advise us immediately
by telephone (+34 935 942 347) and destroy any copies (digital and
paper).
======================================================
More information about the Etherlab-users
mailing list