WIZnet Developer Forum

can't receive multicast packet and respond

I initialized the 2nd socket according to the manual like below.

{
START:
Sn_MR = 0x02; /* sets UDP mode */
Sn_PORT0 = source_port; /* sets source port number */
Sn_CR = OPEN; /* sets OPEN command */
/* wait until Sn_SR is changed to SOCK_UDP */
if (Sn_SR != SOCK_UDP) Sn_CR = CLOSE; goto START;
}

i can receive broadcast, unicast packet. But can’t receive multicast. I tested it on w5100 and works too. But not with w5500.

I can able to make it work on w5500 by enabling multicast like below. But i can’t respond with unicast packet to the multicast sender. It can only responds multicast packet. Could anybody please help me on this? Thank you.

{
START:
/* set Multicast-Group information */
Sn_DHAR0 = 0x01; /* set Multicast-Group H/W address(01:00:5e:01:01:0b) */
Sn_DHAR1 = 0x00;
Sn_DHAR2 = 0x5E;
Sn_DHAR3 = 0x01;
Sn_DHAR4 = 0x01;
Sn_DHAR5 = 0x0B;
Sn_DIPR0 = 211; /* set Multicast-Group IP address(211.1.1.11) */
Sn_DIPR1 = 1;
Sn_DIPR2 = 1;
Sn_DIRP3 = 11;
Sn_DPORT0 = 0x0BB8; /* set Multicast-GroupPort number(3000) */
Sn_PORT0 = 0x0BB8; /* set SourcePort number(3000) */
Sn_MR = 0x02 | 0x80; /* set UDP mode & Multicast on Socket n Mode Register */
Sn_CR = OPEN; /* set OPEN command */
/* wait until Sn_SR is changed to SOCK_UDP */
if (Sn_SR != SOCK_UDP) Sn_CR = CLOSE; goto START;
}

Dear ganzo

I think you have to use the other socket for unicast packet.
Please refer to the following link.
http://www.wiznet.io/product-item/w5100/
Please download W5100 Application Note.
There are example source and tutorial PDF file.
Unfortunately, there are no Application Note for the W5500.
You can modify W5100 case to W5500 case by the reference link below.
http://wizwiki.net/wiki/doku.php?id=products:w5500:application:udp_function#multicast

Thanks.

Dear Jim
Thank you for your answer. I was able to make it work by doing exactly what you said.
I configured 1 socket for multicast reception. And other socket for unicast reply.
So in total 2 sockets were used.

Thank you

Copyright © 2017 WIZnet Co., Ltd. All Rights Reserved.