net11

Writing to PHY registers: NicheLite - mii.c

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

Hi, 

 

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:

MCF_FEC_EIR = MCF_FEC_EIR_MII;

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:

 

MCF_FEC_MMFR = 0 | MCF_FEC_MMFR_ST_01 | MCF_FEC_MMFR_OP_READ | MCF_FEC_MMFR_PA(phy_addr) | MCF_FEC_MMFR_RA(reg_addr) | MCF_FEC_MMFR_TA_10;

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.

Outcomes