This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TM4C129x Ethernet PREPHY Register

Other Parts Discussed in Thread: EK-TM4C1294XL

Hi,Everyone

I need your help.
I use EK-TM4C1294XL.

My program sometimes stop this while statement

    /*Ethernet MAC Initialization*/
    SYSCTL_RCGCEMAC_R |= 0x01;     //clock enable
    SYSCTL_SREMAC_R  |= 0x01;     //software reset
    while (1 == (0x01 & SYSCTL_PREMAC_R));  //wait until reset
    SYSCTL_SREMAC_R &= ~0x01;     //software reset off
    while (0 == (0x01 & SYSCTL_PREMAC_R));  //wait until access ready

    /*Ethernet PHY Initialization*/
    SYSCTL_RCGCEPHY_R |= 0x01;
    SYSCTL_SREPHY_R |= 0x01;
    while (1 == (0x01 & SYSCTL_PREPHY_R));
    SYSCTL_SREPHY_R &= ~0x01;
    while (0 == (0x01 & SYSCTL_PREPHY_R));  ← sometimes Stop this while statement

Actually I made sure attached Project file.
This program has S/W Reset after these program.

blinky_PHY.zip

Always PC go through this while statement.
But sometimes PC stop here.

Datasheet says

============
The PREPHY register indicates whether the Ethernet PHY module is ready to be accessed by
software following a change in status of power, Run mode clocking, or reset. A power change is
initiated if the corresponding PCEPHY bit is changed from 0 to 1. A Run mode clocking change is
initiated if the corresponding RCGCEPHY bit is changed. A reset change is initiated if the
corresponding SREPHY bit is changed from 0 to 1.
============

Do you know why this stop is occur ?

Best Regards
Hiroyasu

  • Hello Hiroyasu,

    During the process of Ethernet initialization the Flash prefetch must be switched OFF. This is mentioned in the errata. Have you done the same in your code?

    Regards
    Amit
  • Hi, Amit

    Thnak you for your reply.
    I already saw errata and blinky_PHY project include Flash prefetch OFF
    before Ethernet MAC initialization like this.

    FLASH_CONF_R |= FLASH_CONF_FPFOFF;   //

    but I do not understand when Tiva should do Flash prefetch OFF.
    Eratta just says

    Before Ethernet Initialization the Flash Prefetch must be turned OFF by writing 1 to
    FLASHCONF.FPFOFF.

    Errata says before MACinitialization ? or PHY initialization?

    and I saw Tivaware.
    but Tivaware does not include this workaround.

    Best Regards
    Hiroyasu

  • Hello Hiroyasu,

    Before the initialization till the Link status is not received. And this has to be done in the application and not in TivaWare.

    Regards
    Amit
  • Hi,Amit

    O.K.I understand we should do Flash prefetch OFF before
    Ethernet MAC and PHY initialization.

    Program I made include this workaround.
    but PREPHY bit sometimes is not set.
    Do you know why this probrem occur?

    Best Regards
    Hiroyasu

  • Hello Hiroyasu,

    Can you check if the Main Oscillator is already stabilized before the EPHY is powered up? A simple method would be to use the MOSC as the system clock and enable the DIVSCLK pin and get the system clock divided by 1000 to see if the Pin shows 25KHz?

    Regards
    Amit