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.
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, ¶ms);
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!
Hi Dominik Fischer,
Thanks for your query.
I will check oin this and get back to you.
Regards
Ashwani
Hi Dominik Fischer ,
I was on vacation last week.
So could not check on this.
Will get back to you by next week.
Regards
Ashwani
Hi Dominik Fischer ,
Thanks for having patience for such a long time.
I came accross the ETHPHY API but I am unsure about how to use this/where to get the necessary configuration from.
Can you refer below APIs instead of this and let me know if you need further help?
Regards
Ashwani
Hi Ashwani,
I currently moved to other topics and still was not able to test your suggestion, hopefully I get back to you next week.
Thanks and Kind regards,
Dominik
Thanks Dominik for update.
Waiting for your test results.
Regards
Ashwani
Hi Ashwani,
I tried to get it running, but I am still not fully understanding how I could use this API in my application. I started again with the enet_lwip_cpsw_am243x-evm_r5fss0-0_freertos_ti-arm-clang example.
- I need access to EnetPhy_Handle for all API-functions mentioned here: https://software-dl.ti.com/mcu-plus-sdk/esd/AM64X/10_00_00_20/exports/docs/api_guide_am64x/group__DRV__ENETPHY.html
- EnetPhy_Handle seems to be filled in EnetPhy_open(...)
- this is all done automatically when EnetApp_driverOpen(...) is executed
- the EnetPhy_Handle seems to be stored in Cpsw_Handle, which is a reinterpreted EnetPer_Handle
- EnetPer_Handle finally is found in the gEnetAppSysCfgObj autogenerated by syscfg in ti_enet_open_close.c
The problem is this is a static variable in a autogenerated file, but I have no funciton for accessing the gEnetAppSysCfgObj and therefore to access the EnetPhy_Handle, which is stored somewhere inside there.
Could you please clarify how this can be used in normal user applications e.g. integrating in test_enet.c of example?How can/should I access EnetPhy_Handle?
Am I approaching this incorrectly?
Maybe you have a short standalone example how to use this? Maybe I lack some understanding of TI Ethernet driver...
Thanks!
Hi Dominik Fischer,
Can you look for typedef struct EnetPhy_Obj_s in "\mcu_plus_sdk_am243x_10_00_00_20\source\"
/*!
* \brief PHY driver object handle.
*
* PHY driver opaque handle used to call any PHY related APIs.
*/
typedef struct EnetPhy_Obj_s *EnetPhy_Handle;
Regards
Ashwani
Sure I can take a look at the struct, but this doesn't really help me. I think filling this manually is not the solution as it needs to be done by driver? I do not know how to fill all those properties correctly. That's why I wanted to use the already existing valid handle filled and configured from the driver.
typedef struct EnetPhy_Obj_s { /*! MDIO handle used to access PHY registers */ EnetPhy_MdioHandle hMdio; /*! PHY configuration params */ EnetPhy_Cfg phyCfg; /*! MII interface type */ EnetPhy_Mii mii; /*! MAC port supported capabilities */ uint32_t macCaps; /*! Port Link configuration (speed, duplexity) */ EnetPhy_LinkCfg linkCfg; /*! State-machine timeout configuration */ EnetPhy_FsmTimeoutCfg timeoutCfg; /*! State-machine state */ EnetPhy_State state; /*! PHY group */ uint32_t group; /*! PHY device address */ uint32_t addr; /*! Requested link capability mask */ uint32_t reqLinkCaps; /*! PHY driver */ EnetPhyDrv_Handle hDrv; /*! Magic number indicating that this object is in use */ EnetPhy_Magic magic; /*! Caller-provided arguments to be used in MDIO driver calls */ void *mdioArgs; } EnetPhy_Obj;
I am using a DP83869 on a custom board
I am looking into this with assumption that you are referring below documentation?
AM64x MCU+ SDK: Ethernet PHY Link Configuration
May I know, why do you want to change PHY settings from application ?
Regards
Ashwani
Hi Ashwani,
Yes, I provided a `enet_cutom_board_config.c` file.
The reason is simple, as I had this issues with 1Gbps connection my intention was to set it fixed to 100 Mbps as temporary workaround.
e2e.ti.com/.../mcu-plus-sdk-am243x-lwip-cpsw-example-not-working-for-1-gbps-connection
The reason is simple, as I had this issues with 1Gbps connection my intention was to set it fixed to 100 Mbps as temporary workaround
I will check on this and get back to you.
Regards
Ashwani