Skip to content

KSZ9031 PHY ID read #120

@Shreenivasa

Description

@Shreenivasa

Hello,

I am trying the read the PHY ID number and model number.
Here are the commands I am passing to PHY to get the response.

id=MDIO_read(phyAddr, 0x02);
model=MDIO_read(phyAddr, 0x03);

read config -
uint16 MDIO_read(uint8_t phy_addr, uint8_t reg_addr)
{
while (0 != ETHERNET_0_MAC_MDIO_ADDRESS.bits.GB);
ETHERNET_0_MAC_MDIO_DATA.bits.RA = reg_addr ;
ETHERNET_0_MAC_MDIO_DATA.bits.GD = 0;
ETHERNET_0_MAC_MDIO_ADDRESS.bits.PA = phy_addr;
ETHERNET_0_MAC_MDIO_ADDRESS.bits.RDA = reg_addr;
ETHERNET_0_MAC_MDIO_ADDRESS.bits.PSE = 1;
ETHERNET_0_MAC_MDIO_ADDRESS.bits.BTB = 0;
ETHERNET_0_MAC_MDIO_ADDRESS.bits.NTC = 0;
ETHERNET_0_MAC_MDIO_ADDRESS.bits.CR = 0x0;
ETHERNET_0_MAC_MDIO_ADDRESS.bits.SKAP = 0;
ETHERNET_0_MAC_MDIO_ADDRESS.bits.C45E = 1;
ETHERNET_0_MAC_MDIO_ADDRESS.bits.GOC = 3;
ETHERNET_0_MAC_MDIO_ADDRESS.bits.GB = 1;
while (0 !=ETHERNET_0_MAC_MDIO_ADDRESS.bits.GB);
return (ETHERNET_0_MAC_MDIO_DATA.bits.GD);
}

But it is not responding. MDIOs GD filed fills with 0x0000 only.
So, Are those above configurations are correct? Or any other initialization needs to be carried out before reading the IDs or model numbers?

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