<div class="gmail_quote"><div>Hi Florian:<br><br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
On Tue, Jul 14, 2009 at 03:30:04PM +1200, Jason Xu wrote:<br>
> I've found EL5101 modules with the following serial numbers have this<br>
> problem:<br>
><br>
> Serial number: 27091510<br>
> Serial number: 20091510<br>
<br>
Ok, these are quite new. It seems to be a bug in the slave<br>
implementation. Just to be sure, please cross-check it with the newest<br>
master version available.<br>
<br>
<a href="http://etherlab.org/download/ethercat/ethercat-devel-r1812.tar.bz2" target="_blank">http://etherlab.org/download/ethercat/ethercat-devel-r1812.tar.bz2</a><br>
<br>
If it shows the same behaviour, please tell Beckhoff about this.<br>
<br>
BTW, you should probably be able to configure the slave with the 'old'<br>
PDO configuration from the former slave versions. The master will<br>
complain, because the PDO configuration will fail, but the process data<br>
should be exchanged. Have a try.<br>
</blockquote></div><br><br>Now, this problem has been worked around by modifying ethercat master code. <br><br>Just like you said that the pdo data in the module seems very wrong, and we cannot do anything about it. Therefore, we modified the master code in a place where the pdo entry is checked, and overwrite with the correct pdo data in there (if it is a EL5101 module). And this makes the module working as expected. <br>


<br>The modified function "ecrt_slave_config_reg_pdo_entry" of master/slave_config.c is added below.<br><br>int ecrt_slave_config_reg_pdo_entry(<br><div>        ec_slave_config_t *sc,<br>        uint16_t index,<br>

        uint8_t subindex,<br>        ec_domain_t *domain,<br>        unsigned int *bit_position<br>        )<br>{<br>    uint8_t sync_index;<br>
    const ec_sync_config_t *sync_config;<br>    unsigned int bit_offset, bit_pos;<br>    ec_pdo_t *pdo;<br>    ec_pdo_entry_t *entry;<br>    int sync_offset;<br>    int entry_count = 0 ;<br><br>    if (sc->master->debug_level)<br>


        EC_DBG("ecrt_slave_config_reg_pdo_entry(sc = 0x%x, index = 0x%04X, "<br>                "subindex = 0x%02X, domain = 0x%x, bit_position = 0x%x)\n",<br>                (u32) sc, index, subindex, (u32) domain, (u32) bit_position);<br>


<br>    for (sync_index = 0; sync_index < EC_MAX_SYNC_MANAGERS; sync_index++) {<br>        sync_config = &sc->sync_configs[sync_index];<br>        bit_offset = 0;<br><br>// ================= added =====================<br>


        if (sc->product_code == 0x13ED3052){<br>        list_for_each_entry(pdo, &sync_config->pdos.list, list) {<br>            list_for_each_entry(entry, &pdo->entries, list) {<br>                EC_DBG("debug 0x%08X",sc->product_code) ;<br>


                if (entry_count == 0) {<br>                    entry_count ++ ;<br>                    entry->index = 0x7000 ;<br>                    entry->subindex = 1 ;<br>                    entry->bit_length = 8 ;<br>


                }<br>                else if (entry_count == 1) {<br>                    entry_count ++ ;<br>                    entry->index = 0x7000 ;<br>                    entry->subindex = 2 ;<br>                    entry->bit_length = 16 ;<br>


                }<br>                else if (entry_count == 2) {<br>                    entry_count ++ ;<br>                    entry->index = 0x6000 ;<br>                    entry->subindex = 1 ;<br>                    entry->bit_length = 8 ;<br>


                }<br>                else if (entry_count == 3) {<br>                    entry_count ++ ;<br>                    entry->index = 0x6000 ;<br>                    entry->subindex = 2 ;<br>                    entry->bit_length = 16 ;<br>


                }<br>                else if (entry_count == 4) {<br>                    entry_count ++ ;<br>                    entry->index = 0x6000 ;<br>                    entry->subindex = 3 ;<br>                    entry->bit_length = 16 ;<br>


                }<br>            }<br>        }<br>        }<br>//  =================== end ======================<br>
<br>        list_for_each_entry(pdo, &sync_config->pdos.list, list) {<br>            list_for_each_entry(entry, &pdo->entries, list) {<br>                EC_DBG("entry_debug(index = 0x%04X, "<br>
                        "subindex = 0x%02X, bit_length = 0x%x)\n",<br>                       entry->index, entry->subindex,entry->bit_length );<br><br>                if (entry->index != index || entry->subindex != subindex) {<br>


                    bit_offset += entry->bit_length;<br>                } else {<br>                    bit_pos = bit_offset % 8;<br>                    if (bit_position) {<br>                        *bit_position = bit_pos;<br>


                    } else if (bit_pos) {<br>                        EC_ERR("PDO entry 0x%04X:%02X does not byte-align "<br>                                "in config %u:%u.\n", index, subindex,<br>                                sc->alias, sc->position);<br>


                        return -EFAULT;<br>                    }<br><br>                    sync_offset = ec_slave_config_prepare_fmmu(<br>                            sc, domain, sync_index, sync_config->dir);<br>                    if (sync_offset < 0)<br>


                        return sync_offset;<br><br>                    return sync_offset + bit_offset / 8;<br>                }<br>            }<br>        }<br>    }<br>    EC_ERR("PDO entry 0x%04X:%02X is not mapped in slave config %u:%u.\n",<br>


           index, subindex, sc->alias, sc->position);<br>    return -ENOENT;<br>}<br></div><br><br>If you think there is a better way to fix or work around this problem, we'd appreciate your advice. But, ultimately, our understanding is Beckhoff would need to change the firmware in future.<br>
<br>Thanks for all your help.<br><br>Jason Xu<br><br><br><br>