I've started writing a communication stack, under FRDM-K64F board.
Currently I'am trying to complete the initialization sequence of the ENET peripheral. So at this point what I'am want to do is to exchange data between my onboard Micrel PHY chip and my controller. To do this I've done the followings:
MDIO init sequence:
-Portb clock enable
-I have properly initialized the PTB0, and PTB1 to function as ALT4.
-I have turned on the pull-up resistors, because those are not populated on the board.
-At this point I dont know if it is neccessary, but I have turned on the Open drain output feature.
/*eth per init*/
-eth clock enable
-The datasheet says MDIO gets its clock by prescaling the internal bus clock. In my case that is 60 MHz by default, so I have choosen 11 as prescaler. (60/((11+1)*2))=2.5
-eth module enable
So far I have not initialized completely the eth peripheral, I just want to check first the MDIO functionality.
I have written a funtion that should exchange data between phy and my controller. The datasheet says that MII interrupt flag marks whenever an MDIO data exchange have been succeeded. In my function this works correctly,
before writing MMFR register this bit is 0, and after some time this bit turns to 1 marking the end of the proccess. But after reading from any phy and register addresses the returned result is always 0xffff data.
In my workspace I've checked the signals of the R55 and R56 pullup resistor pads, and I can clearly see that MDC and MDIO signals not altering at all, staying all the time steady.
I've read the other posts relating to this, but I didn't find solution, so I kindly ask some expert to help me discussing this question!
I think the problem can be related to clock distribution. I dont know if ENET peripheral uses RMII external 50 MHz reference clock.
Or do I have to configure ENET for RMII mode. At this point I think MDIO should be separated from MII, RMII functionality. I dont know.
Thank you for your help in advance!