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?
>>How should I do that?
You could start by configuring your network hardware to permit viewing the signals with something like WireShark. sourceforge.net/.../
An old 10BT HUB might help here in terms of seeing all the traffic.
The purpose would be to see if your board sends a DHCP request, and if the DHCP server on your network responds to that request. This will provide you with some insight about what is and what is not going on. Basic network debugging requires that you go look at what's actually going on.
For other code related events you'll want to examine your drivers and add breakpoints to see what's going on with them.