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.
Tool/software: TI-RTOS
Hi all,
The dartasheet shows : Register100:EthernetPHYLEDConfiguration-MR37(EPHYLEDCFG),address 0x025.
The default value of the register is : reset 0x0510.But I want to modify the defalut value to something else.My code as below:
uint16_t value; GPIOPinConfigure(GPIO_PF4_EN0LED1); /* EK_TM4C129EXL_USR_D4 */ GPIOPinTypeEthernetLED(GPIO_PORTF_BASE, GPIO_PIN_4); SysCtlPeripheralEnable(SYSCTL_PERIPH_EMAC0); SysCtlPeripheralEnable(SYSCTL_PERIPH_EPHY0); EMACPHYWrite (EMAC0_BASE, 0, EPHY_LEDCFG, 0x0080); //set LED1 Configuration : Link OK/Blink on TX/RX Activity(0x8) value = EMACPHYRead(EMAC0_BASE, 0, EPHY_LEDCFG); //read LED1 Configuration : is Link OK/Blink on TX/RX Activity(0x8) ?
I try to add this code before the EMAC_init() in the EK_TM4C129EXL.c file,but the value read is not as I set.Then I add this code in the int EMACSnow_emacStart(struct NETIF_DEVICE* ptr_net_device) function and put it after those sentances:
/* Configure and enable the link status change interrupt in the PHY. */ value = EMACPHYRead(EMAC0_BASE, PHY_PHYS_ADDR, EPHY_SCR); value |= (EPHY_SCR_INTEN_EXT | EPHY_SCR_INTOE_EXT); EMACPHYWrite(EMAC0_BASE, PHY_PHYS_ADDR, EPHY_SCR, value); EMACPHYWrite(EMAC0_BASE, PHY_PHYS_ADDR, EPHY_MISR1, (EPHY_MISR1_LINKSTATEN | EPHY_MISR1_SPEEDEN | EPHY_MISR1_DUPLEXMEN | EPHY_MISR1_ANCEN));
The result failed as before.
I also try to change EMACPHYWrite() and
Hello Nancy,
I edited your post to make your code easier to read - please use the Syntax highlight feature for code blocks and bold function names that are outside of code in the future (syntax highlighter can be reached via Rich Formatting and looking for the "</>" box). The light blue text isn't easy on the eyes though I do appreciate you trying to separate code from text! :)
As far as the issue you are observing goes, can you please try with EMACPHYExtendedRead and EMACPHYExtendedWrite? Those are the API's that should be used for the LED configuration.
Hi Ralph,
Thanks a lot! Please take a small look at my post,you will see the last sentance has missed.My quote is : I also try to change EMACPHYWrite() and EMACPHYRead() to EMACPHYExtendedRead() and EMACPHYExtendedWrite().Because I have broused some similar posts in the E2E community.Do you have a Evaluation Kit - EK-TM4C129EXL at hand?Please do the test and you will find the error result as I mentioned.More worse, I have suceeded in modifying the EPHYLEDCFG as I set, but the next time when I re-debug the project, the led configuration I set is not as I set.And the LED1 doesn't take action as the Configuration :0x8L ink OK/Blink on TX/RX Activity.
Hi Ralph,
I'm still setting the configuration for the LED's before the EMAC_init.And I didn't succeed in modifying the EPHYLEDCFG register.I still need the proper way to modify the LED's configuration.Could you give me some suggestions?
Tool/software: TI-RTOS
Hi all,
In my recent project, I only have one Ethernet PHYLED (LED1) for indicating the Ethernet link status.So I need to set LED1 to Link OK/Blink on TX/RX Activity (0x8) in EPHYLEDCFG register.I add my code before the EMAC_init() in the void EK_TM4C129EXL_initEMAC(void)() function.Here is:
GPIOPinConfigure(GPIO_PF4_EN0LED1); /* EK_TM4C129EXL_USR_D4 */
GPIOPinTypeEthernetLED(GPIO_PORTF_BASE, GPIO_PIN_4); //GPIO_PIN_0 |
SysCtlPeripheralEnable(SYSCTL_PERIPH_EMAC0);
SysCtlPeripheralEnable(SYSCTL_PERIPH_EPHY0);
while (!SysCtlPeripheralReady(SYSCTL_PERIPH_EPHY0) || !SysCtlPeripheralReady(SYSCTL_PERIPH_EMAC0)){}
EMACPHYExtendedWrite(EMAC0_BASE, 0, EPHY_LEDCFG, 0x0580); //set LED1 Configuration : Link OK/Blink on TX/RX Activity(0x8)
value = EMACPHYExtendedRead(EMAC0_BASE, 0, EPHY_LEDCFG);
/* Once EMAC_init is called, EMAC_config cannot be changed */
EMAC_init();
I can read the configuration value from the EMACPHYExtendedRead(EMAC0_BASE, 0, EPHY_LEDCFG)() and the value is 0x0580 just as I set.But the LED1 dosen't act Link OK/Blink on TX/RX Activity (0x8) and it act as the defalut value (RX/TX Activity (0x1)).Besides, I once used EMACPHYRead() and EMACPHYWrite(), I can not change the PHYLED Configuration.I brouse the E2E community, I try to change the functions to EMACPHYExtendedRead() and EMACPHYExtendedWrite().The PHYLED Configuration can be set, so I post the later code above in my post.
Where and how to modify the Ethernet PHYLED Configuration on chip of TM4C1294NCPDT?
Hello Nancy,
I was able to test LED configurations using the enet_io example and I confirmed that you do need to set the LED's after the Init and other Configurations. I tested both with the LED's before the Init setup and after. When before, it defaulted to the normal LEDs, but after, it used the new settings I provided. Again you need to use ExtendedWrite/Read to accomplish this.
Hi Ralph,
Thanks a lot!
I post another topic because I think I didn't articulate my question.I use Ti-RTOS for my project.I emphasized it in Tool/software and the code I stuck is the function void EK_TM4C129EXL_initEMAC(void)() in classic Ti-RTOS ethernet examples,like tcpEcho_EK_TM4C129EXL_TI_TivaTM4C129ENCPDT and so on.You use the enet_io example which is the Tivaware example which is different from my example and there is no doubt that you think my result is not as you tested.My result : the LEDs Configuration can be changed to the value I set in the register EPHYLEDCFG,but the Leds act as the default value 0x510.I test in the Ti Evaluation Kit - EK-TM4C129EXL.
Also,I used the EMACPHYExtendedWrite() and EMACPHYExtendedRead() becuase when I have any question about ti-chips I will brouse the E2E community to search any possible or relative posts beforing mmy own posts.You can also reply my another copy-post.
Hi Nancy,
I tried to make similar changes with the TI-RTOS example but had no luck either. I will see about pulling in an RTOS expert to help from here now that what DriverLib API's are needed are clear. I'm not sure how to integrate them into the RTOS example myself. My attempts to do so rendered the program inoperable.
I am going to post a code snippet from the TivaWare example which I got working properly below so the RTOS team has that as a point of reference for what works:
// // Configure for use with whichever PHY the user requires. // EMACPHYConfigSet(EMAC0_BASE, EMAC_PHY_CONFIG); // // Initialize the MAC and set the DMA mode. // MAP_EMACInit(EMAC0_BASE, ui32SysClkHz, EMAC_BCONFIG_MIXED_BURST | EMAC_BCONFIG_PRIORITY_FIXED, 4, 4, 0); // // Set MAC configuration options. // MAP_EMACConfigSet(EMAC0_BASE, (EMAC_CONFIG_FULL_DUPLEX | EMAC_CONFIG_CHECKSUM_OFFLOAD | EMAC_CONFIG_7BYTE_PREAMBLE | EMAC_CONFIG_IF_GAP_96BITS | EMAC_CONFIG_USE_MACADDR0 | EMAC_CONFIG_SA_FROM_DESCRIPTOR | EMAC_CONFIG_BO_LIMIT_1024), (EMAC_MODE_RX_STORE_FORWARD | EMAC_MODE_TX_STORE_FORWARD | EMAC_MODE_TX_THRESHOLD_64_BYTES | EMAC_MODE_RX_THRESHOLD_64_BYTES), 0); // // Program the hardware with its MAC address (for filtering). // MAP_EMACAddrSet(EMAC0_BASE, 0, (uint8_t *)pui8MAC); EMACPHYExtendedWrite(EMAC0_BASE, 0, EPHY_LEDCFG, 0x0588); //set LED1 Configuration : Link OK/Blink on TX/RX Activity(0x8)
Nancy,
I added the C:\ti\tirtos_tivac_2_16_01_14\products\tidrivers_tivac_2_16_01_13\packages\ti\drivers\emac\EMACSnow.c file into the TCP Echo project and then added the bolded line into EMACSnow_NIMUInit().
EMACAddrSet(EMAC0_BASE, 0, (uint8_t *)device->mac_address);
EMACPHYExtendedWrite(EMAC0_BASE, 0, EPHY_LEDCFG, 0x0588);
/* Initialize the DMA descriptors. */
EMACSnow_InitDMADescriptors();
I built and ran the example. I know see both green D3 and D4 LEDs flashing to denote activity on the EK-TM4C1294XL LaunchPad. Is this what you wanted to do?
Todd