[Resolve] MAC_MII_DATA always read as 0

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

[Resolve] MAC_MII_DATA always read as 0

270 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by averyanov on Tue Jan 13 08:39:07 MST 2015
I try to read Status Register from PHY chip.
But MAC_MII_DATA contain 0.

I have logic analyzer that connect to MDIO line.  And i see correct data(Attached images)
Code for reading from phy
static int lpc43_phyread(uint16_t phydevaddr, uint16_t phyregaddr, uint16_t *value)
{
  volatile uint32_t timeout;
  uint32_t regval;

  regval  = lpc43_getreg(LPC43_ETH_MACMIIA);
  regval &= ETH_MACMIIA_CR_MASK;

  regval |= (((uint32_t)phydevaddr << ETH_MACMIIA_PA_SHIFT) & ETH_MACMIIA_PA_MASK);
  regval |= (((uint32_t)phyregaddr << ETH_MACMIIA_MR_SHIFT) & ETH_MACMIIA_MR_MASK);
  regval |= ETH_MACMIIA_GB;

  lpc43_putreg(regval, LPC43_ETH_MACMIIA);

  for (timeout = 0; timeout < PHY_READ_TIMEOUT; timeout++)
    {
      if ((lpc43_getreg(LPC43_ETH_MACMIIA) & ETH_MACMIIA_GB) == 0)
        {
          *value = (uint16_t)lpc43_getreg(LPC43_ETH_MACMIID);
          return OK;
        }
    }
}

[img]http://www.lpcware.com/system/files/images/screenshot.thumbnail.png[/img]
Labels (1)
0 Kudos
1 Reply

237 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by averyanov on Tue Jan 13 10:07:07 MST 2015
Resolve.
I forgot correct setup pin config.
0 Kudos