atmel-software-package icon indicating copy to clipboard operation
atmel-software-package copied to clipboard

KSZ9031 PHY ID read

Open Shreenivasa opened this issue 1 year ago • 0 comments

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?

Shreenivasa avatar Nov 13 '23 06:11 Shreenivasa