工具/软件:
我正在尝试让“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