Tool/software: Starterware
Hi! i use a TI DSP 6748 chip to communicate with PC in UDP LWIP_IGMP protocol, There are two port to receive data sent by PC at a frequency 5HZ and two port to send data to PC at a frequency 2HZ ;
As like the example(enet_lwip) in starterWare, UDP initialization Code is:
//---UDP receive---
igmp_joingroup(IP_ADDR_ANY,&Computer_B_ipAddr);
user2_1pcb = udp_new();
user2_1pcb->multicast_ip = Computer_B_ipAddr;
udp_bind(user2_1pcb, IP_ADDR_ANY, Board_Port_B_1);
udp_connect(user2_1pcb, IP_ADDR_ANY, Computer_B_1_Rx_Port);
udp_recv(user2_1pcb, UDP2_1Receive, NULL);
user2_2pcb = udp_new();
user2_2pcb->multicast_ip = Computer_B_ipAddr;
udp_bind(user2_2pcb, IP_ADDR_ANY, Board_Port_B_2);
udp_connect(user2_2pcb, IP_ADDR_ANY, Computer_B_2_Rx_Port);
udp_recv(user2_2pcb, UDP2_2Receive, NULL);
//---UDP Send---
LocalMonitor1_pcb = udp_new();
LocalMonitor1_pcb->multicast_ip = Computer_LocalMonitor_ipAddr;
Antanna_TS_pcb = udp_new();
Antanna_TS_pcb->multicast_ip = Computer_Antenna_TS_ipAddr;
//-----------------------------------------------------------------------------------------
Two receiving port can receive 180 frames data,but after that it breaks off;
In debugging, i find that the problem appeared in the UDP sending process:
In the function udp_sendto(),there is a piece of code:
netif = ip_route((ip_addr_ismulticast(dst_ip))?(&(pcb->multicast_ip)):(dst_ip));
In the function ip_route: it runs in the following codes all the time, so that the sending and receiving port do not work;
/* iterate through netifs */
for(netif = netif_list; netif != NULL; netif = netif->next) {
/* network mask matches? */
if (netif_is_up(netif)) {
if (ip_addr_netcmp(dest, &(netif->ip_addr), &(netif->netmask))) {
/* return netif on which to forward IP packet */
return netif;
}
}
}
//----------------------------------------