اطلاعیه

Collapse
No announcement yet.

تنظیمات DHCP برای میکرو

Collapse
X
 
  • فیلتر
  • زمان
  • Show
Clear All
new posts

    تنظیمات DHCP برای میکرو

    سلام من این کد رو برای ping کردن میکرو LPC1768 اجرا کردم ولی با وجود فعال کردن DHCP میکرو IP رو دریافت نمیکنه.
    تو نمونه مثال های سایت هم از DHCP استفاده نشده و IP به صورت ایستاتیک به میکرو داده شده .
    کسی DHCP رو فعال کرده به صورتی که در DHCP IP Pool Summary مودم بشه میکرو رو دید و همچنین اون رو ping کرد
    کد:
    /****************************PING MicroController ******************************/
    #include <LPC17xx.H>
    #include <RTL.h>
    #include <stdio.h>
    #include <Net_Config.h>
    
    BOOL tick ;
    U32 dhcp_tout;
    
    extern LOCALM localm[];            /* Local Machine Settings   */
    #define MY_IP localm[NETIF_ETH].IpAdr
    #define DHCP_TOUT  50            /* DHCP timeout 5 seconds   */
    /*--------------------------- dhcp_check ------------------------------------*/
    
    static void dhcp_check () {
     /* Monitor DHCP IP address assignment. */
    
     if (tick == __FALSE || dhcp_tout == 0) {
      return;
     }
     if (mem_test (&MY_IP, 0, IP_ADRLEN) == __FALSE) {
      /* 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 ();
     }
    }
    
    /*--------------------------------- timer_poll func ------------------------------------------*/
    void timer_poll () 
    {
    		if (SysTick->CTRL & 0x10000) 	/*100mstimeout*/
    		{
    				timer_tick (); // RL-TCPnet function
    				tick = __TRUE;
    		}
    }
    /*********************************** Init Timer(SysTimer)****************************/
    void timer_init(void){
    	
    	/* Setup and enable the SysTick timer for 100ms. */
    		SysTick->LOAD = (100000000 / 10) - 1;					/* SysTick->LOAD = (SystemCoreClock / 10) - 1;*/
    		SysTick->CTRL = 0x05;	
    }
    /**************************** Main ***********************************************/
    int main (void)
    {	
    	timer_init ();
    	init_TcpNet ();
    	dhcp_tout = DHCP_TOUT;
    		
    	while (1) 
    		{
    			timer_poll ();
    			main_TcpNet ();
    			dhcp_check ();
       
    		}
    }


    #2
    پاسخ : تنظیمات DHCP برای میکرو

    سلام خواهشا دوستانی که اترنت رو میکرو انجام دادن کــمـک کنند :applause:

    در خود سایت keil اشاره شده که اگر میکرو را نمی توانید ping کنید مشکل از تنظیمات DHCP است و باید آدرس IP رو زمانی که می خواهید از DHCP استفاده کنید 0.0.0.0 قرار بدهید یا اینکه کلا DHCP رو غیر فعال کنید.
    حالا من سوالم اینه که آیا کسی DHCP رو روی میکرو فعال کرده و کار کرده ؟ اگر آره لطفا سورس و نتظیمات رو به من بگید .
    ممنون :applause:
    در سایت keil این توضیحات رو نوشته:
    اینم لینکش
    PROBLEM
    While trying to run the HTTP_Demo program included with the RL-ARM product, the following command:

    ping mcbstr9
    gets no response from the MCBSTR9 board (or whatever board you use) and the HTTP_Demo server does not respond.

    This problem occurs only if you use DHCP. If you disable DHCP in the HTTP_Demo and manually configure a Local IP Address, Subnet Mask, and Default Gateway IP Address, everything works.

    CAUSE
    Older HTTP_Demo configurations used an initial local IP address of 192.168.0.100 when DHCP was used. The local IP address should have been 0.0.0.0. This has been corrected in subsequent configurations.

    If the local IP address configured in the HTTP_Demo matches the subnet address of your local network, DHCP will fail. For example, if your local subnet is 192.168.0.* and the local IP address in Net_Config.c for the HTTP_Demo program is 192.168.0.100, the DHCP server will not return an IP Address.

    SOLUTION
    Change the Local IP Address in Net_Config.c to 0.0.0.0. Then, the DHCP server will assign the Local IP Address, etc. normally.

    دیدگاه


      #3
      پاسخ : تنظیمات DHCP برای میکرو

      سلام یعنی کسی شبکه رو میکرو تست نکرده که من رو راهنمایی کنه :cry2:

      دیدگاه

      لطفا صبر کنید...
      X