Other Parts Discussed in Thread: AM2434
I am working with mcu_plus_sdk_am243x_08_02_00_31 and I would like to run the LwIP CPSW example on our custom board based on AM2434.
I found that the register ENET1_CTRL (0x43004044) is always set to 2, that means RGMII mode.
Anyway, we have a PHY working in RMII mode and we expect the SoC being configured in the same mode.
Here is how I have changed the ethernet initialization code in test_enet.c
/* Setup board for requested Ethernet port */ ethPort.enetType = ENET_CPSW_2G; /*! CPSW_2G: 1 host port + 1 MAC port */ ethPort.instId = 0U; ethPort.macPort = macPort; //ethPort.boardId = ENETBOARD_AM64X_AM243X_EVM; ethPort.mii.layerType = ENET_MAC_LAYER_MII; ethPort.mii.sublayerType = ENET_MAC_SUBLAYER_REDUCED; ethPort.mii.variantType = ENET_MAC_VARIANT_NONE;
At function EnetBoard_setupPorts(ðPort, 1U) there is a check if the SoC port is configured in the same way as desired and it fails in CpswMacPort_open (line 466)
/* Save peripheral info to use it later to query SoC parameters */ hPort->enetType = enetType; hPort->instId = instId; /* Check if SoC settings (if any) matches the requested MII config */ status = CpswMacPort_checkSocCfg(enetType, instId, macPort, mii); ENETTRACE_ERR_IF(status != ENET_SOK, "MAC %u: MII mismatch with SoC settings\n", portId);
The point where the register ENET1_CTRL (0x43004044) should be configured is at source/networking/enet/utils/V3/enet_appboardutils.c
static void EnetBoard_setMcuEnetControl(uint32_t modeSel) { CSL_main_ctrl_mmr_cfg0Regs *mcuRegs; EnetAppUtils_MmrLockState prevLockState; mcuRegs = (CSL_main_ctrl_mmr_cfg0Regs *)(uintptr_t)CSL_CTRL_MMR0_CFG0_BASE; prevLockState = EnetAppUtils_mcuMmrCtrl(ENETAPPUTILS_MMR_LOCK1, ENETAPPUTILS_UNLOCK_MMR); CSL_REG32_FINS(&mcuRegs->ENET1_CTRL, MAIN_CTRL_MMR_CFG0_ENET1_CTRL_PORT_MODE_SEL, modeSel); if (prevLockState == ENETAPPUTILS_LOCK_MMR) { EnetAppUtils_mcuMmrCtrl(ENETAPPUTILS_MMR_LOCK1, ENETAPPUTILS_LOCK_MMR); } } void EnetBoard_setEnetControl(Enet_Type enetType, uint32_t instId, Enet_MacPort portNum, uint32_t modeSel) { EnetAppUtils_assert(portNum == ENET_MAC_PORT_1); EnetAppUtils_assert(enetType == ENET_CPSW_3G); EnetAppUtils_assert(((modeSel == RMII) || (modeSel == RGMII))); EnetBoard_setMcuEnetControl(modeSel); }
Anyway the execution never reaches such point because in source/networking/enet/utils/V3/enet_board_cfg.c the definition of EnetBoard_setEnetControl is overwritten !!
int32_t EnetBoard_setupPorts(EnetBoard_EthPort *ethPorts, uint32_t numEthPorts) { uint32_t i; /* Nothing else to do */ for (i = 0U; i < numEthPorts; i++) { EnetBoard_EthPort *ethPort = ðPorts[i]; /* Override the ENET control set by board lib */ EnetBoard_setEnetControl(ethPort->enetType, ethPort->macPort, ðPort->mii); } return ENET_SOK; } //Board_STATUS Board_unlockMMR(void); static void EnetBoard_setEnetControl(Enet_Type enetType, Enet_MacPort macPort, EnetMacPort_Interface *mii) { uint32_t modeSel = 0U; int32_t status = ENET_SOK; ....
Is it possible to configure register ENET1_CTRL (0x43004044) in the proper way in order to use RMII mode ?
May be with EnetBoard_setMcuEnetControl in source/networking/enet/utils/V3/enet_appboardutils.c ?
Looking forward
Andrea