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.

[参考译文] AM6442:EtherCAT Beckhoff SSC 演示 — 不触发应用 I/O 映射事件

Guru**** 2530320 points


请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/processors-group/processors/f/processors-forum/1557118/am6442-ethercat-beckhoff-ssc-demo---application-i-o-mapping-events-not-triggered

器件型号:AM6442


工具/软件:

我正在尝试让“EtherCAT_SLAVE_Beckhoff ssc_demo“(工业 SDK v11.00.00) 与定制电路板配合使用、其中 EtherCAT PHY 连接到 PRU_ICSS0、而不是 PRU_ICSS1 、如示例中所示。

我修改了 tiescsoc.c 以使用不同的 PRU-ICSS:

===================================================================
--- tiescsoc.c	(revision 44)
+++ tiescsoc.c	(working copy)
@@ -43,6 +43,7 @@
 #include <kernel/dpl/DebugP.h>
 #include "ti_board_open_close.h"
 #include "ti_drivers_config.h"
+#undef ICSSG0_INSTANCE
 #include <industrial_comms/ethercat_slave/beckhoff_stack/stack_hal/tieschw.h>
 #include "tiesc_eeprom.h" /* header equivalent of ESI bin file */
 #ifdef  MDIO_MANUAL_MODE_ENABLED
@@ -197,8 +198,8 @@
     const PRUICSS_HwAttrs *pruicssHwAttrs;
     uint32_t inEventLatch0, inEventLatch1, outEventLatch0, outEventLatch1;
 
-    pruIcss1Handle = PRUICSS_open(CONFIG_PRU_ICSS1);
-    pruicssHwAttrs = PRUICSS_getAttrs(CONFIG_PRU_ICSS1);
+    pruIcss1Handle = PRUICSS_open(CONFIG_PRU_ICSS0);
+    pruicssHwAttrs = PRUICSS_getAttrs(CONFIG_PRU_ICSS0);
 
     /* Selecting MII-RT mode in GPCFG mux */
     PRUICSS_setGpMuxSelect(pruIcss1Handle, PRUICSS_PRU0, PRUICSS_GP_MUX_SEL_MODE_MII);

 
 void tiesc_getFoeFlashOffset(uint32_t *offset)
@@ -315,7 +316,7 @@
 
 int32_t tiesc_getArmInterruptOffset()
 {
-    PRUICSS_HwAttrs const *pruicssHwAttrs = PRUICSS_getAttrs(CONFIG_PRU_ICSS1);
+    PRUICSS_HwAttrs const *pruicssHwAttrs = PRUICSS_getAttrs(CONFIG_PRU_ICSS0);
     int32_t interruptOffset = 0;

到目前为止、我已经能够使用主器件初始化从器件、我可以读取从器件 XML 信息并更改状态。 但是、 如果我读取/写入 PDO、   则不会相应地调用函数 APPL_OutputMapping 和 APPL_InputMapping。 跟踪回来、看起来 PDITask 在等待事件时卡住:

void PDItask(void *arg)
{
//    TaskP_sleep(10 * OS_TICKS_IN_MILLI_SEC);
    /*TODO: Check if following is correct*/
    ClockP_usleep(10 * 1000);
#if AL_EVENT_ENABLED
    uint32_t evtOutNum = HOST_AL_EVENT - 20;
    while(1)
    {
        PRUICSS_waitEvent((PRUICSS_Handle)arg, evtOutNum);
        /* ISR processing */
        HW_EcatIsr();
    }
#endif //AL_EVENT_ENABLED
}

使用存储器浏览器(通过调试探针)、我可以看到来自主器件的 PDO 数据写入相应的寄存器(对于 RxPDO 条目 0x7000、为 0x30017000)。 我还注意到、 从应用程序主循环调用了 PDO_InputMapping。 因此、我还可以验证 TxPDO 是否已正确传输到主器件。

void MainLoop(void)
{
    
    /*return if initialization not finished */
    if(bInitFinished == FALSE)
    {
        return;
    }



        /* FreeRun-Mode:  bEscIntEnabled = FALSE, bDcSyncActive = FALSE
           Synchron-Mode: bEscIntEnabled = TRUE, bDcSyncActive = FALSE
           DC-Mode:       bEscIntEnabled = TRUE, bDcSyncActive = TRUE */
        if (
            (!bEscIntEnabled || !bEcatFirstOutputsReceived)     /* SM-Synchronous, but not SM-event received */
          && !bDcSyncActive                                               /* DC-Synchronous */
            )
        {
            /* if the application is running in ECAT Synchron Mode the function ECAT_Application is called
               from the ESC interrupt routine,
               in ECAT Synchron Mode it should be additionally checked, if the SM-event is received
               at least once (bEcatFirstOutputsReceived = 1), otherwise no interrupt is generated
               and the function ECAT_Application has to be called here (with interrupts disabled,
               because the SM-event could be generated while executing ECAT_Application) */
            if ( !bEscIntEnabled )
            {
                /* application is running in ECAT FreeRun Mode,
                   first we have to check, if outputs were received */
                UINT16 ALEvent = HW_GetALEventRegister();
                ALEvent = SWAPWORD(ALEvent);

                if ( ALEvent & PROCESS_OUTPUT_EVENT )
                {
                    /* set the flag for the state machine behavior */
                    bEcatFirstOutputsReceived = TRUE;
                    if ( bEcatOutputUpdateRunning )
                    {
                        /* update the outputs */
                        PDO_OutputMapping();
                    }
                }
                else if ( nPdOutputSize == 0 )
                {
                    /* if no outputs are transmitted, the watchdog must be reset, when the inputs were read */
                    if ( ALEvent & PROCESS_INPUT_EVENT )
                    {
                        /* Outputs were updated, set flag for watchdog monitoring */
                        bEcatFirstOutputsReceived = TRUE;
                    }
                }
            }

            DISABLE_ESC_INT();
             ECAT_Application();

/*ECATCHANGE_START(V5.13) ECAT 5*/
             if ( (bEcatInputUpdateRunning  == TRUE) && (nPdInputSize > 0))
/*ECATCHANGE_END(V5.13) ECAT 5*/
             {
                /* EtherCAT slave is at least in SAFE-OPERATIONAL, update inputs */
                PDO_InputMapping();
            }
            ENABLE_ESC_INT();
        }

总而言之、我能够验证:

-物理链路建立正常

-主器件可以初始化并获取从器件信息。 它还可以设置其状态

- PDO 数据在主器件和 ESC 之间交换

我可以采取哪些进一步的步骤来解决此问题? 为什么 PDI 任务在 PRUICSS_waitEvent 中挂起?

我看到以前的一个主题有类似的问题、但该解决方案未发布: e2e.ti.com/.../tmds64evm-ethercat-pdo-communication-does-not-work-rx-txpdo-addresses-are-changed

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    尊敬的 Martin:

    对延迟响应表示歉意。

    回溯时、看起来像 PDITask 一直在等待事件:

    任务是等待 AL 事件吗?

    我看到了以前的一个线程存在类似的问题、但该解决方案未发布: e2e.ti.com/.../tmds64evm-ethercat-pdo-communication-does-not-work-rx-txpdo-addresses-are-changed

    该解决方案当时不是公开的。 现在、它应该在最新的工业通信 SDK (v11.00) 中提供。

    您能否共享用于通信的 Wireshark 日志以及完整的 ICSS 存储器转储 (0x30000000 至 0x30040000)

    此致、
    Aaron

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    嗨、Aaron

    很抱歉耽误你的时间、我将重新开始处理这个项目。

    因此任务正在等待 AL 事件?

    没错。 PDItask 在调用 PRUICSS_waitEvent() 后从不恢复

    您能否共享用于通信的 Wireshark 日志以及完整的 ICSS 内存转储 (0x30000000 至 0x30040000)

    Wireshark 捕获: https://drive.proton.me/urls/G046MX09RW#KGsJRvffIenK

    顺序为:

    1 - EC 主器件启动

    2 — 应用程序启动(围绕数据包#1250)

    3-应用程序停止(围绕数据包#3600)

    主应用程序循环读取已满 TxPDO、并将 0x55AA/0xAA55 写入每个 RxPDO 条目。

    连接是 Direct Master <-> Slave(不是我用于捕获的 TAP)。

    SM/PDO 映射:

    SM0: PhysAddr 0x1000, DefaultSize  128, ControlRegister 0x26, Enable 1
    SM1: PhysAddr 0x1080, DefaultSize  128, ControlRegister 0x22, Enable 1
    SM2: PhysAddr 0x1100, DefaultSize   52, ControlRegister 0x64, Enable 1
      RxPDO 0x1600 "Dn process data mapping"
        PDO entry 0x7000:01, 16 bit, ""
        PDO entry 0x7000:02, 16 bit, ""
        PDO entry 0x7000:03, 16 bit, ""
        PDO entry 0x7000:04, 16 bit, ""
        PDO entry 0x7000:05, 16 bit, ""
        PDO entry 0x7000:06, 16 bit, ""
        PDO entry 0x7000:07, 16 bit, ""
        PDO entry 0x7000:08, 16 bit, ""
        PDO entry 0x7000:09, 16 bit, ""
        PDO entry 0x7000:0a, 16 bit, ""
        PDO entry 0x7000:0b, 16 bit, ""
        PDO entry 0x7000:0c, 16 bit, ""
        PDO entry 0x7000:0d, 16 bit, ""
        PDO entry 0x7000:0e, 16 bit, ""
        PDO entry 0x7000:0f, 16 bit, ""
        PDO entry 0x7000:10, 16 bit, ""
        PDO entry 0x7000:11, 16 bit, ""
        PDO entry 0x7000:12, 16 bit, ""
        PDO entry 0x7000:13, 16 bit, ""
        PDO entry 0x7000:14, 16 bit, ""
        PDO entry 0x7000:15, 16 bit, ""
        PDO entry 0x7000:16, 16 bit, ""
        PDO entry 0x7000:17, 16 bit, ""
        PDO entry 0x7000:18, 16 bit, ""
        PDO entry 0x7000:19, 16 bit, ""
        PDO entry 0x7000:1a, 16 bit, ""
    SM3: PhysAddr 0x1400, DefaultSize   42, ControlRegister 0x20, Enable 1
      TxPDO 0x1a00 "Up process data mapping"
        PDO entry 0x6000:01, 16 bit, ""
        PDO entry 0x6000:02, 16 bit, ""
        PDO entry 0x6000:03, 16 bit, ""
        PDO entry 0x6000:04, 16 bit, ""
        PDO entry 0x6000:05, 16 bit, ""
        PDO entry 0x6000:06, 16 bit, ""
        PDO entry 0x6000:07, 16 bit, ""
        PDO entry 0x6000:08, 16 bit, ""
        PDO entry 0x6000:09, 16 bit, ""
        PDO entry 0x6000:0a, 16 bit, ""
        PDO entry 0x6000:0b, 16 bit, ""
        PDO entry 0x6000:0c, 16 bit, ""
        PDO entry 0x6000:0d, 16 bit, ""
        PDO entry 0x6000:0e, 32 bit, ""
        PDO entry 0x6000:0f, 32 bit, ""
        PDO entry 0x6000:10, 32 bit, ""
        PDO entry 0x6000:11, 32 bit, ""

    有关更多信息、这是 EC 主日志:

    [  446.700397] EtherCAT: Master driver 1.6.3 unknown
    [  446.705677] EtherCAT: 1 master waiting for devices.
    [  446.748187] ec_generic: EtherCAT master generic Ethernet device module 1.6.3 unknown
    [  446.756379] EtherCAT: Accepting 28:B5:E8:CF:E8:25 as main device for master 0.
    [  446.763946] ec_generic: Binding socket to interface 4 (eth0).
    [  446.790111] EtherCAT 0: Starting EtherCAT-IDLE thread.
    [  446.795543] EtherCAT 0: Link state of ecm0 changed to UP.
    [  446.803890] EtherCAT 0: 1 slave(s) responding on main device.
    [  446.811526] EtherCAT 0: Slave states on main device: PREOP.
    [  446.818040] EtherCAT 0: Scanning bus.
    [  446.866700] EtherCAT 0: Bus scanning completed in 52 ms.
    [  446.872052] EtherCAT 0: Using slave 0 as DC reference clock.
    [  452.854273] EtherCAT: Requesting master 0...
    [  452.858724] EtherCAT: Successfully requested master 0.
    [  452.865546] EtherCAT 0: Domain0: Logical address 0x00000000, 94 byte, expected working counter 3.
    [  452.875155] EtherCAT 0:   Datagram domain0-0-main: Logical offset 0x00000000, 94 byte, type LRW.
    [  452.884734] EtherCAT 0: Master thread exited.
    [  452.889193] EtherCAT 0: Starting EtherCAT-OP thread.
    [  453.174104] EtherCAT WARNING 0: No application time received up to now, but master already active.
    [  453.366105] EtherCAT 0: Domain 0: Working counter changed to 3/3.
    [  453.410100] EtherCAT 0: Slave states on main device: OP.
    [  458.270700] EtherCAT 0: Releasing master...
    [  458.275035] EtherCAT 0: Master thread exited.
    [  458.279460] EtherCAT 0: Starting EtherCAT-IDLE thread.
    [  458.284956] EtherCAT 0: Released.
    [  458.298226] EtherCAT 0: Slave states on main device: PREOP.
    [  461.380648] EtherCAT 0: Master thread exited.
    [  461.385323] EtherCAT 0: Releasing main device 28:B5:E8:CF:E8:25.
    [  461.410182] ec_generic: Unloading.
    [  461.457955] EtherCAT: Master module cleaned up.

    ICSS 存储器转储: https://drive.proton.me/urls/VQE79D75N8#KZo5xNrmh554

    这是上一个序列之后的存储器状态。 您可以看到、对应于 SM2 (0x30011100) 的寄存器中填充了来自主器件的 0x55AA/0xAA55 交替变化。

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    尊敬的 Martin:

    感谢您提供详细信息。 我将查看此内容、并在下周初回来。

    此致、
    Aaron

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好 Aaron、

    我尝试了一个基于 SOEM 库而不是 IGH EC Master 的简单应用程序、这个应用程序按预期工作:PDItask 在等待 PRUICSS_waitEvent() 后恢复、然后调用 PDO 映射处理程序。 因此、ESC 对这 2 种主器件实现方式的反应似乎不同。 在此当前工程中、切换到 Soem 不是选项、但我希望这有助于进行故障排除。

    我将在 SOEM 测试中附加内存转储和 Wireshark 捕获:

    https://drive.proton.me/urls/47PGW853A8#NzDBjC81DfHR

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    尊敬的 Martin:  

    我尝试了一个基于 SOEM 库而不是 IGH EC Master 的简单应用程序、这个应用程序按预期工作:PDITask 在等待 PRUICSS_waitEvent() 后恢复、然后调用 PDO 映射处理程序。 因此、ESC 对这 2 种主器件实现方式的反应似乎不同。 切换到 Soem 不是当前项目的选项、但我希望这有助于进行故障排除。

    感谢您的更新。 因此问题取决于 IGH 处理。

    是否可以在 zip 文件夹中共享内存转储和 Wireshark 日志。 上述链接域被 Web 过滤器阻止。

    此致、
    Aaron

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好 Aaron、

    我将为两种情况附加文件:使用 IGH master 和 SOEM:

    e2e.ti.com/.../Igh_5F00_TI.zip

    e2e.ti.com/.../SOEM_5F00_sample_5F00_TI.zip