[etherlab-users] Beckhoff EL2809 (16 digital outputs) initialization issue

BUSSIERES Vincent vincent.bussieres at hemeria-group.com
Wed Apr 22 22:49:57 CEST 2020


Dear Etherlab users,

I am working with a Beckhoff EL2809 module (16 digital outputs module) and I have some difficulties to register pdo entries.
I think that for this module pdo are not assignable.

You can find some informations about this product below :

=== Master 0, Slave 3 ===
Device: Main
State: PREOP
Flag: +
Identity:
  Vendor Id:       0x00000002
  Product code:    0x0af93052
  Revision number: 0x00120000
  Serial number:   0x00000000
DL information:
  FMMU bit operation: no
  Distributed clocks: yes, delay measurement only
  DC system time transmission delay: 885 ns
Port  Type  Link  Loop    Signal  NextSlave  RxTime [ns]  Diff [ns]   NextDc [ns]
   0* EBUS  up    open    yes             2   2053620480           0         145
   1  EBUS  up    open    yes             4   2053621070         590         140
   2  N/A   down  closed  no              -            -           -           -
   3  N/C   down  closed  no              -            -           -           -
General:
  Group: DigOut
  Image name:
  Order number: EL2809
  Device name: EL2809 16K. Dig. Ausgang 24V, 0.5A
  Flags:
    Enable SafeOp: no
    Enable notLRW: no
  Current consumption: 140 mA

SM0: PhysAddr 0x0f00, DefaultSize    1, ControlRegister 0x44, Enable 9
  RxPDO 0x1600 "Channel 1"
    PDO entry 0x7000:01,  1 bit, "Output"
  RxPDO 0x1601 "Channel 2"
    PDO entry 0x7010:01,  1 bit, "Output"
  RxPDO 0x1602 "Channel 3"
    PDO entry 0x7020:01,  1 bit, "Output"
  RxPDO 0x1603 "Channel 4"
    PDO entry 0x7030:01,  1 bit, "Output"
  RxPDO 0x1604 "Channel 5"
    PDO entry 0x7040:01,  1 bit, "Output"
  RxPDO 0x1605 "Channel 6"
    PDO entry 0x7050:01,  1 bit, "Output"
  RxPDO 0x1606 "Channel 7"
    PDO entry 0x7060:01,  1 bit, "Output"
  RxPDO 0x1607 "Channel 8"
    PDO entry 0x7070:01,  1 bit, "Output"
SM1: PhysAddr 0x0f01, DefaultSize    1, ControlRegister 0x44, Enable 9
  RxPDO 0x1608 "Channel 9"
    PDO entry 0x7080:01,  1 bit, "Output"
  RxPDO 0x1609 "Channel 10"
    PDO entry 0x7090:01,  1 bit, "Output"
  RxPDO 0x160a "Channel 11"
    PDO entry 0x70a0:01,  1 bit, "Output"
  RxPDO 0x160b "Channel 12"
    PDO entry 0x70b0:01,  1 bit, "Output"
  RxPDO 0x160c "Channel 13"
    PDO entry 0x70c0:01,  1 bit, "Output"
  RxPDO 0x160d "Channel 14"
    PDO entry 0x70d0:01,  1 bit, "Output"
  RxPDO 0x160e "Channel 15"
    PDO entry 0x70e0:01,  1 bit, "Output"
  RxPDO 0x160f "Channel 16"
    PDO entry 0x70f0:01,  1 bit, "Output"

I don't know if I need to map PDOs because they are already mapped.
At the initialization, « ecrt_domain_reg_pdo_entry_list » return error -14. You can find below a part of my code for the initialization.
Moreover, each output is written on 1 bit, we can only write PDO with macro EC_WRITE_U8, how can I do to drive only one output ?

static unsigned int offOutput[16];
static ec_domain_state_t domain1_state = {};
static ec_master_state_t master_state = {};

const static ec_pdo_entry_reg_t domain1_regs[] = {
    {0, 3, 0x00000002, 0x0af93052, 0x7000, 1, &offOutput[0]},
    {0, 3, 0x00000002, 0x0af93052, 0x7010, 1, &offOutput[1]},
    {0, 3, 0x00000002, 0x0af93052, 0x7020, 1, &offOutput[2]},
    {0, 3, 0x00000002, 0x0af93052, 0x7030, 1, &offOutput[3]},
    {0, 3, 0x00000002, 0x0af93052, 0x7040, 1, &offOutput[4]},
    {0, 3, 0x00000002, 0x0af93052, 0x7050, 1, &offOutput[5]},
    {0, 3, 0x00000002, 0x0af93052, 0x7060, 1, &offOutput[6]},
    {0, 3, 0x00000002, 0x0af93052, 0x7070, 1, &offOutput[7]},
    {0, 3, 0x00000002, 0x0af93052, 0x7080, 1, &offOutput[8]},
    {0, 3, 0x00000002, 0x0af93052, 0x7090, 1, &offOutput[9]},
    {0, 3, 0x00000002, 0x0af93052, 0x70a0, 1, &offOutput[10]},
    {0, 3, 0x00000002, 0x0af93052, 0x70b0, 1, &offOutput[11]},
    {0, 3, 0x00000002, 0x0af93052, 0x70c0, 1, &offOutput[12]},
    {0, 3, 0x00000002, 0x0af93052, 0x70d0, 1, &offOutput[13]},
    {0, 3, 0x00000002, 0x0af93052, 0x70e0, 1, &offOutput[14]},
    {0, 3, 0x00000002, 0x0af93052, 0x70f0, 1, &offOutput[15]},
    {}
};

ec_pdo_entry_info_t slave_0_pdo_entries[] = {
    {0x7000, 0x01, 1},
    {0x7010, 0x01, 1},
    {0x7020, 0x01, 1},
    {0x7030, 0x01, 1},
    {0x7040, 0x01, 1},
    {0x7050, 0x01, 1},
    {0x7060, 0x01, 1},
    {0x7070, 0x01, 1},

    {0x7080, 0x01, 1},
    {0x7090, 0x01, 1},
    {0x70a0, 0x01, 1},
    {0x70b0, 0x01, 1},
    {0x70c0, 0x01, 1},
    {0x70d0, 0x01, 1},
    {0x70e0, 0x01, 1},
    {0x70f0, 0x01, 1},
};

ec_pdo_info_t slave_0_pdos[] = {
    {0x1600, 1, &slave_0_pdo_entries[0]},
    {0x1601, 1, &slave_0_pdo_entries[1]},
    {0x1602, 1, &slave_0_pdo_entries[2]},
    {0x1603, 1, &slave_0_pdo_entries[3]},
    {0x1604, 1, &slave_0_pdo_entries[4]},
    {0x1605, 1, &slave_0_pdo_entries[5]},
    {0x1606, 1, &slave_0_pdo_entries[6]},
    {0x1607, 1, &slave_0_pdo_entries[7]},
    {0x1608, 1, &slave_0_pdo_entries[8]},
    {0x1609, 1, &slave_0_pdo_entries[9]},
    {0x160a, 1, &slave_0_pdo_entries[10]},
    {0x160b, 1, &slave_0_pdo_entries[11]},
    {0x160c, 1, &slave_0_pdo_entries[12]},
    {0x160d, 1, &slave_0_pdo_entries[13]},
    {0x160e, 1, &slave_0_pdo_entries[14]},
    {0x160f, 1, &slave_0_pdo_entries[15]},
};

ec_sync_info_t slave_0_syncs[] = {
    {0, EC_DIR_OUTPUT, 8, slave_0_pdos + 0, EC_WD_DISABLE},
    {1, EC_DIR_OUTPUT, 8, slave_0_pdos + 8, EC_WD_DISABLE},
    {0xff}
};


static ec_master_t *master = nullptr;
static ec_domain_t *domain1 = nullptr;
static uint8_t *domain1_pd = nullptr;
static ec_slave_config_t *sc_el2809 = nullptr;
static ec_slave_config_state_t sc_el2809_state = {};
static ec_slave_info_t slaveInfo;


bool Worker::init()
{
    master = ecrt_request_master(0);
    if ( !master )
        return false;
    domain1 = ecrt_master_create_domain(master);
    if ( !domain1 )
        return false;
    if ( !(sc_el2809 = ecrt_master_slave_config(master, 0, 3, 0x00000002, 0x0af93052)) )
    {
        fprintf(stderr, "Failed to get slave configuration for AKD.\n");
        return false;
    }
    if (ecrt_slave_config_pdos(sc_el2809, EC_END, slave_0_syncs))
        return false;
    //----------- return -14 ?
    if (ecrt_domain_reg_pdo_entry_list(domain1, domain1_regs))
        return false;
    //-----------------------
    if ( ecrt_master_activate( master ) )
        return false;
    if (!(domain1_pd = ecrt_domain_data(domain1)))
        return false;

    return true;
}

dmesg doesn't seem report any errors.

Best regards

Vincent BUSSIERES
Responsable Technique Logiciel

[1572337113342]
ZE Ma Campagne
36, Impasse Félix Nadar
16000 ANGOULEME
Tel: 33 (0)9.72.40.35.08
www.hemeria-group.com<https://webmail.nexeya.fr/owa/redir.aspx?C=GK_BqKCZef7LtPZnqnd_LGYr1NG9sz4Smy3iKIwO-pXqtJC7VgzXCA..&URL=http%3a%2f%2fwww.hemeria-group.com%2f>
P Afin de contribuer au respect de l'environnement, merci de n'imprimer ce courriel qu'en cas de nécessité.
Ce message et les fichiers pouvant être attachés sont confidentiels, réservés à l'usage unique des destinataires et n'engagent HEMERIA sous aucune forme que ce soit.
This email and any files transmitted with it are confidential, intented solely for the unique use of the recipients and don't commit HEMERIA.



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.etherlab.org/pipermail/etherlab-users/attachments/20200422/021384d6/attachment-0002.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 5034 bytes
Desc: image001.png
URL: <http://lists.etherlab.org/pipermail/etherlab-users/attachments/20200422/021384d6/attachment-0003.png>


More information about the Etherlab-users mailing list