Writing to PHY registers: NicheLite - mii.c

Discussion created by net11 on Jun 18, 2010
Latest reply on Jun 21, 2010 by net11



I am working with ethernet drivers for the M5234BCC KIT with a DP83640 PHYTER. The software I am using is Codewarrior v 7.2. I obtained the driver code from an example code provided for this particular board by freescale. The I


I am having trouble working with the media independent interface code (mii.c) from the ethernet driver provided.  I think that the register values for the PHY are either not getting written or not getting read properly. I have stepped through the code and printed out every single variable value onto  the console. The variable values are correct and I have crosschecked it with the MCF5235 Reference Manual. Therefore I think there is no problem with the code. I also think that the code does not have a problem because I have gotten in touch with Freescale support and they have provided me code for my particular board  and the driver is the same as that in the NicheLite stack. 


I used printf statements to check the register values right after the statement where they are assigned a value in the code. The variables show the desired values, but the PHY registers are always showing to 0x00.


For example the following code snippet:


printf("%#04x ", MCF_FEC_EIR); 


shows a value of 0x00 even if MCF_FEC_EIR_MII has been defined as 0x800000


similarly, in another part of the code the MMFR is assigned as follows:



printf("%#04x ", MCF_FEC_MMFR); 


If I check the values on the right hand side individually, they are as expected, but after the assignment, the printf output is 0x00


What might be going wrong ?


I can provide the actual code and values if needed.