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.

Serial to Ethernet Converter

Other Parts Discussed in Thread: TIDM-TM4C129XS2E

Dear Team,

I am working on RTOS based serial to ethernet converter design for Telnet Client Mode, however i have noticed that my kit stops working after some time. Time is variable. However when i reset the MCU, it again starts working. One more unexpected behavior noticed for RJ45 ethernet cable connect disconnect make design to stop working, sometimes not always. What could be the issue here? Pls suggest a solution. 

Thanks

Best Regards,

Amit Deswal

  • Hello Amit

    I have asked the concerned engineer to look into the same.
  • Hi Amit,

    I tried changing following values of internal memory pool sizes and increased Stack size and Heap size to 32k each but still same problem. Need help to resolve error. 

    //*****************************************************************************

    //

    // ---------- Internal Memory Pool Sizes ----------

    //

    //*****************************************************************************

    #define MEMP_NUM_PBUF                     128   //48 // Default 16

    //#define MEMP_NUM_RAW_PCB                4

    //#define MEMP_NUM_UDP_PCB                4

    #define MEMP_NUM_TCP_PCB                  32     //16    // Default 5

    //#define MEMP_NUM_TCP_PCB_LISTEN         8

    //#define MEMP_NUM_TCP_SEG                16

    //#define MEMP_NUM_REASSDATA              5

    //#define MEMP_NUM_ARP_QUEUE              30

    //#define MEMP_NUM_IGMP_GROUP             8

    #define MEMP_NUM_SYS_TIMEOUT              8

    //#define MEMP_NUM_NETBUF                 2

    //#define MEMP_NUM_NETCONN                4

    //#define MEMP_NUM_TCPIP_MSG_API          8

    //#define MEMP_NUM_TCPIP_MSG_INPKT        8

    #define PBUF_POOL_SIZE                    128   //48 // Default 16

     


  • Hello Amit,

    If I understand correctly, you are trying to implement a Telnet Client. For this you are using the Telnet Server (provided by default in enet_s2e application) as the base.

    If the above assumption is correct, then please ensure that the correct lwIP API is used to close the client API socket. In lwIP, there are two different APIs for closing a TCP socket, one for closing a TCP server socket and the other for closing a TCP client socket.

    Thanks,
    Sai
  • Hi Sai,

    Thanks for suggestion, You are correct that i am working on Telnet Client while used an app called Socket Test to make a Server in my PC. I am making a serial to ethernet converter.

    I've used TI RTOS based design to run it on DK-TM4C129x. www.ti.com/.../TIDM-TM4C129XS2E

    Issue is my ethernet link status keeps on changing without any disconnection of cable, i've taken help from e2e forum pls check below post.
    e2e.ti.com/.../524931

    Do i need to tweak HOST_TMR_INTERVAL or memory options parameters in lwipopts.h file to fine tune. Why link status is changing without cable disconnect? How can i resolve it?

    PS: I have modified Heap size to 65k and stack to 65k as well. Optimization level is set to OFF in compiler and linker options.

    Thanks
    Best Regards,
    Amit Deswal
  • Hello Amit,

    I am confused by your following statement:

    Amit Deswal said:
    I've used TI RTOS based design to run it on DK-TM4C129x. www.ti.com/.../TIDM-TM4C129XS2E

    If you are using TIDM-TM4C129XS2E, then it uses FreeRTOS - not TI-RTOS.

    Amit Deswal said:
    Issue is my ethernet link status keeps on changing without any disconnection of cable, i've taken help from e2e forum pls check below post.
    e2e.ti.com/.../524931

    Have you checked if this issue is occurring with the original example provided with TI? If not, then did you check the suggestion on my previous post?

    Stellaris Sai said:
    ... then please ensure that the correct lwIP API is used to close the client API socket. In lwIP, there are two different APIs for closing a TCP socket, one for closing a TCP server socket and the other for closing a TCP client socket.

     
    Thanks,

    Sai

  • Hello Sai,

    Sorry, my mistake, it is Free RTOS not TI and am working on the original code available through TI Designs running it in RAW Telnet Client mode. I have implemented a system reset when cable is plugged in again after unplug.

    TelnetNotifyLinkStatus function, in Telnet.c file.

    TelnetNotifyLinkStatus(bool bLinkStatusUp)
    {
    int32_t i32Port;

    if(bLinkStatusUp)
    {
    flag1 = 1;
    if(flag2 == 1)
    {
    flag2 = 0;
    flag1 = 0;
    linkcounter++;
    // TelnetInit();
    // g_sTelnetSession[i32Port].eTCPState = STATE_TCP_CONNECTING;
    HWREG(NVIC_APINT) = NVIC_APINT_VECTKEY | NVIC_APINT_SYSRESETREQ;
    }
    return;
    }
    if(!(bLinkStatusUp) && flag1 == 1)
    {
    flag2 = 1;
    }


    Now my problem of cable plug/unplug is resolved. Other problem is that I need to know whether my client (DK-TM4C129X kit) is connected to server or not.

    There is one enum that tells TCP state, below. Sometimes i found that state of my TCP session is STATE_TCP_CONNECTED but server (PC) is showing no connection with client. It happens randomly may be after 2 hrs or 5 hours. How can i check that my client is actually connected with server or not in this code ??

    TelnetPoll function is called periodically to check a dropped connection but in this case it is still showing STATE_TCP_CONNECTED while server is showing not connected. What modification can i do here in this code to check whether server and client is connected.

    Typically when i close server then server sends session close packet to client and client come back to STATE_TCP_CONNECTING after receiving the close session packet.

    Pls suggest. Thanks


    //*****************************************************************************
    //
    //! The possible states of the TCP session.
    //
    //*****************************************************************************
    typedef enum
    {
    //
    //! The TCP session is idle. No connection has been attempted, nor has it
    //! been configured to listen on any port.
    //
    STATE_TCP_IDLE,

    //
    //! The TCP session is listening (server mode).
    //
    STATE_TCP_LISTEN,

    //
    //! The TCP session is connecting (client mode).
    //
    STATE_TCP_CONNECTING,

    //
    //! The TCP session is connected.
    //
    STATE_TCP_CONNECTED,
    }
    tTCPState;


    Best Regards,
    Amit Deswal