Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Read from PHY register KSZ9031 #21

Open
Shreenivasa opened this issue Nov 13, 2023 · 0 comments
Open

Read from PHY register KSZ9031 #21

Shreenivasa opened this issue Nov 13, 2023 · 0 comments

Comments

@Shreenivasa
Copy link

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant