Other Parts Discussed in Thread: DP83869
Hi,
I'm trying to test IGMP function in AM2634 EVM board base on the frertos lwip example(SDK v8.2).
The brief modification list below:
1. Make sure LWIP_IGMP is enable.
2. add NETIF_FLAG_IGMP to netif_default
3. Join multicast group with igmp_joingroup()
4. udp_new() -> udp_bind() -> udp_recv()
I can ping with host PC and receive unicast packet but I can't receive any multicast packet.
I'm not sure should I modify any configuration in enet driver.
Could you help to clarify what I'm missing? Or is there any example to send/receive IGMP with lwip in AM263x?
=============================================================================
bool netInit(netPath_t *netPath, ptpClock_t *ptpClock)
{
(void)(ptpClock); // UNUSED
ip4_addr_t as,as2;
LOCK_TCPIP_CORE(); // System must support core locking!
DBG("netInit\n");
/* Join multicast group (for receiving) on specified interface */
netPath->multicastAddr.addr = DEFAULT_PTP_DOMAIN_ADDRESS;
IP4_ADDR(&as, 224, 0, 1, 129);
uint8_t ret = (uint8_t)igmp_joingroup(IP_ADDR_ANY, &as);
DBG("[Josh] igmp_joingroup return = 0x%X\n", ret);
/* Join peer multicast group (for receiving) on specified interface */
netPath->peerMulticastAddr.addr = PEER_PTP_DOMAIN_ADDRESS;
IP4_ADDR(&as2, 224, 0, 0, 107);
ret = igmp_joingroup(IP_ADDR_ANY, &as2);
DBG("[Josh] igmp_joingroup return = 0x%X\n", ret);
/* Initialize the buffer queues. */
netHandlerInit(&netPath->eventHandler, &netPath->multicastAddr, PTP_EVENT_PORT);
netHandlerInit(&netPath->generalHandler, &netPath->multicastAddr, PTP_GENERAL_PORT);
/* Return a success code. */
UNLOCK_TCPIP_CORE();
return true;
}
=================================================================================
static void netHandlerInit(packetHandler_t *handler, ip_addr_t *defaultAddr,
u16_t port)
{
err_t err;
/* Initialise mailboxes */
sys_mbox_new(&handler->inbox, PBUF_QUEUE_SIZE);
sys_mbox_new(&handler->outbox, PBUF_QUEUE_SIZE);
DBGV("netHandlerInit: handler - %lu\n", handler);
/* Create UDP PCB */
handler->pcb = udp_new();
if (NULL == handler->pcb) {
ERROR("netInit: Failed to open UDP PCB\n");
return;
}
/* Multicast send only on specified interface. */
handler->pcb->mcast_ip4.addr = defaultAddr->addr;
/* Establish the appropriate UDP bindings/connections for events. */
err = udp_bind(handler->pcb, IP_ADDR_ANY, port);
if (err == ERR_OK) {
udp_recv(handler->pcb, netRecvCallback, handler);
} else {
udp_remove(handler->pcb);
ERROR("Can't bind pcb\n");
}
}
================================================================================
[Log]
==========================
ENET LWIP App
==========================
igmp_start: starting IGMP processing on if 70165188
igmp_lookup_group: allocated a new group with address 0.0.0.0 on if 70165188
igmp_report_groups: sending IGMP reports on if 70165188
igmp_init: initializing
Starting lwIP, local interface IP is 192.168.31.246
[Josh] init_default_netif() netif.flags = 0x0
CPSW_3G Test on MAIN NAVSS
EnetPhy_bindDriver: PHY 0: OUI:080028 Model:0f Ver:01 <-> 'dp83869' : OK
PHY 0 is alive
Host MAC address: 70:ff:76:1d:ec:f2
[LWIPIF_LWIP] Enet has been started successfully
[LWIPIF_LWIP] NETIF INIT SUCCESS
igmp_start: starting IGMP processing on if 70165218
igmp_lookup_group: allocated a new group with address 224.0.0.1 on if 70165218
status_callback==UP, local interface IP is 192.168.31.246
[Josh]: netif_default->flags = 0x29
PTPd initialising...
leaving state PTP_INITIALIZING
entering state PTP_INITIALIZING
manufacturerIdentity: PTPd;2.0.1
netShutdown
netInit
igmp_lookup_group: allocated a new group with address 224.0.1.129 on if 70165218
igmp_joingroup_netif: join to new group: 224.0.1.129
igmp_lookup_group: allocated a new group with address 224.0.1.129 on if 70165188
igmp_joingroup_netif: join to new group: 224.0.1.129
[Josh] igmp_joingroup return = 0x0
igmp_lookup_group: allocated a new group with address 224.0.0.107 on if 70165218
igmp_joingroup_netif: join to new group: 224.0.0.107
igmp_lookup_group: allocated a new group with address 224.0.0.107 on if 70165188
igmp_joingroup_netif: join to new group: 224.0.0.107
[Josh] igmp_joingroup return = 0x0
netHandlerInit: handler - 1880496616
netHandlerInit: handler - 1880496764
igmp_input: message from 127.0.0.1 to address 224.0.1.129 on if 70165188
igmp_input: IGMP_V2_MEMB_REPORT
igmp_input: message from 127.0.0.1 to address 224.0.0.107 on if 70165188
igmp_input: IGMP_V2_MEMB_REPORT
igmp_timeout: report membership for group with address 224.0.1.129 on if 70165218
initData
initData: EUI48toEUI64
initClock
adjFreq 0
bmc: m1
leaving state PTP_INITIALIZING
entering state PTP_LISTENING
------------------------------------
igmp_timeout: report membership for group with address 224.0.0.107 on if 70165218
Cpsw_handleLinkUp: Port 1: Link up: 1-Gbps Full-Duplex
MAC Port 1: link up
igmp_report_groups: sending IGMP reports on if 70165218
link_callback==UP
igmp_timeout: report membership for group with address 224.0.1.129 on if 70165218
igmp_timeout: report membership for group with address 224.0.0.107 on if 70165218
Regards,
Josh