Skip to content

Needs to support more Ethernet PHY chips #454

@wdx04

Description

@wdx04

Hi,

I recently updated to the latest version of Mbed CE.

Unfortunately, I found the Ethernet interface on many of my custom STM32 boards refused to work. After some debugging I found it was blocked by the strict PHY ID checking in GenericEthPhy.cpp. Currently, LAN8742 is the default and only supported PHY in PhyDrivers.cpp. But my custom boards usually have LAN8720 or DP83848 PHY chips on them. If I comment out the code checking the PHY ID, then the Ethernet interface will continue to work.

As far as I know, LAN87xx and DP83848 are almost idential in software, except DP83848's PHY address is 1, while LAN87xx uses PHY address 0. In the past, I only need to override the "stm32-emac.eth-phy-address" in the mbed_app.json5 to make them work.

According to CompositeEMAC.md, the recommened way to support another Ethernet PHY is to derive a class from GenericEthPhy and override the get_eth_phy_driver function. The problem is where should I place the code. If I place the code at the custom target level, then the custom target library would have to link with the mbed-emac library. If I place the code at application level, then I have to copy/paste it into every existing applications that uses the Ethernet interface. Neither way feels good. It would be nice to have an option to bypass the PHY ID checking, to minimize the impact on existing applications. Alternatively, can we add support for more commonly-used Ethernet PHY chips out of box?

Thanks,

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions