I have used the built in function "Net_Ethernet_28j60_initDHCP(5) " for getting IP from the DHCP enabled router. I have tested on router in my LAB and seems it is working . But the Client side it shows issues on router. The below functions are used for initializing the Ethernet module
Net_Ethernet_28j60_Init(myMacAddr, myIpAddr, 1);
Net_Ethernet_28j60_stackInitTCP();
After calling the function "Net_Ethernet_28j60_initDHCP(5)" i checked the IP on the module by using " memcpy(ipAddr, Net_Ethernet_28j60_getIpAddress(), 4);" . And address is 0.0.0.0 is showing.
I have make sure that the router which shows issues having DHCP enabled one.
Please help me to solve the issues,
Thanks.
Problem regarding Ethernet_28j60 Library(DHCP)
- petar.timotijevic
- mikroElektronika team
- Posts: 1739
- Joined: 19 Feb 2014 13:46
- Location: Serbia
- Contact:
Re: Problem regarding Ethernet_28j60 Library(DHCP)
Hi abhilash485 and welcome to the MikroE forum,
Did you tried to add some additional time with delay_ms for DHCP process?
DHCP Server Service is enabled and properly configured?
Best regards,
Peter
Did you tried to add some additional time with delay_ms for DHCP process?
DHCP Server Service is enabled and properly configured?
Best regards,
Peter
-
- Posts: 5
- Joined: 08 Nov 2013 08:12
Re: Problem regarding Ethernet_28j60 Library(DHCP)
Thanks Peter.petar.timotijevic wrote:Hi abhilash485 and welcome to the MikroE forum,
Did you tried to add some additional time with delay_ms for DHCP process?
DHCP Server Service is enabled and properly configured?
Best regards,
Peter
About DHCP service enabled issue.I have to make sure from my client and let you know about the DHCP service enabled in Router.
About your question "Did you tried to add some additional time with delay_ms for DHCP process? "
Not added any extra delay by using delay_ms() function in DHCP process. The function "Net_Ethernet_28j60_initDHCP(5)" , where 5 refers for waiting 5 seconds to get IP correct ?.
-
- Posts: 5
- Joined: 08 Nov 2013 08:12
Re: Problem regarding Ethernet_28j60 Library(DHCP)
Hi abhilash485 and welcome to the MikroE forum,
Did you tried to add some additional time with delay_ms for DHCP process?
DHCP Server Service is enabled and properly configured?
Best regards,
Peter
Hi Peter,
Did you tried to add some additional time with delay_ms for DHCP process?
Did't add any extra delay function. Used the built in function " Net_Ethernet_28j60_initDHCP(5)" to get IP from the DHCP router.
DHCP Server Service is enabled and properly configured?
You means Inside router. Yes router have DHCP feature enabled.
Please help me to resolve the issues..
Thanks
Did you tried to add some additional time with delay_ms for DHCP process?
DHCP Server Service is enabled and properly configured?
Best regards,
Peter
Hi Peter,
Did you tried to add some additional time with delay_ms for DHCP process?
Did't add any extra delay function. Used the built in function " Net_Ethernet_28j60_initDHCP(5)" to get IP from the DHCP router.
DHCP Server Service is enabled and properly configured?
You means Inside router. Yes router have DHCP feature enabled.
Please help me to resolve the issues..
Thanks
-
- Posts: 5
- Joined: 08 Nov 2013 08:12
Re: Problem regarding Ethernet_28j60 Library(DHCP)
Hello,
Did you tried to add some additional time with delay_ms for DHCP process?
Not tried , how do we add delay in the DHCP process. I have used the function "Net_Ethernet_28j60_initDHCP(timer_var)" . Changed the timer_var from 5 to 15. But no use
DHCP Server Service is enabled and properly configured?
You means inside Router.
I have attached router details
Thanks.
Best regards,
Peter
Did you tried to add some additional time with delay_ms for DHCP process?
Not tried , how do we add delay in the DHCP process. I have used the function "Net_Ethernet_28j60_initDHCP(timer_var)" . Changed the timer_var from 5 to 15. But no use
DHCP Server Service is enabled and properly configured?
You means inside Router.
I have attached router details
Thanks.
Best regards,
Peter
- Attachments
-
- Pic_router_1.jpg (265.15 KiB) Viewed 11523 times
-
- router3.jpg (267.21 KiB) Viewed 11523 times
- petar.timotijevic
- mikroElektronika team
- Posts: 1739
- Joined: 19 Feb 2014 13:46
- Location: Serbia
- Contact:
Re: Problem regarding Ethernet_28j60 Library(DHCP)
Hi,
Can you zip and attach your code.
Best regards,
Peter
Can you zip and attach your code.
Best regards,
Peter
-
- Posts: 5
- Joined: 08 Nov 2013 08:12
Re: Problem regarding Ethernet_28j60 Library(DHCP)
Hello,
Sorry for the delay in communication. I was in another project site. I have attached the code , removed all unwanted codes and only included the Ethernet init and DHCP function to obtain the IP from the router.
Thanks
Sorry for the delay in communication. I was in another project site. I have attached the code , removed all unwanted codes and only included the Ethernet init and DHCP function to obtain the IP from the router.
Thanks
- Attachments
-
- DHCP_IP_Obtain.rar
- (207.36 KiB) Downloaded 276 times
-
- Posts: 2
- Joined: 10 Apr 2015 20:33
Re: Problem regarding Ethernet_28j60 Library(DHCP)
I have a solution.
Error - in the DHCP connecting routine. Use something, like this:
Error - in the DHCP connecting routine. Use something, like this:
Code: Select all
// unsigned char mac[6] = {0x01, 0x23, 0x45, 0x67, 0x89, 0x0A};
// unsigned char ip[4] = {0, 0, 0, 0 }; // IMPORTANT!
// unsigned char gw[4];
// unsigned char mask[4];
// unsigned char dns[4];
Net_Ethernet_28j60_Init(mac, ip, 1); // init
if ( Net_Ethernet_28j60_initDHCP(10) )
{
// dhcp returns success
memcpy(ip, Net_Ethernet_28j60_getIpAddress(), 4); // fetch IP address
memcpy(gw, Net_Ethernet_28j60_getGwIpAddress(), 4); // you forgot it
memcpy(dns, Net_Ethernet_28j60_getDnsIpAddress(), 4); // you forgot it
memcpy(mask, Net_Ethernet_28j60_getIpMask(), 4); // you forgot it
}