chipKIT® Development Platform

Inspired by Arduino™

Ethernet Library and DHCP

Created Wed, 11 Jan 2012 00:22:41 +0000 by kiwifly


kiwifly

Wed, 11 Jan 2012 00:22:41 +0000

Hello,

Does anyone have a way of reading and then subsequently printing to the serial port, the IP address of a chip kit board. The original Arduino ethernet library included a couple of extra bits that were useful with DHCP. firstly the Ethernet.begin function returned a 0 if the DHCP request had failed. and also it had an extra class LocalIP which returned the ip address. I have a device i am building which logs readings from a pulse meter and then when requested gives the reading to a piece of software that does the rest. I do need the ip address to be fixed so i can communicate but because i will be programming quite a lot of them I wanted to just download the same program in without having to change the ip address each time so I was hoping to use DHCP and lock it to the mac address with the router. Problem is I would like to show the ip address in the boot up sequence on the serial port and i would like to show an error on the serial port if it fails to get an ip address, and also if it fails DHCP i would then like to assign it a default manual address. I cannot see how i can do this with the chipKIT ethernet library so was hoping someone else had come up with something or perhaps it could be added to the library.

thanks

Kiwifly


Jacob Christ

Wed, 11 Jan 2012 07:43:59 +0000

I haven't tried this, but it looks like if you include "ChipKitEthernetAPI.h" that it exposes a variable called IP_ADDR that is a four byte array that would contain the IP address.

Jacob


KeithV

Sat, 14 Jan 2012 20:47:22 +0000

Digilent just released a new IP library called DNETcK and is part of the most recent chipKIT Network Shield library download. The DNETcK library is much more comprehensive in functionality, getting the IP, MAC is all supported as well as a ton of other new features. Please read the document as the IP model is enough different that it IS different from the old chipKITEthernet library, but enough the same that you might make some bad assumptions.

Goto:

http://www.digilentinc.com/Products/Detail.cfm?NavPath=2,892,942&Prod=CHIPKIT-NETWORK-SHIELD

and download the DSD-0000318 library. In there you will find both the old chipKITEthernet libarary as well as the re-tooled DNETcK library.

Please read the document as there are a ton of new features and it sports a more consistent programing model.


kiwifly

Sun, 15 Jan 2012 22:03:06 +0000

Thank you both for your answers and thanks for letting me know about the new library Keith