TCP/IP stops working after awhile

Author
Shishi
Super Member
  • Total Posts : 341
  • Reward points : 0
  • Joined: 2016/06/15 05:34:10
  • Location: 0
  • Status: online
2018/12/06 09:49:32 (permalink)
0

TCP/IP stops working after awhile

Hi everyone
i wrote in lots of posts to see if some body can help me to resolve my problem.
i am using pic32Mzefm144 harmony v2.06 and tcpip for both wifi and ethernet connection.
my propblem is for some hours tcp ip works well but after that it doesnot communicate any more.the time is not always the same somtimes after 1 hour some times after 20 hour. how can i undrestand that it is the out of mmemory problem or whatelse.
i am really in truble.


/*** TCP Configuration ***/
 
// *****************************************************************************
// *****************************************************************************
// Section: TCPIP Stack Configuration
// *****************************************************************************
// *****************************************************************************
#define TCPIP_STACK_USE_IPV4
#define TCPIP_STACK_USE_TCP
#define TCPIP_STACK_USE_UDP
 
#define TCPIP_STACK_TICK_RATE 5
#define TCPIP_STACK_SECURE_PORT_ENTRIES 10
 
#define TCPIP_STACK_ALIAS_INTERFACE_SUPPORT false
 
#define TCPIP_PACKET_LOG_ENABLE 0
 
/* TCP/IP stack event notification */
#define TCPIP_STACK_USE_EVENT_NOTIFICATION
#define TCPIP_STACK_USER_NOTIFICATION false
#define TCPIP_STACK_DOWN_OPERATION true
#define TCPIP_STACK_IF_UP_DOWN_OPERATION true
#define TCPIP_STACK_MAC_DOWN_OPERATION true
#define TCPIP_STACK_INTERFACE_CHANGE_SIGNALING false
#define TCPIP_STACK_CONFIGURATION_SAVE_RESTORE true
/*** TCPIP Heap Configuration ***/
 
#define TCPIP_STACK_USE_INTERNAL_HEAP
#define TCPIP_STACK_DRAM_SIZE 39250
#define TCPIP_STACK_DRAM_RUN_LIMIT 2048
 
#define TCPIP_STACK_MALLOC_FUNC malloc
 
#define TCPIP_STACK_CALLOC_FUNC calloc
 
#define TCPIP_STACK_FREE_FUNC free
 

#define TCPIP_STACK_DRAM_DEBUG_ENABLE
 
#define TCPIP_STACK_HEAP_USE_FLAGS TCPIP_STACK_HEAP_FLAG_ALLOC_UNCACHED
 
#define TCPIP_STACK_HEAP_USAGE_CONFIG TCPIP_STACK_HEAP_USE_DEFAULT
 
#define TCPIP_STACK_SUPPORTED_HEAPS 1
 
/*** ARP Configuration ***/
#define TCPIP_ARP_CACHE_ENTRIES 5
#define TCPIP_ARP_CACHE_DELETE_OLD true
#define TCPIP_ARP_CACHE_SOLVED_ENTRY_TMO 1200
#define TCPIP_ARP_CACHE_PENDING_ENTRY_TMO 60
#define TCPIP_ARP_CACHE_PENDING_RETRY_TMO 2
#define TCPIP_ARP_CACHE_PERMANENT_QUOTA 50
#define TCPIP_ARP_CACHE_PURGE_THRESHOLD 75
#define TCPIP_ARP_CACHE_PURGE_QUANTA 1
#define TCPIP_ARP_CACHE_ENTRY_RETRIES 3
#define TCPIP_ARP_GRATUITOUS_PROBE_COUNT 1
#define TCPIP_ARP_TASK_PROCESS_RATE 2
#define TCPIP_ARP_PRIMARY_CACHE_ONLY true
 

/*** DNS Client Configuration ***/
#define TCPIP_STACK_USE_DNS
#define TCPIP_DNS_CLIENT_SERVER_TMO 60
#define TCPIP_DNS_CLIENT_TASK_PROCESS_RATE 200
#define TCPIP_DNS_CLIENT_CACHE_ENTRIES 5
#define TCPIP_DNS_CLIENT_CACHE_ENTRY_TMO 0
#define TCPIP_DNS_CLIENT_CACHE_PER_IPV4_ADDRESS 5
#define TCPIP_DNS_CLIENT_CACHE_PER_IPV6_ADDRESS 1
#define TCPIP_DNS_CLIENT_ADDRESS_TYPE IP_ADDRESS_TYPE_IPV4
#define TCPIP_DNS_CLIENT_CACHE_DEFAULT_TTL_VAL 1200
#define TCPIP_DNS_CLIENT_CACHE_UNSOLVED_ENTRY_TMO 10
#define TCPIP_DNS_CLIENT_LOOKUP_RETRY_TMO 5
#define TCPIP_DNS_CLIENT_MAX_HOSTNAME_LEN 32
#define TCPIP_DNS_CLIENT_MAX_SELECT_INTERFACES 4
#define TCPIP_DNS_CLIENT_DELETE_OLD_ENTRIES true
#define TCPIP_DNS_CLIENT_USER_NOTIFICATION false
 
 
 
/*** HTTP Configuration ***/
#define TCPIP_STACK_USE_HTTP_SERVER
#define TCPIP_HTTP_MAX_HEADER_LEN 15
#define TCPIP_HTTP_CACHE_LEN "600"
#define TCPIP_HTTP_TIMEOUT 45
#define TCPIP_HTTP_MAX_CONNECTIONS 4
#define TCPIP_HTTP_DEFAULT_FILE "testconf.htm"
#define TCPIP_HTTPS_DEFAULT_FILE "testconf.htm"
#define TCPIP_HTTP_DEFAULT_LEN 10
#define TCPIP_HTTP_MAX_DATA_LEN 100
#define TCPIP_HTTP_MIN_CALLBACK_FREE 16
#define TCPIP_HTTP_SKT_TX_BUFF_SIZE 0
#define TCPIP_HTTP_SKT_RX_BUFF_SIZE 0
#define TCPIP_HTTP_CONFIG_FLAGS 1
#define TCPIP_HTTP_FILE_UPLOAD_ENABLE
#define TCPIP_HTTP_FILE_UPLOAD_NAME "mpfsupload"
#define TCPIP_HTTP_USE_POST
#define TCPIP_HTTP_USE_COOKIES
#define TCPIP_HTTP_USE_BASE64_DECODE
#define TCPIP_HTTP_USE_AUTHENTICATION
#define TCPIP_HTTP_TASK_RATE 33
#define TCPIP_HTTP_MALLOC_FUNC 0
#define TCPIP_HTTP_FREE_FUNC 0
 
/*** ICMPv4 Server Configuration ***/
#define TCPIP_STACK_USE_ICMP_SERVER
 
/*** ICMPv4 Client Configuration ***/
#define TCPIP_STACK_USE_ICMP_CLIENT
#define TCPIP_ICMP_CLIENT_USER_NOTIFICATION true
#define TCPIP_ICMP_ECHO_REQUEST_TIMEOUT 500
#define TCPIP_ICMP_TASK_TICK_RATE 33
/*** iperf Configuration ***/
#define TCPIP_STACK_USE_IPERF
#define TCPIP_IPERF_TX_BUFFER_SIZE 4096
#define TCPIP_IPERF_RX_BUFFER_SIZE 4096
#define TCPIP_IPERF_TX_WAIT_TMO 100
#define TCPIP_IPERF_TX_QUEUE_LIMIT 2
#define TCPIP_IPERF_TIMING_ERROR_MARGIN 0
#define TCPIP_IPERF_MAX_INSTANCES 1
#define TCPIP_IPERF_TX_BW_LIMIT 1
 

/*** NBNS Configuration ***/
#define TCPIP_STACK_USE_NBNS
#define TCPIP_NBNS_TASK_TICK_RATE 110
 
#define TCPIP_TCP_MAX_SEG_SIZE_TX 1460
#define TCPIP_TCP_SOCKET_DEFAULT_TX_SIZE 512
#define TCPIP_TCP_SOCKET_DEFAULT_RX_SIZE 512
#define TCPIP_TCP_DYNAMIC_OPTIONS true
#define TCPIP_TCP_START_TIMEOUT_VAL 1000
#define TCPIP_TCP_DELAYED_ACK_TIMEOUT 100
#define TCPIP_TCP_FIN_WAIT_2_TIMEOUT 5000
#define TCPIP_TCP_KEEP_ALIVE_TIMEOUT 10000
#define TCPIP_TCP_CLOSE_WAIT_TIMEOUT 0
#define TCPIP_TCP_MAX_RETRIES 5
#define TCPIP_TCP_MAX_UNACKED_KEEP_ALIVES 6
#define TCPIP_TCP_MAX_SYN_RETRIES 2
#define TCPIP_TCP_AUTO_TRANSMIT_TIMEOUT_VAL 40
#define TCPIP_TCP_WINDOW_UPDATE_TIMEOUT_VAL 200
#define TCPIP_TCP_MAX_SOCKETS 10
#define TCPIP_TCP_TASK_TICK_RATE 5
#define TCPIP_TCP_MSL_TIMEOUT 0
#define TCPIP_TCP_QUIET_TIME 0
#define TCPIP_TCP_COMMANDS false

[/code]
my heap size is 65535 and nothing on minimum stack size, inside mplab xide.
console and tcpip command are enabled but i do not know how can i see if there is any messages, i have custom board so usb port on the borad does not exist. is it possible to see any thing in debuger console of mblab xide?if no how can i do?
post edited by Shishi - 2018/12/06 09:52:26
#1

8 Replies Related Threads

    rainad
    Moderator
    • Total Posts : 1040
    • Reward points : 0
    • Joined: 2009/05/01 13:39:25
    • Location: 0
    • Status: offline
    Re: TCP/IP stops working after awhile 2018/12/06 10:31:16 (permalink)
    4 (1)
    You need to have a (serial) console connected to your board that you can use to investigate the stack/board status when this happens.
    Is this a MCHP or a custom board?
    When the stack stops replying, is the application still running OK, is there any way that you can tell?
    Same behavior on both Wi-Fi and ETH interfaces?
     
     
    #2
    Shishi
    Super Member
    • Total Posts : 341
    • Reward points : 0
    • Joined: 2016/06/15 05:34:10
    • Location: 0
    • Status: online
    Re: TCP/IP stops working after awhile 2018/12/07 00:37:36 (permalink)
    0
    rainad
    You need to have a (serial) console connected to your board that you can use to investigate the stack/board status when this happens.
    Is this a MCHP or a custom board?
    When the stack stops replying, is the application still running OK, is there any way that you can tell?
    Same behavior on both Wi-Fi and ETH interfaces?
     
     


    i have custom board.in the case of ethernet yes when tcpip stops application still running but if i was connect with wifi and tcpip stops application seems that goes to crash and nothing works,one time i was in debug when it is happened(connect with wifi) i saw that _APP_Tasks() not excute any more but other free rtos routins was executed and application runs there.
    with Ethernet:for example: i connected Ethernet (Encj28) yesterday afternoon and did ping ,remained connect tile this morning(about 16 hours), this morning i did ping again it pings, 1 hour later i tried again ping does not replied.
    but app_tasks() was executed.
    so i do not have same bihavior on wifi and ethernet.
    #3
    rainad
    Moderator
    • Total Posts : 1040
    • Reward points : 0
    • Joined: 2009/05/01 13:39:25
    • Location: 0
    • Status: offline
    Re: TCP/IP stops working after awhile 2018/12/07 12:37:31 (permalink)
    0
    Not a lot of info to understand what might be happening.
    Are you running a standard demo app or is this something that you created?
    If it's a custom app, try to use a demo that's part of the Harmony release.
    Then work with just one interface for your tests, maybe we can isolate where the problem is.
     Increase the heap size, like:
    #define TCPIP_STACK_DRAM_SIZE 79250
    and see if this has any impact.
    Try to add a serial console - if you have an UART port on this board, so we can make few checks when the issue occurs.
    #4
    Shishi
    Super Member
    • Total Posts : 341
    • Reward points : 0
    • Joined: 2016/06/15 05:34:10
    • Location: 0
    • Status: online
    Re: TCP/IP stops working after awhile 2018/12/10 06:37:04 (permalink)
    0
    rainad
    Not a lot of info to understand what might be happening.
    Are you running a standard demo app or is this something that you created?

    i used structures that is explained in this link that microchip support sent to me:  http://microchipdeveloper.com/wifi:wh

    If it's a custom app, try to use a demo that's part of the Harmony release.
    Then work with just one interface for your tests, maybe we can isolate where the problem is.
     Increase the heap size, like:
    #define TCPIP_STACK_DRAM_SIZE 79250
    and see if this has any impact.
    Try to add a serial console - if you have an UART port on this board, so we can make few checks when the issue occurs.


    unfortunaitly i do not have serial connection on my board.
    i will apply now #define TCPIP_STACK_DRAM_SIZE 79250.
    but is there any whay to restart Tcp/ip connection?
    #5
    Shishi
    Super Member
    • Total Posts : 341
    • Reward points : 0
    • Joined: 2016/06/15 05:34:10
    • Location: 0
    • Status: online
    Re: TCP/IP stops working after awhile 2018/12/10 06:47:20 (permalink)
    0
    Dear Rainad 
    using #define TCPIP_STACK_DRAM_SIZE 79250 gives me APP_TCPIP_ERROR
    #6
    rainad
    Moderator
    • Total Posts : 1040
    • Reward points : 0
    • Joined: 2009/05/01 13:39:25
    • Location: 0
    • Status: offline
    Re: TCP/IP stops working after awhile 2018/12/10 08:28:19 (permalink)
    0
    Probably you need to increase the heap in your project. It should be greater than what you set for the TCPIP_STACK_DRAM_SIZE. Make the project heap around 80 KB.
     
    #7
    Shishi
    Super Member
    • Total Posts : 341
    • Reward points : 0
    • Joined: 2016/06/15 05:34:10
    • Location: 0
    • Status: online
    Re: TCP/IP stops working after awhile 2018/12/11 00:45:29 (permalink)
    0
    rainad
    Probably you need to increase the heap in your project. It should be greater than what you set for the TCPIP_STACK_DRAM_SIZE. Make the project heap around 80 KB.
     


    i changed as you said Rainad but still happens the problem.
    do you know how can i restart tcpip connection?
    i tried to use:

    static void restart_WifiConn(TCPIP_NET_HANDLE *netHandleWiFi){
    //SYS_MODULE_OBJ tcpipStackObj;
    // tcpipStackObj== TCPIP_STACK_Initialize(0, 0);
    // TCPIP_STACK_Deinitialize(tcpipStackObj);
    APP_TCPIP_IFModules_Disable(*netHandleWiFi);
    APP_TCPIP_IF_Down(*netHandleWiFi);
    APP_TCPIP_IF_Up(*netHandleWiFi);

    s_appData.state = APP_MOUNT_DISK;

    }

    but it cause restart the processor :/
    #8
    Shishi
    Super Member
    • Total Posts : 341
    • Reward points : 0
    • Joined: 2016/06/15 05:34:10
    • Location: 0
    • Status: online
    Re: TCP/IP stops working after awhile 2018/12/11 03:48:08 (permalink)
    0
    is that currect that App_TCPIP_NetDown/App_TCPIP_Netup do reset of processore?
     
    post edited by Shishi - 2018/12/11 04:25:52
    #9
    Jump to:
    © 2018 APG vNext Commercial Version 4.5