Hi, in 2010 we ordered to a developement company to implemented the lwip for TCP/IP support on freescale ColdFire microprocessor mcf52233. The company that made the implementation does not exist any more.
We have a problem because we now want to implement DHCP client to the processor. I followed the tutorials "http://lwip.wikia.com/wiki/DHCP" but failed to achieve this. the following function is called before the infinite loop function - it just initialize DHCP. void InitDhcp(void) { struct ip_addr xIpAddr, xNetMask, xGateway; extern err_t mcf5223xif_init( struct netif *netif ); struct netif *myNetif; struct pbuf *myPbuf; IP4_ADDR( &xIpAddr,0,0,0,0 ); IP4_ADDR( &xNetMask,0,0,0,0 ); IP4_ADDR( &xGateway,0,0,0,0 ); netif_set_addr(myNetif, &xIpAddr, &xNetMask, &xGateway); //mcf5223xif_init(myNetif); //tcpip_input(myPbuf, myNetif); netif_add(myNetif, &xIpAddr, &xNetMask, &xGateway, NULL, mcf5223xif_init, tcpip_input); // this function resets the processor every second netif_set_default(myNetif); dhcp_start(myNetif); } This function is run every time in infinite loop function void getNetAddressFromDHCP(void) { UINT32 finalTime = CSS_GetTime(NULL); UINT32 msFinalTime = GetTimerInms(); if (mcf5223xif_link() == 1) { if (netif_default->ip_addr.addr == 0) { finalTime = ihrc_get_ms_counter(); if ((finalTime - minuteMSTime) >= 60) { /** to be called every minute */ dhcp_coarse_tmr(); minuteMSTime = CSS_GetTime(NULL); } else if ((finalTime - fiftyMSTime) >= 500) { /** to be called every half second */ dhcp_fine_tmr(); fiftyMSTime = GetTimerInms(); } } } } Because I failed to activate DHCP i try to make a simple DHCP discover to the DHCP server using UDP protocol. The server receives the request and sends back the DHCP offer. But i failed to receive the package. I am using this code to do this: struct udp_pcb * upcb; udp_bind(upcb, IP_ADDR_ANY, 67); udp_recv(upcb, receive_udp_packet, NULL); the callback function looks like this: void receive_udp_packet(void *arg, struct udp_pcb *upcb, struct pbuf *p, struct ip_addr *addr, u16_t port) { struct ip_addr myaddr; myaddr = *addr; if (p != NULL) { /* send received packet back to sender */ udp_sendto(upcb, p, &myaddr, port); /* free the pbuf */ pbuf_free(p); } } this should just send the echo package received from the server. Do you guys know what I did wrong? I am sorry that I can not provide any usefull information regarding the used lwip, but i checked the header files but I can not find the version of the lwip. Maybe you know where should I look. Can you guys help me with this? Thanks and best regards, BG. _______________________________________________ lwip-users mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/lwip-users
