Hello Daniel,
Very happy to receive your reply again.
Ya, I also few very hard to make it. I did google search the key work "autoip" as you mention. I did found the autoip.c/h library. There are few function for this library but wonder what parameter should i put it and the coding looking very complicated and i'm lose! hmmm.... :(
Quote:
Note from autoip.c
/*****************
- USAGE:
-
- define LWIP_AUTOIP 1 in your lwipopts.h
-
- If you don't use tcpip.c (so, don't call, you don't call tcpip_init):
- - First, call autoip_init().
- - call autoip_tmr() all AUTOIP_TMR_INTERVAL msces,
- that should be defined in autoip.h.
- I recommend a value of 100. The value must divide 1000 with a remainder almost 0.
- Possible values are 1000, 500, 333, 250, 200, 166, 142, 125, 111, 100 ....
-
- Without DHCP:
- - Call autoip_start() after netif_add().
-
- With DHCP:
- - define LWIP_DHCP_AUTOIP_COOP 1 in your lwipopts.h.
- - Configure your DHCP Client.
-
- /
Is there anything i can try with this library?
Quote:
void autoip_init(void);
void autoip_set_struct(struct netif *netif, struct autoip *autoip);
err_t autoip_start(struct netif *netif);
err_t autoip_stop(struct netif *netif);
void autoip_arp_reply(struct netif *netif, struct etharp_hdr *hdr);
void autoip_tmr(void);
void autoip_network_changed(struct netif *netif);
And i try to review back the sample code that i tried. I found out this EthernetTesterGood ( http://mbed.org/users/JeffM/programs/EthernetTesterGood/lgncop ) sample code don't have using setup ( eth.setup(); ). I wonder is there the possibility to make it work. Hopefully this the last chances for me to try.
Ya, i did tried hardware reset. It work's. Ya, good idea, instead of using h/w reset use software reset.
I'm now trying the code. Hopefully later can work!
Best Regards,
Wen
Hello,
The following coding is successful compiled. What i tried to do in the coding is to configure the LAN ip either DHCP or fix ip rely on setting(p30). I can't get the fix-ip, I wonder why i always get the DHCP ip. Is there any wrong with my coding?
#include "mbed.h" #include "EthernetNetIf.h" DigitalOut blink(LED1); DigitalIn setting(p30); void LAN_configure_ip(void) { printf("\n\nSetting up ethernet...\r\n"); if(setting) { printf ("FixIP Config\n\r"); EthernetNetIf eth( IpAddr( 192, 168, 0, 128 ), // IP Address IpAddr( 255, 255, 255, 0 ), // Network Mask IpAddr( 192, 168, 0, 254 ), // Gateway IpAddr( 123, 456, 1, 2 ) // DNS ); } EthernetNetIf eth; printf("Ethernet setup...\r\n"); EthernetErr ethErr = eth.setup(); if(ethErr){ printf("Error %d in setup.\n\r", ethErr); return; } printf("Ethernet setup OK\r\n"); IpAddr Ip = eth.getIp(); printf("mbed IP Address is %d.%d.%d.%d\r\n", Ip[0], Ip[1], Ip[2], Ip[3]); } int main() { char temp; printf("Hello World!\n"); while(1) { if(setting != temp) { temp = setting; LAN_configure_ip(); } blink = !blink; wait(1); } }Thank you