W5100 sendto 타임 아웃 문의

#1

아래 코드로 구현하여 udp 소켓(2번)생성 후 데이타 전송하는데 타임아웃(BROS_sendto 함수 참조)이 걸리네요
무었때문인지 영문을 모르겠네요…
참고로 ip등 네트웍 설정은 정상으로 r/w됩니다.

//mcu-w5100 통신방식: spi 통신

//////////////////////////소켓 생성 루틴/////////////////////////////////////
BROS_Ethernet_udp(BROS_UDP_SOCK_NUM, BROS_MY_CONNECT_PORT, BROS_data_buf,0); //udp 소켓 생성
void BROS_Ethernet_udp(BROS_SOCKET s, u16 port, u8* buf, u16 mode)
{
switch(BROS_getSn_SR(s)){
case BROS_SOCK_UDP:
if((BROS_len=BROS_getSn_RX_RSR(s)) > 0){ // check the size of received data
//len = BROS_recvfrom(s,buf,len,destip,&destport); //RUI_RecvMessage에서 데이터 취한다
BROS_RecvMessage(s);
//if(len !=sendto(s,buf,len,destip,destport)){ // send the data to the destination
// printf("%d : Sendto Fail.len=%d,",s,len);
// printf("%d.%d.%d.%d(%d)\r\n",destip[0],destip[1],destip[2],destip[3],destport);
//}
}
break;
case BROS_SOCK_CLOSED: // CLOSED
BROS_close(s); // close the SOCKET
BROS_socket(s,BROS_Sn_MR_UDP,port,mode); // open the SOCKET with UDP mode
break;
default:
break;
}
}

//////////////////////////데이터 전송 루틴/////////////////////////////////////
if(Len !=BROS_sendto(BROS_UDP_SOCK_NUM, pDataByte,Len, iMyCtl.BorsServerIp, BROS_destport)){
DisMsg("\r\n %d : Sendto Fail.len=%d,",BROS_UDP_SOCK_NUM,Len,0);
}

BROS_uint16 BROS_sendto(생략)
{
BROS_uint8 status=0;
BROS_uint8 isr=0;
BROS_uint16 ret=0;

#ifdef BROS_DEF_IINCHIP_DBG
StrMsg(“BROS_sendto()\r\n”);
#endif
if (len > BROS_getIINCHIP_TxMAX(s))
ret = BROS_getIINCHIP_TxMAX(s); // check size not to exceed MAX size.
else ret = len;
if(
((addr[0] == 0x00) && (addr[1] == 0x00) && (addr[2] == 0x00) && (addr[3] == 0x00)) ||((port == 0x00)) |(ret == 0))
{
;
#ifdef BROS_DEF_IINCHIP_DBG
//StrMsg("%d Fail[%.2x.%.2x.%.2x.%.2x, %.d, %d]\r\n",s, addr[0], addr[1], addr[2], addr[3] , port, len);
StrMsg(“BROS_Fail[invalid ip,port]\r\n”);
#endif
}
else{
BROS_IINCHIP_WRITE(BROS_Sn_DIPR0(s),addr[0]);
BROS_IINCHIP_WRITE((BROS_Sn_DIPR0(s) + 1),addr[1]);
BROS_IINCHIP_WRITE((BROS_Sn_DIPR0(s) + 2),addr[2]);
BROS_IINCHIP_WRITE((BROS_Sn_DIPR0(s) + 3),addr[3]);
BROS_IINCHIP_WRITE(BROS_Sn_DPORT0(s),(BROS_uint8)((port & 0xff00) >> 8));
BROS_IINCHIP_WRITE((BROS_Sn_DPORT0(s) + 1),(BROS_uint8)(port & 0x00ff));

// copy data
BROS_send_data_processing(s, (BROS_uint8 *)buf, ret);
	BROS_IINCHIP_WRITE(BROS_Sn_CR(s),BROS_Sn_CR_SEND);
	while(BROS_IINCHIP_READ(BROS_Sn_CR(s)));								//전송될때까지 대기
	
	while ( (BROS_IINCHIP_READ(BROS_Sn_IR(s)) & BROS_Sn_IR_SEND_OK) != BROS_Sn_IR_SEND_OK )
	{
		status = BROS_IINCHIP_READ(BROS_Sn_SR(s));

#ifndef BROS_DEF_IINCHIP_INT
isr = BROS_IINCHIP_READ(BROS_Sn_IR(s));
#endif
if ((isr & BROS_Sn_IR_TIMEOUT) || (BROS_getISR(s) & BROS_Sn_IR_TIMEOUT))
{
#ifdef BROS_DEF_IINCHIP_DBG
StrMsg(“BROS_send fail.\r\n”);
#endif
BROS_putISR(s, BROS_getISR(s) & (BROS_Sn_IR_RECV | BROS_Sn_IR_DISCON | BROS_Sn_IR_CON)); /* clear SEND_OK & TIMEOUT in I_STATUS[s] */
BROS_IINCHIP_WRITE(BROS_Sn_IR(s), (BROS_Sn_IR_SEND_OK | BROS_Sn_IR_TIMEOUT)); // clear SEND_OK & TIMEOUT in Sn_IR(s)
return 0;
}
}
BROS_putISR(s, BROS_getISR(s) & (~BROS_Sn_IR_SEND_OK));
BROS_IINCHIP_WRITE(BROS_Sn_IR(s), BROS_Sn_IR_SEND_OK);

}
return ret;

}

#2

네트웍 설정에서 서브넷과 게이트웨이 ip가 바뀌었었네요 …