>Hi!>>you say > >3/ Our main interrest with LwIP was to use DHCP. By reading 
>the dhcp.cfi>le, it says the following things: >   - change LWIP_DHCP to 1 in 
>lwipopts.h which is in the port>directory. >   - change value of 
>DHCP_COARSE_TMR and another one so that the first>one is called every 60s and 
>the other 500ms.>    - then call the respective functions for these values and 
>call>dhcp_start(struct netif); >>that sounds that somehow your dhcp code isn't 
>built or something>similar. I had the same problem, but in may case it was the 
>LWIP_DHCP>define. Are you sure you "updated" your projekt so that after a 
>change>in your projekt all c files are recompiled with the different define 
>in>the .h files? with GCC you have to do a make clean that such changes 
>are>done..>Or maybe you forgot to add the dhcp.c file to your Makefile or what 
>is>the equivalent in your compiler?> >Dominik
 
Thank you dominik for your answer. Actually I solved this, I had missed a 
couple of makefiles, I thought I got them all but it was not the case.
Now, everything is compiliing fine but then the dhcp is not working.
 
I will copy paste my code where I start the initialization of the dhcp using 
dhcp_start() if you could tell me if that is correct. Then also, my timer if 
somehow how you can call these dhcp_finetmr or dhcp_coarse function every 60s 
or 500ms because I played a lot with the timer and could't figure out
how to do it precisely.
 
Thank you very much again,
 
struct ip_addr ipaddr;
struct ip_addr netmask;
struct ip_addr gw;
struct netif *netif = NULL;
//Set the MAC address: 
xemacliteif_setmac(0, (u8_t *)mac);
//Set IP address, Network mask and gateway:
IP4_ADDR(&ipaddr, ip[0], ip[1], ip[2], ip[3]);
IP4_ADDR(&netmask, subnet[0], subnet[1], subnet[2], subnet[3]);
IP4_ADDR(&gw, gateway[0], gateway[1], gateway[2], gateway[3]);
//Allocate memory for the netif strycture: 
netif = mem_malloc(sizeof(struct netif));
if(NULL == netif) {
print("mem_alloc(): echec.\n\r");
return NULL;
}
//Instanciate the new netif structure with given parameters: 
netif = netif_add(netif, &ipaddr, &netmask, &gw, 
&XEmacLiteIf_ConfigTable[EMAC], xemacliteif_init, ip_input);
if(NULL == netif) {
print("netif_add(): failed.\n\r");
return NULL;
}
//Set the new netif as default netif: 
netif_set_default(netif);
dhcp_start(netif);
 
As for the timer(very rough for now):
I know dhcp_fine_tmr is said to be called every 5ms but in the xilinx doc, they 
say they call should be called
every 200ms and 500ms and in theyre tmr function of the echo example (which is 
my basis), they say there are
called every 2ms and 5ms:
 
void my_tmr(void)
{
++my_timer;
++my_timer2;

if(my_timer == 10) {
my_timer = 0;
}

if(my_timer2 >= 200) {
dhcp_coarse_tmr(); 
}
if(my_timer & 1) {
/* Call tcp_fasttmr() every 2 ms, i.e.,
* every other timer my_tmr() is called. */
tcp_fasttmr();
}
if(my_timer == 0 || my_timer == 5) {
/* Call tcp_slowtmr() every 5 ms, i.e.,
* every fifth timer my_tmr() is called. */
tcp_slowtmr();
dhcp_fine_tmr(); 

if (tcp_ticks%2000 == 0)
/* Call etharp_tmr() every 20th call to tcp_slowtmr().
* tcp_ticks is a global var defined in core/tcp.c */
etharp_tmr();
}
}
 
 
Antoine.
_________________________________________________________________
Windows Live Messenger vous offre 30 nouvelles émoticônes gratuites, installées 
directement dans votre Messenger !
http://www.emoticones-messenger.fr/
_______________________________________________
lwip-users mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/lwip-users

Reply via email to