AnsweredAssumed Answered

DHCP client

Question asked by Swapnil Katre on Dec 24, 2012
Latest reply on Feb 8, 2013 by Swapnil Katre

i have a problem binding the device to the ip address provided by dhcp client.

 

the code i have used is:

/* runtime RTCS configuration */

   _RTCSPCB_init = pcbs;

   _RTCS_msgpool_init = msgs;

   _RTCS_socket_part_init = sockets;

  

   error = RTCS_create();

   if (error == RTCS_OK) {

      IPCFG_default_enet_device = BSP_DEFAULT_ENET_DEVICE;

      IPCFG_default_ip_address = ENET_IPADDR;

      IPCFG_default_ip_mask = ENET_IPMASK;

      IPCFG_default_ip_gateway = ENET_IPGATEWAY;

      LWDNS_server_ipaddr = ENET_IPDNS;

 

 

      ip_data.ip = IPCFG_default_ip_address;

      ip_data.mask = IPCFG_default_ip_mask;

      ip_data.gateway = IPCFG_default_ip_gateway;

 

 

      ENET_get_mac_address(IPCFG_default_enet_device, IPCFG_default_ip_address, IPCFG_default_enet_address);

      //ipcfg_init_device(IPCFG_default_enet_device, IPCFG_default_enet_address);

 

       /* RTCSCFG_ENABLE_LWDNS */

       error = ipcfg_init_device (IPCFG_default_enet_device, serverAddress);

  

      ipcfg_add_dns_ip(IPCFG_default_enet_device,LWDNS_server_ipaddr);

 

 

      // check link status

      printf("\nWaiting for ethernet cable plug in ... ");

      while(!ipcfg_get_link_active(IPCFG_default_enet_device)) {};

      printf("Cable connected.\n");

 

 

       /* If DHCP Enabled, get IP address from DHCP server */

      if (dhcp) {

         printf("\nDHCP bind ... ");

         error = ipcfg_bind_dhcp_wait(IPCFG_default_enet_device, 1, &ip_data);

            if (error != IPCFG_ERROR_OK) {

            printf("\nRTCS failed to bind interface with IPv4, error = %X", error);

            }

            else {

               printf("Successful!\n");

            }

      }

.

 

 

and the output i get on the screen is :

 

Waiting for ethernet cable plug in ... Cable connected.

 

 

DHCP bind ...

RTCS failed to bind interface with IPv4, error = 1D04

Finish init

 

 

now according to rtcs.h 0x1D04 = 0x1000 + 0x0D04 = RTCS_ERROR_BASE + RTCSERR_IPCFG_BIND

 

and what exactly RTCSERR_IPCFG_BIND mean. why it is not able to bind? please help me resolving this issue.

Outcomes