Hi,
I want to modify Ethenet LED behavior by calling "EMACPHYExtendedWrite". My program is based on Tcp_echo example on EK-TM4C1294XL evaluation board. My modification is:
Add code line "EMACPHYExtendedWrite(EMAC0_BASE, 0, 0x25, 0x0111)" before "EMAC_init()" in function "EK_TM4C1294XL_initEMAC", so the function is now like this:
void EK_TM4C1294XL_initEMAC(void)
{
uint32_t ulUser0, ulUser1;
/* Get the MAC address */
FlashUserGet(&ulUser0, &ulUser1);
if ((ulUser0 != 0xffffffff) && (ulUser1 != 0xffffffff)) {
System_printf("Using MAC address in flash\n");
/*
* Convert the 24/24 split MAC address from NV ram into a 32/16 split MAC
* address needed to program the hardware registers, then program the MAC
* address into the Ethernet Controller registers.
*/
macAddress[0] = ((ulUser0 >> 0) & 0xff);
macAddress[1] = ((ulUser0 >> 8) & 0xff);
macAddress[2] = ((ulUser0 >> 16) & 0xff);
macAddress[3] = ((ulUser1 >> 0) & 0xff);
macAddress[4] = ((ulUser1 >> 8) & 0xff);
macAddress[5] = ((ulUser1 >> 16) & 0xff);
}
else if (macAddress[0] == 0xff && macAddress[1] == 0xff &&
macAddress[2] == 0xff && macAddress[3] == 0xff &&
macAddress[4] == 0xff && macAddress[5] == 0xff) {
System_abort("Change the macAddress variable to match your boards MAC sticker");
}
GPIOPinConfigure(GPIO_PF0_EN0LED0); /* EK_TM4C1294XL_USR_D3 */
GPIOPinConfigure(GPIO_PF4_EN0LED1); /* EK_TM4C1294XL_USR_D4 */
GPIOPinTypeEthernetLED(GPIO_PORTF_BASE, GPIO_PIN_0 | GPIO_PIN_4);
EMACPHYExtendedWrite(EMAC0_BASE, 0, 0x25, 0x0111); //line added. 0x25 is for LED_CFG
/* Once EMAC_init is called, EMAC_config cannot be changed */
EMAC_init();
}
It seems that an interrupt is trigger when the following code is executed in function "EMACPHYWrite", which is called by "EMACPHYExtendedWrite":
while(HWREG(ui32Base + EMAC_O_MIIADDR) & EMAC_MIIADDR_MIIB)
{
}
The following interrupt ISR is called :
ti_sysbios_family_arm_m3_Hwi_excHandlerAsm__I:
.asmfunc
tst lr, #4 ; context on PSP?
ite NE
mrsne r0, psp ; if yes, then use PSP
moveq r0, sp ; else use MSP
mov sp, r0 ; use this stack
stmfd sp!, {r4-r11} ; save r4-r11 while we're at it
mov r0, sp ; pass sp to exception handler
mov r1, lr ; pass lr too
ldr pc, excHandlerAddr
excHandlerAddr:
.word ti_sysbios_family_arm_m3_Hwi_excHandler__I
.endasmfunc
.end
It seems to be a hard fault.
Doesn't anybody know why? Thanks very much.