Problem regarding Ethernet_28j60 Library(DHCP)

General discussion on Libstock website & codes posted on this website.
Post Reply
Author
Message
abhilash485
Posts: 5
Joined: 08 Nov 2013 08:12

Problem regarding Ethernet_28j60 Library(DHCP)

#1 Post by abhilash485 » 05 Feb 2015 05:45

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.

User avatar
petar.timotijevic
mikroElektronika team
Posts: 1739
Joined: 19 Feb 2014 13:46
Location: Serbia
Contact:

Re: Problem regarding Ethernet_28j60 Library(DHCP)

#2 Post by petar.timotijevic » 05 Feb 2015 15:56

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

abhilash485
Posts: 5
Joined: 08 Nov 2013 08:12

Re: Problem regarding Ethernet_28j60 Library(DHCP)

#3 Post by abhilash485 » 06 Feb 2015 09:45

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
Thanks 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 ?.

abhilash485
Posts: 5
Joined: 08 Nov 2013 08:12

Re: Problem regarding Ethernet_28j60 Library(DHCP)

#4 Post by abhilash485 » 06 Feb 2015 10:54

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

abhilash485
Posts: 5
Joined: 08 Nov 2013 08:12

Re: Problem regarding Ethernet_28j60 Library(DHCP)

#5 Post by abhilash485 » 06 Feb 2015 11:44

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
Attachments
Pic_router_1.jpg
Pic_router_1.jpg (265.15 KiB) Viewed 11523 times
router3.jpg
router3.jpg (267.21 KiB) Viewed 11523 times

User avatar
petar.timotijevic
mikroElektronika team
Posts: 1739
Joined: 19 Feb 2014 13:46
Location: Serbia
Contact:

Re: Problem regarding Ethernet_28j60 Library(DHCP)

#6 Post by petar.timotijevic » 11 Feb 2015 17:24

Hi,

Can you zip and attach your code.


Best regards,
Peter

abhilash485
Posts: 5
Joined: 08 Nov 2013 08:12

Re: Problem regarding Ethernet_28j60 Library(DHCP)

#7 Post by abhilash485 » 20 Feb 2015 10:57

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
Attachments
DHCP_IP_Obtain.rar
(207.36 KiB) Downloaded 276 times

maxkoryukov
Posts: 2
Joined: 10 Apr 2015 20:33

Re: Problem regarding Ethernet_28j60 Library(DHCP)

#8 Post by maxkoryukov » 10 Apr 2015 23:02

I have a solution.

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
	}


Post Reply

Return to “Libstock Discussion”