This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

RL-TCP DHCP Timeout

Dear all
I have made a simple project,but the DHCP seems to not working,Here is my code,

void TcpTickTask(void const *argument)
{
  /* System tick timer task */
  os_itv_set (100);
  while (1) {
    timer_tick ();
    tick = __TRUE;
    os_itv_wait ();
  }
}

static void dhcp_check () {
  /* Monitor DHCP IP address assignment. */

  if (tick == __FALSE || dhcp_tout == 0) {
    return;
  }
   tick = __FALSE;
if (mem_test (&localm[NETIF_ETH].IpAdr, 0, IP_ADRLEN) == __FALSE && !(dhcp_tout & 0x80000000)) {
    /* Success, DHCP has already got the IP address. */
    dhcp_tout = 0;
    return;
  }
  if (--dhcp_tout == 0) {
    /* A timeout, disable DHCP and use static IP address. */
    dhcp_disable ();
    dhcp_tout = 30 | 0x80000000;
    return;
  }
  if (dhcp_tout == 0x80000000) {
    dhcp_tout = 0;
  }

}

void MainTcpTask(void const *argument)
{
        dhcp_tout = DHCP_TOUT;
        for(;;)
        {
                osMutexWait (mutex_TcpNet_ID, osWaitForever);
                main_TcpNet ();
                dhcp_check ();
                osMutexRelease (mutex_TcpNet_ID);
        }
}

Some pictures,
s30.postimg.org/.../DHCP.png
postimg.org/.../
postimg.org/.../

Do you suggest any work around?

Parents Reply Children