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.

MCU-PLUS-SDK-AM243X: How to read/write/modify Ethernet PHY registers of DP83869

Part Number: MCU-PLUS-SDK-AM243X
Other Parts Discussed in Thread: DP83869

Tool/software:

Hello TI-Team,

maybe a trivial question, but is there any possibility in MCU+ SDK to read/write PHY registers for configuration. I am using a DP83869 on a custom board and want to set the auto negotiation to enabled. I am actually playing around with the simple enet_lwip_cpsw_am243x-evm_r5fss0-0_freertos_ti-arm-clang example.

I came accross the ETHPHY API but I am unsure about how to use this/where to get the necessary configuration from. In a simple test I did the following (which I know looks wrong, but I had no idea how to fill mdioBaseAddress and the attributes correctly). Shouldn't gEthPhyConfigNum and gEthPhyConfig be somewhere auto-generated?

ETHPHY_Config gEthPhyConfig[1];
uint32_t gEthPhyConfigNum = sizeof(gEthPhyConfig) / sizeof(ETHPHY_Config);

void debug()
{
    static ETHPHY_Params params;
    static ETHPHY_Attrs attributes;
    attributes.mdioBaseAddress = 0;
    attributes.phyAddress = 0;

    gEthPhyConfig->fxns = &gEthPhyFxns_DP83869;
    gEthPhyConfig->attrs = &attributes;

    ETHPHY_Handle handle = ETHPHY_open(CONFIG_ENET_CPSW0, &params);
    uint32_t value = ETHPHY_SPEED_DUPLEX_CONFIG_AUTONEG;
    int32_t status = ETHPHY_command(handle, ETHPHY_CMD_SET_SPEED_AND_DUPLEX_CONFIG, (void *)&value, sizeof(value));
}

How can I successfully use ETHPHY_command? Is there any other possibility to read/write PHY registers easily? I stumbled accross EnetPhy_writeReg also, but I do not know how to propagate/extract a EnetPhy_Handle correctly up to user application.

Thanks a lot for any hint!