Hi Becky,
I think this might be related to another problem I am seeing.
My packets from socket 0 and socket 1 are as I would expect, but everything coming out of socket 3 and socket 4 is not what I am sending at all. DNS was tested on socket 4
Here I am sending the exact same packet, from the same buffer on socket 2 and socket 3, with different outputs. Socket 2 is the correct data in the left of the screenshot below.
static void logPacketOverEthernet(void)
{
uint8_t test[] = "testo\n";
int32_t udpTxStatus;
uint8_t testIP[] = {192,168,1,101};
// Send the packet
udpTxStatus = sendto(SOCKET_UDP1, &test, sizeof(test), &testIP[0], defaultUdpDstPort);
udpTxStatus = sendto(SOCKET_UDP2, &test, sizeof(test), &testIP[0], defaultUdpDstPort);
if(udpTxStatus<1){
// failed
}
}
My initialisation is here:
void w5100s_init(void)
{
// Pull the chip out of reset
PIN_setOutputValue(ethPinHandle, Board_ETHERNET_RST, 1);
// Wait 62ms for startup
Task_sleep(62*(1000/Clock_tickPeriod));
intr_kind temp = IK_SOCK_ALL;
unsigned char W5100S_AdrSet[2][4] = {{2,2,2,2},{2,2,2,2}};
/*
*/
temp = IK_DEST_UNREACH;
if(ctlwizchip(CW_INIT_WIZCHIP,(void*)W5100S_AdrSet) == -1)
{
printf("W5100S initialized fail.\r\n");
}
if(ctlwizchip(CW_SET_INTRMASK,&temp) == -1)
{
printf("W5100S interrupt\r\n");
}
uint8_t tmp1, tmp2;
uint8_t phyChecks = 0;
// Check a link exists (i.e. Ethernet connectet)
while(1){
ctlwizchip(CW_GET_PHYLINK, &tmp1 );
ctlwizchip(CW_GET_PHYLINK, &tmp2 );
if(tmp1==PHY_LINK_ON && tmp2==PHY_LINK_ON) break;
phyChecks++;
if(phyChecks>4) break; // TODO Use this to return 0; and do better management of Ethernet in general
}
ctlnetwork(CN_SET_NETINFO, (void*) &gWIZNETINFO);
/* Initialise UDP socket for Etherbridge Multicast communication */
do{
setSn_RTR(SOCKET_UDP2, 2000) // Retry time: 2000*100us = 0.2s
setSn_RCR(SOCKET_UDP2, 2); // Num retries
setSn_IMR(SOCKET_UDP2, 0xFF-6); // Int Mask Reg (Turn off Recv, Dcon, Con interrupts)
setSn_MR(SOCKET_UDP2, Sn_MR_MC | Sn_MR_MULTI | Sn_MR_UDP); // Multcast, UDP
setSn_MR2(SOCKET_UDP2,0x20); // Block UDP broadcast packets
setSn_PORT(SOCKET_UDP2, defaultUdpSrcPort); // Source port
setSn_DPORT(SOCKET_UDP2, defaultUdpDstPort); // Destination port
setSn_CR(SOCKET_UDP2, Sn_CR_OPEN); // Command Reg: open socket
} while(getSn_SR(SOCKET_UDP2) != SOCK_UDP); // Check socket has been configured and started
/* Initialise the socket for UDP datalogging */
do{
setSn_RTR(SOCKET_UDP1, 2000) // Retry time: 2000*100us = 0.2s
setSn_RCR(SOCKET_UDP1, 2); // Num retries
setSn_IMR(SOCKET_UDP1, 0xFF-6); // Int Mask Reg (Turn off Recv, Dcon, Con interrupts)
setSn_MR(SOCKET_UDP1, Sn_MR_MC | Sn_MR_MULTI | Sn_MR_UDP); // Multcast, UDP
setSn_MR2(SOCKET_UDP1,0x20); // Block UDP broadcast packets
setSn_PORT(SOCKET_UDP1, defaultUdpSrcPort); // Source port
setSn_DPORT(SOCKET_UDP1, defaultUdpDstPort); // Destination port
setSn_CR(SOCKET_UDP1, Sn_CR_OPEN); // Command Reg: open socket
} while(getSn_SR(SOCKET_UDP1) != SOCK_UDP); // Check socket has been configured and started
}
I thought it could be a RX/TX memory allocation issue, but it seems the default is 2kB RX/TX for each socket. I have checked that the RMSR and TMSR registers on the device are set to the default (0x55).