This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Linux: EtherCAT Master example with CIA402

Other Parts Discussed in Thread: SYSBIOS

Tool/software: Linux

In thread "AM335x ICEv2 issue with IGH EtherCAT Master for Linux" there is mentioned a running example with the IgH-EtherCAT master with CIA402. Where can I access that example?

  • The software team have been notified. They will respond here.
  • I tried also the latest ethercat slave app and MLO for the AM355x ICE r2.1 with the IgH Master.
    But the device will not change to OP. There is an error during activating OP:
    EtherCAT ERROR 0-0: Timeout while setting state OP.

    Can i get a running example for the ICE with IgH master?

    [26885.290384] EtherCAT DEBUG 0: IDLE -> ORPHANED.
    [26885.290386] EtherCAT DEBUG 0: Stopping master thread.
    [26885.290743] EtherCAT DEBUG 0: Master IDLE thread exiting...
    [26885.290747] EtherCAT 0: Master thread exited.
    [26885.309981] EtherCAT 0: Link state of ecm0 changed to DOWN.
    [26885.460990] EtherCAT 0: Releasing main device 00:1B:21:0F:18:C3.
    [26885.465740] EtherCAT: Master module cleaned up.
    [26887.647723] EtherCAT: Master driver 1.5.2 2eff7c993a63
    [26887.647779] EtherCAT: 1 master waiting for devices.
    [26887.661373] ec_e1000e: EtherCAT-capable Intel(R) PRO/1000 Network Driver - 1.9.5-k-EtherCAT
    [26887.661375] ec_e1000e: Copyright(c) 1999 - 2012 Intel Corporation.
    [26887.661389] ec_e1000e 0000:03:00.0: Disabling ASPM L1
    [26887.661521] ec_e1000e 0000:03:00.0: (unregistered net_device): Interrupt Throttling Rate (ints/sec) set to dynamic conservative mode
    [26887.661590] ec_e1000e 0000:03:00.0: irq 44 for MSI/MSI-X
    [26887.833187] EtherCAT: Accepting 00:1B:21:0F:18:C3 as main device for master 0.
    [26887.977057] EtherCAT 0: Starting EtherCAT-IDLE thread.
    [26887.977073] ec_e1000e 0000:03:00.0: (unregistered net_device): (PCI Express:2.5GT/s:Width x1) 00:1b:21:0f:18:c3
    [26887.977075] ec_e1000e 0000:03:00.0: (unregistered net_device): Intel(R) PRO/1000 Network Connection
    [26887.977164] ec_e1000e 0000:03:00.0: (unregistered net_device): MAC: 1, PHY: 4, PBA No: D50854-003
    [26889.832490] ec_e1000e 0000:03:00.0: (unregistered net_device): 10/100 speed: disabling TSO
    [26889.832494] EtherCAT 0: Link state of ecm0 changed to UP.
    [26889.833597] EtherCAT 0: 1 slave(s) responding on main device.
    [26889.833599] EtherCAT 0: Slave states on main device: PREOP.
    [26889.833714] EtherCAT 0: Scanning bus.
    [26889.848033] EtherCAT 0: Bus scanning completed in 14 ms.
    [26889.848035] EtherCAT 0: Using slave 0 as DC reference clock.
    [26889.848036] EtherCAT ERROR 0: Failed to calculate bus topology.
    [26893.528390] EtherCAT 0: Master debug level set to 1.
    [26901.712328] EtherCAT: Requesting master 0...
    [26901.712330] EtherCAT DEBUG 0: IDLE -> OPERATION.
    [26901.712332] EtherCAT: Successfully requested master 0.
    [26901.712334] EtherCAT DEBUG 0: ecrt_master_create_domain(master = 0xffff8800d7892000)
    [26901.712335] EtherCAT DEBUG 0: Created domain 0.
    [26901.712338] EtherCAT DEBUG 0: ecrt_master_slave_config(master = 0xffff8800d7892000, alias = 0, position = 0, vendor_id = 0x0000088f, product_code = 0x4d490002)
    [26901.712340] EtherCAT DEBUG 0: Creating slave configuration for 0:0, 0x0000088F/0x4D490002.
    [26901.712343] EtherCAT DEBUG 0 0:0: Slave 0 has no matching vendor ID (0xE000059D) for configuration (0x0000088F).
    [26901.712352] EtherCAT DEBUG 0 0:0: ecrt_slave_config_create_sdo_request_err(sc = 0xffff8800d7988000, index = 0x1C12, subindex = 0x00, size = 1)
    [26901.712364] EtherCAT DEBUG 0 0:0: ecrt_slave_config_sync_manager(sc = 0xffff8800d7988000, sync_index = 0, dir = 1, watchdog_mode = 2)
    [26901.712366] EtherCAT DEBUG 0 0:0: ecrt_slave_config_sync_manager(sc = 0xffff8800d7988000, sync_index = 1, dir = 2, watchdog_mode = 2)
    [26901.712368] EtherCAT DEBUG 0 0:0: ecrt_slave_config_sync_manager(sc = 0xffff8800d7988000, sync_index = 2, dir = 1, watchdog_mode = 1)
    [26901.712371] EtherCAT DEBUG 0 0:0: ecrt_slave_config_pdo_assign_clear(sc = 0xffff8800d7988000, sync_index = 2)
    [26901.712373] EtherCAT DEBUG 0 0:0: ecrt_slave_config_pdo_assign_add(sc = 0xffff8800d7988000, sync_index = 2, pdo_index = 0x1601)
    [26901.712376] EtherCAT DEBUG 0 0:0: ecrt_slave_config_pdo_mapping_clear(sc = 0xffff8800d7988000, pdo_index = 0x1601)
    [26901.712379] EtherCAT DEBUG 0 0:0: ecrt_slave_config_pdo_mapping_add(sc = 0xffff8800d7988000, pdo_index = 0x1601, entry_index = 0x7010, entry_subindex = 0x00, entry_bit_length = 32)
    [26901.712382] EtherCAT DEBUG 0 0:0: ecrt_slave_config_sync_manager(sc = 0xffff8800d7988000, sync_index = 3, dir = 2, watchdog_mode = 2)
    [26901.712384] EtherCAT DEBUG 0 0:0: ecrt_slave_config_pdo_assign_clear(sc = 0xffff8800d7988000, sync_index = 3)
    [26901.712386] EtherCAT DEBUG 0 0:0: ecrt_slave_config_pdo_assign_add(sc = 0xffff8800d7988000, sync_index = 3, pdo_index = 0x1A00)
    [26901.712388] EtherCAT DEBUG 0 0:0: ecrt_slave_config_pdo_mapping_clear(sc = 0xffff8800d7988000, pdo_index = 0x1A00)
    [26901.712390] EtherCAT DEBUG 0 0:0: ecrt_slave_config_pdo_mapping_add(sc = 0xffff8800d7988000, pdo_index = 0x1A00, entry_index = 0x6000, entry_subindex = 0x00, entry_bit_length = 32)
    [26901.712393] EtherCAT DEBUG 0: ecrt_master_slave_config(master = 0xffff8800d7892000, alias = 0, position = 0, vendor_id = 0x0000088f, product_code = 0x4d490002)
    [26901.712396] EtherCAT DEBUG 0 0:0: ecrt_slave_config_reg_pdo_entry(sc = 0xffff8800d7988000, index = 0x6000, subindex = 0x00, domain = 0xffff8800d5fcecc0, bit_position = 0xffff8800d70d7e24)
    [26901.712399] EtherCAT DEBUG 0: Domain 0: Added 4 bytes, total 4.
    [26901.712400] EtherCAT DEBUG 0: ecrt_master_slave_config(master = 0xffff8800d7892000, alias = 0, position = 0, vendor_id = 0x0000088f, product_code = 0x4d490002)
    [26901.712403] EtherCAT DEBUG 0 0:0: ecrt_slave_config_reg_pdo_entry(sc = 0xffff8800d7988000, index = 0x7010, subindex = 0x00, domain = 0xffff8800d5fcecc0, bit_position = 0xffff8800d70d7e24)
    [26901.712405] EtherCAT DEBUG 0: Domain 0: Added 4 bytes, total 8.
    [26901.712408] EtherCAT DEBUG 0 0:0: ecrt_slave_config_dc(sc = 0xffff8800d7988000, assign_activate = 0x0300, sync0_cycle = 500000, sync0_shift = 4400000, sync1_cycle = 0, sync1_shift = 0
    [26901.712419] EtherCAT DEBUG 0: ecrt_domain_external_memory(domain = 0xffff8800d5fcecc0, mem = 0xffffc90005779000)
    [26901.712421] EtherCAT DEBUG 0: ecrt_master_callbacks(master = 0xffff8800d7892000, send_cb = 0xffffffffa0479750, receive_cb = 0xffffffffa0477d20, cb_data = 0xffff8800d7892000)
    [26901.712423] EtherCAT DEBUG 0: ecrt_master_activate(master = 0xffff8800d7892000)
    [26901.712426] EtherCAT DEBUG 0: Adding datagram pair with expected WC 3.
    [26901.712427] EtherCAT 0: Domain0: Logical address 0x00000000, 8 byte, expected working counter 3.
    [26901.712429] EtherCAT 0: Datagram domain0-0-main: Logical offset 0x00000000, 8 byte, type LRW.
    [26901.712430] EtherCAT DEBUG 0: Stopping master thread.
    [26901.712436] EtherCAT DEBUG 0: Master IDLE thread exiting...
    [26901.712441] EtherCAT 0: Master thread exited.
    [26901.712443] EtherCAT DEBUG 0: FSM datagram is ffff8800d7892678.
    [26901.712444] EtherCAT 0: Starting EtherCAT-OP thread.
    [26901.712458] EtherCAT DEBUG 0: Operation thread running with fsm interval = 1000 us, max data size=11250
    [26901.712461] EtherCAT DEBUG 0: mmap()
    [26901.712463] EtherCAT DEBUG 0: Vma fault, virtual_address = 00007f1beab1f000, offset = 0, page = ffffea0000a79a48
    [26901.713466] EtherCAT DEBUG 0: Configuration changed.
    [26901.713467] EtherCAT DEBUG 0-0: Checking system time offset.
    [26901.714472] EtherCAT DEBUG 0-0: DC 64 bit system time offset calculation: system_time=26927911363880 (corrected with 1000000), app_time=26927912043907, diff=680027
    [26901.714475] EtherCAT DEBUG 0-0: Not touching time offset.
    [26901.715479] EtherCAT DEBUG 0: Requesting OP...
    [26901.717486] EtherCAT DEBUG 0-0: Changing state from PREOP to OP.
    [26901.717487] EtherCAT DEBUG 0-0: Configuring...
    [26901.719493] EtherCAT DEBUG 0-0: Now in INIT.
    [26901.719494] EtherCAT DEBUG 0-0: Clearing FMMU configurations...
    [26901.720498] EtherCAT DEBUG 0-0: Clearing sync manager configurations...
    [26901.721502] EtherCAT DEBUG 0-0: Clearing DC assignment...
    [26901.722505] EtherCAT DEBUG 0-0: Configuring mailbox sync managers...
    [26901.722507] EtherCAT DEBUG 0-0: SM0: Addr 0x1000, Size 128, Ctrl 0x26, En 1
    [26901.722509] EtherCAT DEBUG 0-0: SM1: Addr 0x1080, Size 128, Ctrl 0x22, En 1
    [26901.725522] EtherCAT DEBUG 0-0: Now in PREOP.
    [26901.725525] EtherCAT DEBUG 0-0: SM2: Addr 0x1100, Size 4, Ctrl 0x64, En 1
    [26901.725527] EtherCAT DEBUG 0-0: SM3: Addr 0x1400, Size 4, Ctrl 0x20, En 1
    [26901.728545] EtherCAT DEBUG 0-0: Now in SAFEOP.
    [26906.725393] EtherCAT ERROR 0-0: Timeout while setting state OP.
    [26906.726400] EtherCAT 0: Slave states on main device: SAFEOP.
    [26910.967714] EtherCAT 0: Slave states on main device: SAFEOP + ERROR.
    [26910.968719] EtherCAT DEBUG 0-0: SAFEOP -> SAFEOP + ERROR.

  • Hi Matthias
    Sorry for the delay .
    There is not an example - we just have the brief instructions in the e2e.
    If you have followed these then - let's do a quick check of the build - each EtherCAT slave has specific version requirements for CCS, Processor SDK (which also loads Sysbios and XDCTOOLS).
    These requirements are described in PRU-ICSS EtherCAT slave users guide for the version under test. Other combinations are not guaranteed to work.
    Can you describe the versions that you are using for PRU-ICSS EtherCAT, Processor SDK, and CCS?
    David
  • Hi David

    I used that prebuild sd card image 1.0.5.0. 

    this is the output on uart: 

    StarterWare Boot Loader
    BOARDInit status [0x0]
    SoC : [AM335X]
    Core : [A8]
    Board Detected : [ICE Ver 2]
    Base Board Revision : [UNKNOWN]
    Daughter Card Revision: [UNKNOWN]
    GPIO Instance number: 0
    Pin number: 18

    MMC/SD Card Detect Pin Not Used on Hardware
    Copying application image from MMC/SD card to RAM
    Jumping to StarterWare Application...


    Version - EtherCAT Slave 1.0.5.0
    Board name : A335_ICE
    Board Revision : 2.1AEtherCAT Device

    SYS/BIOS EtherCAT Demo application3.3.0Rotary switch state : 0

    Matthias

  • Hi Matthias

    Regretfully, it is necessary to build the full application enable the CIA_402 mode.

    Translating Lyu Frank steps in the previous post to the current Processor SDK & PRU-ICSS EtherCAT  architecture

    Follow the steps in http://processors.wiki.ti.com/index.php/PRU_ICSS_EtherCAT#Building_full_feature_EtherCAT_Slave_Application

    Modify the macro value of TIESC_APPLICATION from 1 to 0, CiA402_DEVICE from 0 to 1.

    Then addition to modifying the TI_ESC application it is necessary to also modify the IGH master (main.c) code.

    Step 1: The boards have to be flashed with the EEPROM of cia402.

    Step 2: The correct PDO entries have to be copied to the main.c file of IGH master.
    sudo ethercat cstruct -> is the command to get the PDO entries.
    The result of the above command will be different for TIESC_APPLICATION and CiA402_DEVICE

    Step 3: The function call, "ecrt_slave_config_reg_pdo_entry" in main.c file of IGH master has to be modified with the obtained addresses from the step 2 command.

    Step 4: Compile the master code.
    make

    David

  • Hi David,

    these steps I had tried but with no success. next step should be compiling the  Building_full_feature_EtherCAT_Slave_Application... when i have the SSC code.

    I found kast week some other really curious behavior:

    1. Start the ICE with the prebuild EtherCAT Demo application V3.3.0
      1. it is connected to IGH 1.5.2
      2. there is only one slave device
    2. reading sdos. the ICE is in PREOP
      1. ethercat sdos give the folloing output through the online dictionary
        1. SDO 0x1008, "Device name"  0x1008:00, r-r-r-, string, 80 bit, "Device name"
        2. SDO 0x6000, "Input Data" 0x6000:00, r-r-r-, octet_string, 32 bit, "Input Data"
        3. SDO 0x7010, "Output Data" 0x7010:00, rwrwrw, octet_string, 32 bit, "Output Data"
      2. read values of sdo 
        1. ethercat upload -p 0 0x1008 0 --> SSC-Device
        2. ethercat upload -p 0 0x6000 0 --> SDO transfer aborted with code 0x06070012: Data type does not match, length of service parameter too high
          1. also with -t octet_string and -t uint32
        3. Hence, the ICE is not abled to respond correctly to the sdo request on 0x6000. 0x1008 with same type will work
    3. connect the ICE with twincat without repowering/resetting
      1. TwinCAT has no ESI,  it must also operate with the online dictionary like IGH
      2. scan EtherCAT bus and add the ICE to the master. TwinCAT is stil in config mode
      3. object 0x6000 0 is readable and has the value 0x00CCBBAA
      4. object 0x7010 0 is writable. the LED are switchable
    4. connect the ICE with IGH without repowering/resetting
      1. ethercat upload -p 0 -t uint32 0x6000 0 --> 0xaabbcc00 2864434176
      2. ethercat download -p 0 -t uint32 0x7010 0 0x0f --> switch led 
      3. ethercat download -p 0 -t uint32 0x7010 0 0xf0--> switch led
      4. ethercat download -p 0 -t octet_string 0x7010 0 0xf0 --> switch led but not with the expected result
      5. ethercat download -p 0 -t octet_string 0x7010 0 0x0f --> switch led but not with the expected result

    Hence, there was a miracle. TwinCAT does some magic config. So after TwinCAT does something, IGH can read/write the objects 0x6000/0x7010. Writing 0x7010 will only work correctly with type uint32. The propagated type octet_string delivers come strange data.