[etherlab-users] How to run this demo with the ethercat master

Ralf Roesch ethercat at cantastic.org
Wed Jul 8 20:22:12 CEST 2015


Richard, regarding your supplied XML I would suggest:


static ec_pdo_info_t xxx_pdos[] = {

    {0x1600, 1, &xxx_pdo_entries[0]},

    {0x1601, 3, &xxx_pdo_entries[1]},

    {0x1A00, 1, &xxx_pdo_entries[4]},

    {0x1A01, 4, &xxx_pdo_entries[5]}

        };

static ec_sync_info_t xxx_syncs[] = {

    {2, EC_DIR_OUTPUT, 2, &xxx_pdos[2]},

    {3, EC_DIR_INPUT, 2, &xxx_pdos[0]},

    {0xff}

          };

BTW, have you tried this ?
    ethercat cstruct -p0

regards
Ralf

On Wed Jul 08 2015 19:33:37 GMT+0200 (CEST), Richard Andrysek
<richard.andrysek at gomtec.de> wrote:
>
> I have an XML file (4 pages, I can send it) with slave description -
> demo. I have also a binary.
>
>>
> <Sm DefaultSize="512" StartAddress="#x1000" ControlByte="#x26"
> Enable="1">MBoxOut</Sm>
>
> <Sm DefaultSize="512" StartAddress="#x1200" ControlByte="#x22"
> Enable="1">MBoxIn</Sm>
>
> <Sm MaxSize="1024" StartAddress="#x1400" ControlByte="#x24"
> Enable="1">Outputs</Sm>
>
> <Sm MaxSize="1024" StartAddress="#x2000" ControlByte="#x20"
> Enable="1">Inputs</Sm>
>
> <RxPdo Mandatory="1" Fixed="1" Sm="2">
>
>           <Index>#x1600</Index>
>
>           <Name>Fix Output Module</Name>
>
>           <Entry Fixed="1">
>
>             <Index>#x7000</Index>
>
>             <SubIndex>1</SubIndex>
>
>             <BitLen>8</BitLen>
>
>             <Name>LED_Output</Name>
>
>             <DataType>USINT</DataType>
>
>           </Entry>
>
>         </RxPdo>
>
>         <RxPdo Fixed="0" Sm="2">
>
>           <Index>#x1601</Index>
>
>           <Name>Variable Output Module</Name>
>
>           <Entry>
>
>             <Index>#x7001</Index>
>
>             <SubIndex>1</SubIndex>
>
>             <BitLen>32</BitLen>
>
>             <Name>Variable 1</Name>
>
>             <DataType>UDINT</DataType>
>
>           </Entry>
>
>           <Entry>
>
>             <Index>#x7001</Index>
>
>             <SubIndex>2</SubIndex>
>
>             <BitLen>16</BitLen>
>
>             <Name>Variable 2</Name>
>
>             <DataType>UINT</DataType>
>
>           </Entry>
>
>           <Entry>
>
>             <Index>#x7001</Index>
>
>             <SubIndex>3</SubIndex>
>
>             <BitLen>8</BitLen>
>
>             <Name>Variable 3</Name>
>
>             <DataType>USINT</DataType>
>
>           </Entry>
>
>         </RxPdo>
>
>         <TxPdo Mandatory="1" Fixed="1" Sm="3">
>
>           <Index>#x1A00</Index>
>
>           <Name>Fix Input Module</Name>
>
>           <Entry Fixed="1">
>
>             <Index>#x6000</Index>
>
>             <SubIndex>1</SubIndex>
>
>             <BitLen>8</BitLen>
>
>             <Name>LED_Speed</Name>
>
>             <DataType>USINT</DataType>
>
>           </Entry>
>
>         </TxPdo>
>
>         <TxPdo Fixed="0" Sm="3">
>
>           <Index>#x1A01</Index>
>
>           <Name>Variable Input Module</Name>
>
>           <Entry>
>
>             <Index>#x6001</Index>
>
>             <SubIndex>1</SubIndex>
>
>             <BitLen>16</BitLen>
>
>             <Name>Variable 1</Name>
>
>             <DataType>UINT</DataType>
>
>           </Entry>
>
>           <Entry>
>
>             <Index>#x6001</Index>
>
>             <SubIndex>2</SubIndex>
>
>             <BitLen>16</BitLen>
>
>             <Name>Variable 2</Name>
>
>             <DataType>UINT</DataType>
>
>           </Entry>
>
>           <Entry>
>
>             <Index>#x6001</Index>
>
>             <SubIndex>3</SubIndex>
>
>             <BitLen>32</BitLen>
>
>             <Name>Variable 3</Name>
>
>             <DataType>UDINT</DataType>
>
>           </Entry>
>
>           <Entry>
>
>             <Index>#x6001</Index>
>
>             <SubIndex>4</SubIndex>
>
>             <BitLen>32</BitLen>
>
>             <Name>Variable 4</Name>
>
>             <DataType>UDINT</DataType>
>
>           </Entry>
>
>         </TxPdo>
>
>         <Mailbox>
>
>           <EoE />
>
>           <CoE SdoInfo="1" PdoAssign="1" PdoConfig="1" DiagHistory="1"/>
>
>           <FoE />
>
>         </Mailbox>
>
>         <Dc>
>
>           <OpMode>
>
>             <Name>Synchron</Name>
>
>             <Desc>Synchron with SM2 Event</Desc>
>
>             <AssignActivate>#x0000</AssignActivate>
>
>           </OpMode>
>
>         </Dc>
>
>         <Eeprom AssignToPdi="1">
>
>           <ByteSize>2048</ByteSize>
>
>           <ConfigData>8004036600000000000000000000</ConfigData>
>
>           <BootStrap>0010000200120002</BootStrap>
>
>         </Eeprom>
>
>       </Device>
>
>  
>
> But I can’t get the device to set it in the operational mode. I use a
> demo example “user”.
>
>  
>
> 1)      What do I need to specify in the main.c?  I’ve tried to add
> PDOs, but in the XML file are DiagMessages, Sms, Mailbox, …
>
> But in the user main.c are only PDOs:
>
> static ec_pdo_entry_info_t xxx_pdo_entries[] = {
>
>     /* RxPDO */  
>
>     {0x7000, 1,  8}, // Led Output
>
>     {0x7001, 1, 32}, // Variable 1 
>
>     {0x7001, 2, 16}, // Variable 2
>
>     {0x7001, 3, 8},  // Variable 3   
>
>     /* TxPDO */
>
>     {0x6000, 1,  8}, // Led Output
>
>     {0x6001, 1, 16}, // Variable 1 
>
>     {0x6001, 2, 16}, // Variable 2
>
>     {0x6001, 3, 32}, // Variable 3
>
>     {0x6001, 4, 32}, // Variable 4                               
>
> };
>
>  
>
> static ec_pdo_info_t xxx_pdos[] = {
>
>     {0x1600, 4, xxx_pdo_entries},
>
>     {0x1A00, 1, &xxx_pdo_entries[4]},
>
>     {0x1A01, 4, &xxx_pdo_entries[5]}
>
> };
>
>  
>
> /* no idea what shal be here inside? Do I needed or does it send a
> slave? */
>
> static ec_sync_info_t xxx_syncs[] = {
>
>     {2, EC_DIR_OUTPUT, 2, &xxx_pdos[1]},
>
>     {3, EC_DIR_INPUT, 1, &xxx_pdos[0]},
>
>     {0xff}
>
> };
>
>  
>
> 2)      Here is a dump from main.c
>
> Configuring sync PDOs...
>
> Configuring domain1...
>
> Activating master...
>
> Domain data ...
>
> setprioriry ...
>
> Warning: Failed to set priority: Permission denied
>
> sigaction ...
>
> Starting timer...
>
> Started.
>
> 1 slave(s).
>
> AL states: 0x02.
>
> Link is up.
>
> XXX: State 0x02.
>
> XXX: online.
>
>  
>
> 3)dmesg debug dump
>
>>
> [176175.854987] EtherCAT: 1 master waiting for devices.
>
> [176175.856693] ec_generic: EtherCAT master generic Ethernet device
> module devel af21f0bdc7c9+
>
> [176175.856700] EtherCAT: Accepting device BC:5F:F4:FB:17:AB for master 0.
>
> [176175.856708] ec_generic: Binding socket to interface 2 (eth1).
>
> [176175.860080] EtherCAT 0: Starting EtherCAT-IDLE thread.
>
> [176175.860143] EtherCAT 0: Link state changed to UP.
>
> [176175.861006] EtherCAT 0: 1 slave(s) responding.
>
> [176175.861007] EtherCAT 0: Slave states: PREOP.
>
> [176175.861067] EtherCAT 0: Scanning bus.
>
> [176175.863692] EtherCAT WARNING 0-0: SII size exceeds 4096 words
> (0xffff limiter missing?).
>
> [176175.879559] EtherCAT 0: Bus scanning completed in 18 ms.
>
> [176180.950532] EtherCAT: Requesting master 0...
>
> [176180.950549] EtherCAT: Successfully requested master 0.
>
> [176180.950664] EtherCAT 0: Domain0: Logical address 0x00000000, 21
> byte, expected working counter 3.
>
> [176180.950667] EtherCAT 0:   Datagram domain0-0: Logical offset
> 0x00000000, 21 byte, type LRW.
>
> [176180.950707] EtherCAT 0: Master thread exited.
>
> [176180.950709] EtherCAT 0: Starting EtherCAT-OP thread.
>
> [176183.762439] EtherCAT 0: Releasing master...
>
> [176183.762447] EtherCAT 0: Master thread exited.
>
> [176183.762453] EtherCAT 0: Starting EtherCAT-IDLE thread.
>
> [176183.762555] EtherCAT 0: Released.
>
> [176770.181924] EtherCAT: Successfully requested master 0.
>
> [176770.181971] EtherCAT 0: Domain0: Logical address 0x00000000, 21
> byte, expected working counter 3.
>
> [176770.181974] EtherCAT 0:   Datagram domain0-0: Logical offset
> 0x00000000, 21 byte, type LRW.
>
> [176770.182007] EtherCAT 0: Master thread exited.
>
> [176770.182010] EtherCAT 0: Starting EtherCAT-OP thread.
>
> [176770.182093] EtherCAT WARNING 0: 1 datagram UNMATCHED!
>
> [176770.353005] EtherCAT WARNING 0-0: PDOs configured for SM2, but
> slave does not provide the sync manager information!
>
> [176770.353009] EtherCAT WARNING 0-0: PDOs configured for SM3, but
> slave does not provide the sync manager information!
>
> [176770.353012] EtherCAT ERROR 0-0: Failed to determine PDO sync
> manager for FMMU!
>
> [176817.598870] EtherCAT 0: Releasing master...
>
> [176817.598924] EtherCAT 0: Master thread exited.
>
> [176817.598930] EtherCAT 0: Starting EtherCAT-IDLE thread.
>
> [176817.599057] EtherCAT 0: Released.
>
>  
>
> What am I missing or doing wrong?
>
>  
>
> By
>
>  
>
> Richard
>
>
>
> _______________________________________________
> etherlab-users mailing list
> etherlab-users at etherlab.org
> http://lists.etherlab.org/mailman/listinfo/etherlab-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.etherlab.org/pipermail/etherlab-users/attachments/20150708/b7911be2/attachment-0004.htm>


More information about the Etherlab-users mailing list