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.

NDK 6748 DHCP client question

We are using NDK 2.22.3.20 and we have a few questions about the operation. 

1) when we boot up the system without a cable connected, and we remain running without a cable connected we get a DHCP timeout error. why does the NDK attempt to perform DHCP when no cable is connected?

2) when DHCP fails we want it to try again if we plug in a cable but right now the only way we know to restart the DHCP client is to reboot the NDK with a netstop and a netstart.  is there a way to start the NDK over without rebooting it?

3) a part of the issue with restarting the ndk for DHCP is that we also have to reboot the ndk when we unplug and plug a cable back in so it performs DHCP again.  if we are able to restart the dhcp client service and we do not reboot the ndk are there any known issues with switching networks without rebooting the ndk?

  • Hi,

    1) when we boot up the system without a cable connected, and we remain running without a cable connected we get a DHCP timeout error. why does the NDK attempt to perform DHCP when no cable is connected?

    Due to differences between our devices link detection was not added to the NDK.  We are working on a way to standardize this.  Thus execution continues and DHCP runs.  However, the C6748 driver does have link detection built into it.  The "EMAC_linkStatus" function is called when the link has changed (see HelloWorld example).  Additional logic can be added to stop/start DHCP.

    2) when DHCP fails we want it to try again if we plug in a cable but right now the only way we know to restart the DHCP client is to reboot the NDK with a netstop and a netstart.  is there a way to start the NDK over without rebooting it?

    When DHCP is added to a projects .cfg file; it gets translated to Legacy Configuration APIs (SPRU524H - Section G) which include the DHCP entry.  

    // Example of code generated
    CfgAddEntry(hCfg, CFGTAG_SYSINFO, CFGITEM_DHCP_HOSTNAME, 0,
                strlen(ti_ndk_config_Global_HostName), 
                (UINT8 *)ti_ndk_config_Global_HostName, 0);

    The CfgRemoveEntry API can be used to remove DHCP.  By adding and removing DHCP (within the EMAC_linkStatus funciton), you can stop and start DHCP without restarting the NDK.  

    The NETTOOLS API (Section 6.4.3) also feature DHCPOpen and DHCPClose which also stop and start DHCP but do so bypassing the configuration system.

    3) a part of the issue with restarting the ndk for DHCP is that we also have to reboot the ndk when we unplug and plug a cable back in so it performs DHCP again.  if we are able to restart the dhcp client service and we do not reboot the ndk are there any known issues with switching networks without rebooting the ndk?

    The NDK should not have any problems when switching networks and running DHCP again.  However, you should remember to close any sockets opened during the first connection.

    Hope this helps,

    -- Emmanuel

  • if i do not do a CfgRemoveEntry and only call CfgAddEntry every time i want to restart the NDK  will that cause an issue with the heap/memory?

  • Hi, 

    CfgAddEntry can be used without calling CfgRemoveEntry first.  However to prevent multiple tasks and running out of resources, the Mode variable in the function call should be set to CFG_ADDMODE_UNIQUE.  This option will remove any configurations with the same Tag and Item fields.  When a DHCP configuration is removed, it will tell SYS/BIOS to destroy the DHCP task (will free the task stack and resources).  The new configuration is added and a new DHCP task is created.  

    Hope this helps,

    -- Emmanuel