主题中讨论的其他器件:AM2634、 DP83869、AMIC120
尊敬的 TI 团队:
我使用 AM2634和两个 DP83826E (输入/输出)设计了一个新的电路板。
新电路板的应用基于 MCU+SDK am263x 8.6.00.34控制卡的 EtherCAT 示例以及 Beckhoff SSC 演示。
我为两个 DP83826E 修改了该示例。 因为本示例将 DP83869和 DP83826E 用作两个 EtherCAT 端口。
我对 Beckhoff 器件使用"New Device"执行了一些测试。
测试案例1在1小时内正常工作。 但测试情况2出错了。
测试案例2包含一个 Beckhoff 主器件和两个"新器件"(DUT 1、DUT 2)。
测试案例2的问题是 DUT#1的 OUT 端口不与 DUT#2的输入端口保持连接。
有时"DUT #1"检测输出端口上的下一个器件、有时"DUT #1"会在输出端口上丢失下一个器件。 这种情况反复出现。
当我更改 DUT#1和 DUT#2之间的位置时,第一个节点输出(DUT#2 OUT)上发生同样的问题

[图1. 测试案例1网络配置]

[图2. 测试案例2网络配置]
我在"TwinCAT2 SystemManager"的在线视图上确认了此问题。 '图 3"是 测试案例2的在线视图。


[图3. 测试案例2的 TwinCAT 在线监测器]
这是 该应用的 DP83826的启动代码。
MCU+SDK am263x 8.6.00.34具有适用于 DP83826E 的器件驱动程序。
我只需替换两个 DP83826E 的代码。
void tiesc_socParamsInit(bsp_params *bspInitParams)
{
bsp_params_init(bspInitParams);
bspInitParams->pruicss_handle = pruIcss1Handle;
bspInitParams->interrupt_offset = tiesc_getArmInterruptOffset();
bspInitParams->eeprom_read = tiesc_eepromRead;
bspInitParams->eeprom_write = tiesc_eepromWrite;
bspInitParams->spinlock_base_address = CSL_SPINLOCK0_BASE;
bspInitParams->ethphy_init = tiesc_ethphyInit;
bspInitParams->enhancedlink_enable = TIESC_MDIO_RX_LINK_ENABLE;
bspInitParams->link0_polarity = TIESC_LINK0_POL; /*Polarity is high */
bspInitParams->link1_polarity = TIESC_LINK1_POL; /*Polarity is low */
bspInitParams->phy0_address = ((const ETHPHY_Attrs *)ETHPHY_getAttrs(CONFIG_ETHPHY0))->phyAddress;
bspInitParams->phy1_address = ((const ETHPHY_Attrs *)ETHPHY_getAttrs(CONFIG_ETHPHY1))->phyAddress;
bspInitParams->default_tiesc_eeprom = (const unsigned char *)(&(tiesc_eeprom));
bspInitParams->eeprom_pointer_for_stack = &(pEEPROM);
}
void tiesc_ethphyInit(PRUICSS_Handle pruIcssHandle, uint8_t phy0addr,
uint8_t phy1addr, uint8_t enhancedlink_enable)
{
uint32_t mdioBaseAddress = ((const ETHPHY_Attrs *)ETHPHY_getAttrs(CONFIG_ETHPHY0))->mdioBaseAddress;
ETHPHY_DP83826E_LedSourceConfig ledConfig0;
ETHPHY_DP83826E_LedBlinkRateConfig ledBlinkConfig0;
ETHPHY_DP83826E_FastLinkDownDetectionConfig fastLinkDownDetConfig0;
ETHPHY_DP83826E_LedSourceConfig ledConfig1;
ETHPHY_DP83826E_LedBlinkRateConfig ledBlinkConfig1;
ETHPHY_DP83826E_FastLinkDownDetectionConfig fastLinkDownDetConfig1;
ETHPHY_command(gEthPhyHandle[CONFIG_ETHPHY0], ETHPHY_CMD_ENABLE_AUTO_MDIX, NULL, 0);
ETHPHY_command(gEthPhyHandle[CONFIG_ETHPHY1], ETHPHY_CMD_ENABLE_AUTO_MDIX, NULL, 0);
if(TIESC_MDIO_RX_LINK_ENABLE == enhancedlink_enable)
{
/*TODO: Review these 2 calls*/
ledConfig0.ledNum = ETHPHY_DP83826E_LED0;
ledConfig0.mode = ETHPHY_DP83826E_LED_MODE_LINK_OK;
ledConfig1.ledNum = ETHPHY_DP83826E_LED0;
ledConfig1.mode = ETHPHY_DP83826E_LED_MODE_LINK_OK;
ETHPHY_command(gEthPhyHandle[CONFIG_ETHPHY0], ETHPHY_CMD_CONFIGURE_LED_SOURCE, (void *)&ledConfig0, sizeof(ledConfig0));
ETHPHY_command(gEthPhyHandle[CONFIG_ETHPHY1], ETHPHY_CMD_CONFIGURE_LED_SOURCE, (void *)&ledConfig1, sizeof(ledConfig1));
}
/* Enable Extended Full-Duplex */
ETHPHY_command(gEthPhyHandle[CONFIG_ETHPHY0], ETHPHY_CMD_ENABLE_EXTENDED_FD_ABILITY, NULL, 0);
ETHPHY_command(gEthPhyHandle[CONFIG_ETHPHY1], ETHPHY_CMD_ENABLE_EXTENDED_FD_ABILITY, NULL, 0);
/* Enable Odd Nibble Detection */
ETHPHY_command(gEthPhyHandle[CONFIG_ETHPHY0], ETHPHY_CMD_ENABLE_ODD_NIBBLE_DETECTION, NULL, 0);
ETHPHY_command(gEthPhyHandle[CONFIG_ETHPHY1], ETHPHY_CMD_ENABLE_ODD_NIBBLE_DETECTION, NULL, 0);
/* Enable detection of RXERR during IDLE */
ETHPHY_command(gEthPhyHandle[CONFIG_ETHPHY0], ETHPHY_CMD_ENABLE_ENHANCED_IPG_DETECTION, NULL, 0);
ETHPHY_command(gEthPhyHandle[CONFIG_ETHPHY1], ETHPHY_CMD_ENABLE_ENHANCED_IPG_DETECTION, NULL, 0);
/* PHY pin LED_0 as link for fast link detection */
ledConfig0.ledNum = ETHPHY_DP83826E_LED0;
ledConfig0.mode = ETHPHY_DP83826E_LED_MODE_MII_LINK_100BT_FD;
ledConfig1.ledNum = ETHPHY_DP83826E_LED0;
ledConfig1.mode = ETHPHY_DP83826E_LED_MODE_MII_LINK_100BT_FD;
//ETHPHY_command(gEthPhyHandle[CONFIG_ETHPHY0], ETHPHY_CMD_CONFIGURE_LED_SOURCE, (void *)&ledConfig0, sizeof(ledConfig0));
ETHPHY_command(gEthPhyHandle[CONFIG_ETHPHY1], ETHPHY_CMD_CONFIGURE_LED_SOURCE, (void *)&ledConfig1, sizeof(ledConfig1));
/*For DP83286E, RX_ER is a separate pin (not an LED pin like DP83869E). Configuring LED_1 for 10M speed indication. */
ledConfig0.ledNum = ETHPHY_DP83826E_LED1;
ledConfig0.mode = ETHPHY_DP83826E_LED_MODE_SPEED_10BT;
ledConfig1.ledNum = ETHPHY_DP83826E_LED1;
ledConfig1.mode = ETHPHY_DP83826E_LED_MODE_SPEED_10BT;
ETHPHY_command(gEthPhyHandle[CONFIG_ETHPHY0], ETHPHY_CMD_CONFIGURE_LED_SOURCE, (void *)&ledConfig0, sizeof(ledConfig0));
ETHPHY_command(gEthPhyHandle[CONFIG_ETHPHY1], ETHPHY_CMD_CONFIGURE_LED_SOURCE, (void *)&ledConfig1, sizeof(ledConfig1));
/* PHY pin LED_2 as Rx/Tx Activity */
ledConfig0.ledNum = ETHPHY_DP83826E_LED2;
ledConfig0.mode = ETHPHY_DP83826E_LED_MODE_LINK_OK_AND_BLINK_ON_RX_TX;
ledConfig1.ledNum = ETHPHY_DP83826E_LED2;
ledConfig1.mode = ETHPHY_DP83826E_LED_MODE_LINK_OK_AND_BLINK_ON_RX_TX;
ETHPHY_command(gEthPhyHandle[CONFIG_ETHPHY0], ETHPHY_CMD_CONFIGURE_LED_SOURCE, (void *)&ledConfig0, sizeof(ledConfig0));
ETHPHY_command(gEthPhyHandle[CONFIG_ETHPHY1], ETHPHY_CMD_CONFIGURE_LED_SOURCE, (void *)&ledConfig1, sizeof(ledConfig1));
ledBlinkConfig0.rate = ETHPHY_DP83826E_LED_BLINK_RATE_200_MS;
ledBlinkConfig1.rate = ETHPHY_DP83826E_LED_BLINK_RATE_200_MS;
ETHPHY_command(gEthPhyHandle[CONFIG_ETHPHY0], ETHPHY_CMD_CONFIGURE_LED_BLINK_RATE, (void *)&ledBlinkConfig0, sizeof(ledBlinkConfig0));
ETHPHY_command(gEthPhyHandle[CONFIG_ETHPHY1], ETHPHY_CMD_CONFIGURE_LED_BLINK_RATE, (void *)&ledBlinkConfig1, sizeof(ledBlinkConfig1));
/* Enable fast link drop detection for EtherCAT
* Bit3: Drop the link based on RX Error count of the MII interface, when a predefined number
* of 32 RX Error occurrences in a 10us interval is reached, the link will be dropped
* Bit0(not enabled by following lines): Drop the link based on Signal/Energy loss indication,
* when the Energy detector indicates Energy Loss, the link will be dropped. Typical reaction
* time is 10us. If it needs to be enabled, set fastLinkDownDetConfig.mode as
* (ETHPHY_DP83869_FAST_LINKDOWN_MODE_ENERGY_LOST | ETHPHY_DP83869_FAST_LINKDOWN_MODE_RX_ERR)
*/
fastLinkDownDetConfig0.mode = ETHPHY_DP83826E_FAST_LINKDOWN_MODE_RX_ERR;
fastLinkDownDetConfig1.mode = ETHPHY_DP83826E_FAST_LINKDOWN_MODE_RX_ERR;
ETHPHY_command(gEthPhyHandle[CONFIG_ETHPHY0], ETHPHY_CMD_ENABLE_FAST_LINK_DOWN_DETECTION, (void *)&fastLinkDownDetConfig0, sizeof(fastLinkDownDetConfig0));
ETHPHY_command(gEthPhyHandle[CONFIG_ETHPHY1], ETHPHY_CMD_ENABLE_FAST_LINK_DOWN_DETECTION, (void *)&fastLinkDownDetConfig1, sizeof(fastLinkDownDetConfig1));
if(enhancedlink_enable == 0)
{
MDIO_enableLinkInterrupt(mdioBaseAddress, 0, phy0addr, MDIO_LINKSEL_MDIO_MODE);
MDIO_enableLinkInterrupt(mdioBaseAddress, 1, phy1addr, MDIO_LINKSEL_MDIO_MODE);
}
else
{
MDIO_enableLinkInterrupt(mdioBaseAddress, 0, phy0addr, MDIO_LINKSEL_MLINK_MODE);
MDIO_enableLinkInterrupt(mdioBaseAddress, 1, phy1addr, MDIO_LINKSEL_MLINK_MODE);
}
/* Enable MII mode for DP83869 PHY */
/* Operation mode of DP83826E is MII mode */
//ETHPHY_command(gEthPhyHandle[CONFIG_ETHPHY0], ETHPHY_CMD_ENABLE_MII, NULL, 0);
/* Disable 1G advertisement and sof-reset to restart auto-negotiation in case 1G link was establised */
/* But DP83826E is not use 1G by default */
//ETHPHY_command(gEthPhyHandle[CONFIG_ETHPHY0], ETHPHY_CMD_DISABLE_1000M_ADVERTISEMENT, NULL, 0);
//ETHPHY_command(gEthPhyHandle[CONFIG_ETHPHY0], ETHPHY_CMD_SOFT_RESTART, NULL, 0);
}
下面是 EtherCAT 器件电路图。

[图4 DP83826E]

[图5 Phy0、Phy1 Strap ]
|
SMI 地址 |
串1 | 串2 | 串3 | 串4 | 串6 | |
| Phy0 | 0x00 | 上拉 | 不连接 | 不连接 | 不连接 | 上拉 |
| Phy1 | 0x01 | 普利普 | 上拉 | 不连接 | 不连接 | 上拉 |
[表1 DP83826的自举配置]

[图6磁性元件和接头]
我的错是什么? 您能帮我解决这个问题吗?


