Dear WIZNET support,
We have problem with W3150A+:
-
Configured one port to be UDP, that send NTP request and receive it correct– working good.
-
After socket initialization to the same port configured to TCP as Server, the PC (client) communicate with this port, the PC read data from that port – working good.
-
After socket initialization to the same port configured to UDP again, try sending NTP request, it is not sending good.
Before the 1st NTP request the WIZNET sent ARP, and received the HW address 3c:1e:04:08:12:09
The PC (TCP client) HW address was 00:23:ae:3b:58:c1.
Before the 2nd NTP request the WIZNET do not sent ARP, and the NTP sent to the HW address of the PC (00:23:ae:3b:58:c1), not 3c:1e:04:08:12:09.
The socket initialization changed to your recommendation :
uint8 socket(SOCKET s, uint8 protocol, uint16 port, uint8 flag)
{
uint8 ret;
uint8 mac[6]) = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
if ((protocol == Sn_MR_TCP) || (protocol == Sn_MR_UDP) || (protocol == Sn_MR_IPRAW) || (protocol == Sn_MR_MACRAW) || (protocol == Sn_MR_PPPOE))
{
while((IINCHIP_READ(Sn_TX_WR(s))) != ( IINCHIP_READ(Sn_TX_RD(s)))); // wait until Sn_TX_RD and Sn_TX_WR are same close(s);
IINCHIP_WRITE(Sn_MR(s),protocol | flag);
if (port != 0)
{
IINCHIP_WRITE(Sn_PORT0(s),(uint8)((port & 0xff00) >> 8));
IINCHIP_WRITE((Sn_PORT0(s) + 1),(uint8)(port & 0x00ff));
}
else
{
local_port++; // if don't set the source port, set local_port number.
IINCHIP_WRITE(Sn_PORT0(s),(uint8)((local_port & 0xff00) >> 8));
IINCHIP_WRITE((Sn_PORT0(s) + 1),(uint8)(local_port & 0x00ff));
}
setSn_DHAR (s, mac); // Reset DHAR
IINCHIP_WRITE(Sn_CR(s),Sn_CR_OPEN); // run sockinit Sn_CR
/* +200804[woong]:wait to process the command... */
while( IINCHIP_READ(Sn_CR(s)) );
/* ------- */
ret = 1;
}
else
{
ret = 0;
}
return ret;
}
Thanks in advance
Ronit