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.

CCS/TM4C1294NCPDT: TI-RTOS DHCP open failed and network close

Part Number: TM4C1294NCPDT

Tool/software: Code Composer Studio

MCU: TM4C1294NCPDT

RTOS version : tirtos_tivac_2_16_01_14

NDK version : ndk_2_25_00_09

Hi

I have some problem.

Below are my step

DHCP OFF -> Turn ON

DHCP ON -> Turn OFF

DHCP OFF -> Turn ON

DHCP ON -> Turn OFF

Wait few hours or few days.

When i turn DHCP ON.

I see the UART console show, the DHCP Running and immediately disabled.

UART message:

Remove static ip address

IP_Address_Hook

Ip Removed

DHCP Turn ON

Service Status: DHCPC : Enabled : Running : 000

Service Status: DHCPC : Enabled : Running : 000

Service Status: HTTP : Disabled : : 000

Service Status: DHCPC : Disabled : : 000

Net_Stop_Hook

I don't know what happend.

Is there any condition to let net stop?

Or in Net_Stop_Hook can collect any information?

Please help me, thanks.

Allen

  • Hi,

       Your UART message says it is removing static IP address. Have you configured the NDK to use static IP or you want to use DHCP? 

  • Hi Charles

    I want to remove static ip and use dhcp.

    Below is my code, remove static IP entry, and open DHCP.

    void OpenDHCP(void)
    {
    	HANDLE hCfgIpAddr;
    	HANDLE hCfgRT;
    	HANDLE hCfg = CfgGetDefault();
    	CfgGetEntry(hCfg_Record, CFGTAG_IPNET, 1, 1, &hCfgIpAddr);
    	/* remove the current static IP entry */
    	CfgRemoveEntry(hCfg_Record, hCfgIpAddr);
    	CfgGetEntry(hCfg_Record, CFGTAG_ROUTE, 0, 1, &hCfgRT);
    	CfgRemoveEntry(hCfg_Record, hCfgRT);
    
        CI_SERVICE_DHCPC dhcpc;
        UINT8 DHCP_OPTIONS[] = {
            DHCPOPT_SUBNET_MASK,
    		//DHCPOPT_ROUTER,
        };
    
        CfgAddEntry(hCfg, CFGTAG_SYSINFO, CFGITEM_DHCP_HOSTNAME, 0,
        strlen(HostName), (unsigned char *)HostName, NULL);
    
        /* Specify DHCP Service on IF specified by "IfIdx" */
        bzero(&dhcpc, sizeof(dhcpc));
        dhcpc.cisargs.Mode   = 1;
        dhcpc.cisargs.IfIdx  = 1;
        dhcpc.cisargs.pCbSrv = &serviceReport;
        dhcpc.param.pOptions = DHCP_OPTIONS;
        dhcpc.param.len = 2;
        CfgAddEntry(hCfg, CFGTAG_SERVICE, CFGITEM_SERVICE_DHCPCLIENT, 0,
                sizeof(dhcpc), (UINT8 *)&dhcpc, 0);
        hCfg_Record = hCfg;
        IP_Update = 0;
        DHCP_Status = 1;
    }

  • Hi,

     See if this post help if you need to change the IP from static to dynamic during runtime. 

     If you still have problem, just reply back and  I will move your post to our NDK expert. 

  • Hi Charles

    Thanks for your reply.

    In that thread seems configure static ip or dynamic in initialization.

    My case is when the network in runtime.

    I change ip static or dynamic.

    And when using static ip for a while, change to dynamic.

    And the network will be closed.(the close hook is in)

    Is my code wrong?

    Or other condition will let network close.

  • Hi Allen,

    Can you attach a WireShark capture for this this part?

    Allen_Tseng said:

    DHCP Turn ON

    Service Status: DHCPC : Enabled : Running : 000

    Service Status: DHCPC : Enabled : Running : 000

    Service Status: HTTP : Disabled : : 000

    Service Status: DHCPC : Disabled : : 000

  • Hi Todd

    Thanks for your reply.

    I will try to use WireShark to capture for this part.

    I find another problem.

    Some time when DHCP turn off, network also will be closed.

    ------------------------------------------------------

    UART message:

    DHCP ON -> Turn OFF

    IP_Address_Hook

    Ip Removed

    Service Status: DHCPC : Disabled : : 000

    Set static ip address

    IP_Address_Hook

    IP_Added

    Service Status: HTTP : Disabled : : 000

    IP_Address_Hook

    IP_Removed

    Net_Stop_Hook

    ------------------------------------------------------

    Is possible when i change ip staitc or dynamic, the network are process packet.

    Or stack overflow, memory not enough.

    My application using two tcp socket、one udp port、http server(with CGI)。

    Udp is for mdns.

    Allen

  • Allen,

    Here's some information on how to determine whether you have a stack problem: https://training.ti.com/debugging-common-application-issues-ti-rtos

    Todd

  • Hi Todd

    I try to use ccs debug mode, and occur OOM.

    I think turn ON/OFF DHCP is only a trigger.

    Because run for a while, may occur OOM.

    The console message is below:

    Allen

  • Allen,

    Take a look at the following pages to learn how memory is used in the NDK: https://processors.wiki.ti.com/index.php/TI-RTOS_Networking_Stack_Memory_Usage

    I expect you'll need to increase the dynamic memory manager portion.

    Todd