AnsweredAssumed Answered

Ethernet phy register access K64F KSZ8081RNBIA

Question asked by aes_mike on Apr 20, 2016
Latest reply on Apr 24, 2016 by XiangJun Rong

I have a K64F connected to a KSZ8081RNBIA Ethernet phy.  I want to read/write the configuration registers within the Ethernet phy part.   There is an external 1K pull up on the MDIO.  I had this working at one time but now it is not working, or maybe in the past it just happen to work.  Anyway, when I call the PHY_DRV_Autodiscover() it crashes and goes to the DefaultISR in startup_MK64F12.S when it is in the ENET_HAL_GetStatus() function (see attached image).  I just don't know what might be the cause of it. 


// Note: FSL_ENET1 is zero (0) and ENET_BASE_PTR is defined in MK64F12.h.

uint32_t       phy_address;

enet_status_t  status;

//ENET_HAL_Init( ENET_BASE_PTR );  <-- crashes with this too

//ENET_HAL_Enable( ENET_BASE_PTR ); <-- crashes with this as well

status = PHY_DRV_Autodiscover( FSL_ENET1, &phy_address );


The PHY_DRV_Autodiscover() function comes from the  "fsl_phy_driver.c"  which is from the

C:\Freescale\KSDK_1.2.0\middleware\tcpip\rtcs\source\port\phyksz8081 folder.  I copied over the header file to my project as well.


The project is a KSDK 1.2.0 along with processor expert.  KDS 3.0.0.

The project includes the eNet1:fsl_enet module, see attached image for all PE modules in the project.


The function init_enet_pins() is run during hardware_init().   See init_enet_pins() function below.


There is also a 1K pull up on the MDIO pin.


I tried initializing ENET (lines commented out above), but it just crashes earlier (i.e. tried using functions ENET_HAL_Init() and ENET_HAL_Enable() and both of them cause the exact same crash situation).


If I use the example demo project "shell_frdmk64f" (KSDK 1.3.0), the board network communications work great which leads me to believe it is not a hardware, but more like a software config sort of issue, but not sure what it might be. 


What am I missing?  Any suggestions?

Thank you.


void init_enet_pins(uint32_t instance)


  /* Affects PORTB_PCR1 register */


  /* Affects PORTB_PCR0 register */





  /* Affects PORTA_PCR13 register */


  /* Affects PORTA_PCR12 register */


  /* Affects PORTA_PCR14 register */


  /* Affects PORTA_PCR5 register */


  /* Affects PORTA_PCR16 register */


  /* Affects PORTA_PCR17 register */


  /* Affects PORTA_PCR15 register */


  /* Affects PORTA_PCR18 register */