Marc Vandenhende

Important ColdFire Lite for 52259 bug found!

Discussion created by Marc Vandenhende on Feb 25, 2009
Latest reply on Mar 6, 2009 by Marc Vandenhende

I just found an important bug in Coldfire Lite when compiled for the 52259 CPU. This bug will make the board hang during initialisation!

 

The bug is located in MCF52259_sysinit.c , near the end of the function void mcf52259_ePHY_init(void):

 

This is the original version:


while(!(fec_mii_read(FEC_PHY0, 0x10, &reg0))) // read PHY status register
{
  reg0=0;
};
DUPLEX_phy_r17_dpm = (int)((reg0&0x0004)>>2); // 1=full,0=half duplex...used in ifec.c

do  //FSL read PHY status register
{
  fec_mii_read(FEC_PHY0, 0x10, &reg0);
}while (!(reg0&(PHY_R1_LS)));  //FSL exit while loop when Link Status up

 

 

 This is what should be there:


while(!(fec_mii_read(FEC_PHY0, PHY_REG_SR, &reg0))) // read PHY status register
{
  reg0=0;
};
DUPLEX_phy_r17_dpm = (int)((reg0&0x0004)>>2); // 1=full,0=half duplex...used in ifec.c

do  //FSL read PHY status register
{
  fec_mii_read(FEC_PHY0, PHY_REG_SR, &reg0);
}while (!(reg0&(PHY_R1_LS)));  //FSL exit while loop when Link Status up

 

 

The actual value of PHY_REG_SR is 0x01. This means that, in the original version of MCF52259_sysinit.c, the program is reading the wrong register (0x10, which actually corresponds to PHY_REG_IR, the PHY interrupt register).

Message Edited by Marc VDH on 2009-02-25 02:52 PM

Outcomes