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.
Not sure if this is *really* necessary, but the routines fec_mii_write and fec_mii_read are always used like this in NicheLite:
while(!(fec_mii_write( FEC_PHY0, PHY_REG_ANAR,mymwdata)));
...which might mean they may not succeed from the first time.
Hi Marc,
Thanks for replying. The code I am talking about is actually within the fec _mii_write andfec_mii_read routines itself. The PHY initialization code that calls these routines was returning a "fail" and the PHY was not getting initialized , therefor I decided to step through the code and check whether everything within the routines themselves is working properly. Inside these routines, the registers like Ethernet Interrupt Event Register (FEC_MII_EIR), Interrupt mask Register (GEC_MII_EIMR) and the MII Management Frame Register (FEC_MII_MMFR) are assigned certain values for the read or write to happen correctly. I wanted to check if these values are getting assigned correctly or not. The only way I could think is include a printf statement after the assignment and set a breakpoint so that I can see the register value. Is there a better way to check these register values ?