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.

Seems as if the PHY to stop working

Other Parts Discussed in Thread: TM4C129ENCPDT

Hi,

 

I'm working with microcontroller TM4C129ENCPDT and my problem is that the interface ethernet after some hours stop responding all commands TCP/IP (including command PING).


I'm using the library "lwip". For initialize this interface (following the examples supplied by Texas), I do:

********************************************************************************************

FlashUserGet(&ui32User0, &ui32User1);
if((ui32User0 != 0xffffffff) && (ui32User1 != 0xffffffff))
{
// 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.
//
pui8MACAddr[0] = ((ui32User0 >> 0) & 0xff);
pui8MACAddr[1] = ((ui32User0 >> 8) & 0xff);
pui8MACAddr[2] = ((ui32User0 >> 16) & 0xff);
pui8MACAddr[3] = ((ui32User1 >> 0) & 0xff);
pui8MACAddr[4] = ((ui32User1 >> 8) & 0xff);
pui8MACAddr[5] = ((ui32User1 >> 16) & 0xff);

lwIPInit(SysClock, pui8MACAddr, 0, 0, 0, IPADDR_USE_AUTOIP);

ROM_IntPrioritySet(INT_EMAC0, ETHERNET_INT_PRIORITY);
ROM_IntPrioritySet(FAULT_SYSTICK, SYSTICK_INT_PRIORITY);
}

***********************************************************************************

After this the microcontroler works well, responding all the commands PING, creating sockets, accepts conexions and recive/send message, etc... But in some hours apparently falls this interface. Externally I can't do even a "PING". Debugging the code  appear that all is normal  (including calls to subroutines  lwIPInterruptTask or lwIPEthernetIntHandler).Seems as if the PHY to stop working....

The config file "lwipopts" that I'm using is:

************************************************************************************

#ifndef __LWIPOPTS_H__
#define __LWIPOPTS_H__

//*****************************************************************************
//
// ---------- Platform specific locking ----------
//
//*****************************************************************************
#define NO_SYS 0
#define SYS_LIGHTWEIGHT_PROT 1

//*****************************************************************************
//
// ---------- Stellaris / lwIP Port Options ----------
//
//*****************************************************************************
#define HOST_TMR_INTERVAL 100
#define DHCP_EXPIRE_TIMER_MSECS (60 * 1000)
#define LWIP_HTTPD_SSI 1
#define LWIP_HTTPD_CGI 1
#define LWIP_HTTPD_DYNAMIC_HEADERS 1
#define EMAC_PHY_CONFIG (EMAC_PHY_TYPE_INTERNAL | EMAC_PHY_INT_MDIX_EN | \
EMAC_PHY_AN_100B_T_FULL_DUPLEX)
#define PHY_PHYS_ADDR 0
#define NUM_TX_DESCRIPTORS 24
#define NUM_RX_DESCRIPTORS 8

//*****************************************************************************
//
// ---------- Memory options ----------
//
//*****************************************************************************
#define MEM_ALIGNMENT 4
#define MEM_SIZE 1600

//*****************************************************************************
//
// ---------- Internal Memory Pool Sizes ----------
//
//*****************************************************************************
#define MEMP_NUM_PBUF 16
#define MEMP_NUM_TCP_PCB 5
#define MEMP_NUM_SYS_TIMEOUT 8
#define PBUF_POOL_SIZE 32

//*****************************************************************************
//
// ---------- IP options ----------
//
//*****************************************************************************
#define IP_REASSEMBLY 0
#define IP_FRAG 0

//*****************************************************************************
//
// ---------- RAW options ----------
//
//*****************************************************************************
#define LWIP_RAW 1
#define RAW_TTL (IP_DEFAULT_TTL)

//*****************************************************************************
//
// ---------- DHCP options ----------
//
//*****************************************************************************
#define LWIP_DHCP 1 

//*****************************************************************************
//
// ---------- AUTOIP options ----------
//
//*****************************************************************************
#define LWIP_AUTOIP 1
#define LWIP_DHCP_AUTOIP_COOP ((LWIP_DHCP) && (LWIP_AUTOIP))
#define LWIP_DHCP_AUTOIP_COOP_TRIES 5

//*****************************************************************************
//
// ---------- TCP options ----------
//
//*****************************************************************************
#define LWIP_TCP 1
#define TCP_TTL (IP_DEFAULT_TTL)
#define TCP_WND 4096
#define TCP_MAXRTX 12
#define TCP_SYNMAXRTX 6
#define TCP_QUEUE_OOSEQ 1
#define TCP_MSS 1500 
#define TCP_CALCULATE_EFF_SEND_MSS 1
#define TCP_SND_BUF (4 * TCP_MSS)
#define TCP_SND_QUEUELEN (4 * (TCP_SND_BUF/TCP_MSS))
#define TCP_SNDLOWAT (TCP_SND_BUF/2)
#define TCP_LISTEN_BACKLOG 0
#define TCP_DEFAULT_LISTEN_BACKLOG 0xff

//*****************************************************************************
//
// ---------- API options ----------
//
//*****************************************************************************
#define LWIP_EVENT_API 0
#define LWIP_CALLBACK_API 1

//*****************************************************************************
//
// ---------- Pbuf options ----------
//
//*****************************************************************************
#define PBUF_LINK_HLEN 16 
#define PBUF_POOL_BUFSIZE 512
// default is LWIP_MEM_ALIGN_SIZE(TCP_MSS+40+PBUF_LINK_HLEN)
#define ETH_PAD_SIZE 0

//*****************************************************************************
//
// ---------- Network Interfaces options ----------
//
//*****************************************************************************
#define LWIP_NETIF_HOSTNAME 0
#define LWIP_NETIF_API 1
#define LWIP_NETIF_STATUS_CALLBACK 1
#define LWIP_NETIF_LINK_CALLBACK 1
#define LWIP_NETIF_HWADDRHINT 0

//*****************************************************************************
//
// ---------- LOOPIF options ----------
//
//*****************************************************************************
#define LWIP_HAVE_LOOPIF 0
#define LWIP_LOOPIF_MULTITHREADING 1

//*****************************************************************************
//
// ---------- Thread options ----------
//
//*****************************************************************************
#define TCPIP_THREAD_NAME "tcpip_thread"
#define TCPIP_THREAD_STACKSIZE 1024
#define TCPIP_THREAD_PRIO 1
#define TCPIP_MBOX_SIZE 100 
#define SLIPIF_THREAD_NAME "slipif_loop"
#define SLIPIF_THREAD_STACKSIZE 1024 
#define SLIPIF_THREAD_PRIO 1
#define PPP_THREAD_NAME "pppMain"
#define PPP_THREAD_STACKSIZE 1024
#define PPP_THREAD_PRIO 1
#define DEFAULT_THREAD_NAME "lwIP"
#define DEFAULT_THREAD_STACKSIZE 1024
#define DEFAULT_THREAD_PRIO 1
#define DEFAULT_RAW_RECVMBOX_SIZE 100
#define DEFAULT_UDP_RECVMBOX_SIZE 100
#define DEFAULT_TCP_RECVMBOX_SIZE 100
#define DEFAULT_ACCEPTMBOX_SIZE 100

//*****************************************************************************
//
// ---------- Sequential layer options ----------
//
//*****************************************************************************
#define LWIP_NETCONN 1 

//*****************************************************************************
//
// ---------- Socket Options ----------
//
//*****************************************************************************
#define LWIP_SOCKET 1 
#define LWIP_COMPAT_SOCKETS 0
#define LWIP_POSIX_SOCKETS_IO_NAMES 0
#define LWIP_TCP_KEEPALIVE 1
#define LWIP_SO_RCVTIMEO 1
#define LWIP_SO_RCVBUF 1
#define RECV_BUFSIZE_DEFAULT 100 
#define SO_REUSE 1

#endif /* __LWIPOPTS_H__ */

*******************************************************************************

Do you have any idea why this interface goes down?

 

Thanks you.

  • Is the rest of the MCU application running normally or have you hit a fault or otherwise gotten the MCU stuck in a state where it cannot respond to the Ethernet?

    When the link is down what is the state of the rest of the MCU?  What other symptom do you see?

  • The rest of the application (foreign to ethernet) work well (MCU don't stop).

    Another symptom is that if I reconfigure the ethernet interface (using lwIPNetworkConfigChange) to DHCP so the router does not assign IP.

    The part of code that corresponds to the management ethernet if I debug does not seem to have any problem, create a socket successfully and wait to listen to a client... If I force to close the socket could initiate the process without an errors...

    The problem is that my device is not externally visible and unresponsive.

    I'm using de library "lwiplib revision 2.1.0.12573" with functions of "sockets.c" module. 

    Are some known problems with this module?

  • Hello Alberto,

    This post may have the solution for the issue.

    http://e2e.ti.com/support/microcontrollers/tiva_arm/f/908/p/331006/1161463.aspx#1161463

    Regards

    Amit

  • Hi Amit,

    I activated the flag that appear in the commentary that you've indicated. But the problem is not resolved. (I've been testing for 2 days).

    Besides the option to force off the prefecth makes me run the slowest my device. And this is a negative point in my development.

    I forgot to indicate that I am using the microprocessor version XM4C129ENCPDTI1. Not is the latest release of silicon.

    Do you know any errata that may directly or indirectly have the effect on the ethernet interface that I'm having?

    Thanks,

  • Hello Alberto

    There is no errata on the Ethernet which would make the device unresponsive as we have tested this for quite long run. I would need to check what could cause such an issue.

    I would take the input on the config file you have sent in your first post. It may take time for me to come back.

    Regards

    Amit

  • Hi Amit,

    I'm analizing this problem and I find a point in the FW where occurs an error.

    This point is in the function "tivaif_receive" in Line 861 of file "tiva-tm4c129.c".
    /* Allocate a new buffer for this descriptor */
    pDescList->pDescriptors[pDescList->ui32Read].pBuf = pbuf_alloc(PBUF_RAW, PBUF_POOL_BUFSIZE, PBUF_POOL);

    On it, the function "pbuf_alloc" return '0'.

    Do you have any idea because this anormal situation don't are restored?

    Thank you.

  • Hello Alberto,

    I haven't seen anything like this. Can you check on normal execute if it returns non-"0" and what happens to the buffer allocation for the Descriptors.

    Regards

    Amit

  • On normal execution this function don't returns '0', returns a direction of memory (a pointer to initial block of allocated memory, I understand).

    Why a descriptor can be broken?

    How I can repair a broken descriptor?

  • Hello Alberto,

    From your description, it seems that lwip is running out of memory. This could be either because the pbuf is not getting freed frequently enough or the amount of memory allocated for pbuf (in 'lwipopts.h' file) is less.

    Can you enable the debug labels like 'MEMP_OVERFLOW_CHECK' in "lwipopts.h" file and monitor the memory usage of pbuf?

    What IP address does the TM4C129ENCPDT device acquire - DHCP or AUTOIP? Is it possible that the ip address is somehow lost after a few hours?

    Sai 

  • Hello Sai,

    About IP adress, In my FW program I'm initializing lwip in mode AUTOIP (lwIPInit(SysClock, pui8MACAddr, 0, 0, 0, IPADDR_USE_AUTOIP)). After this, the user can decide assign a IP using DHCP o STATIC IP. In the FW this reconfiguration of IP adress is made with the function lwIPNetworkConfigChange(xEthParameters.uiIP, xEthParameters.uiMask, xEthParameters.uiGW, xEthParameters.bModo).


    I don't know if the IP adress are losing, but the effect is seems. My device disappears of the net...

    When the problem occurs, I tryed to reconfigure the IP adress using the function lwIPNetworkConfigChange, but if I put mode DHCP the router don't return an IP adress or if I put a STATIC IP adress neither respond even a PING.
    ¿How I detect if the IP adress is lost? and ¿How I repair this situation and restore the IP adress?

    Exist any problem with mode AUTOIP?

  • How did this story end? Did you find a solution?

    Regards,
    Daniel

  • Daniel,

    I believe this forum post should address the issue.

    Thanks,
    Sai
  • Hi Daniel,

    Yes, finally working together with TI we found the problem.
    The fix is in the file <TivaWare_install_Directory>/utils/lwiplib.c”, in the function “lwipInit(). Changing “MAP_EMACInit” to “EMACInit” (Removing “MAP_” we are forcing to use the flash version of the API).
    Confirmed by TI, this problem only is in the ROM version on A0 Silicon, but it is solved in A1 and flash version of the API.

    I hope that this answer will help you too.

    Best regards.