help me find the problem with wiznet w5500 ethernet

Go To Last Post
2 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi all,

 

I have a w5500 connected with stm32F4. I understand these are avrforums but the problem i am facing is actually with IC itself not the MCU. I am not pro at connecting mcu with internet, in fact this is the first time i have used an ethernet interface. Ill be grateful if you guys can help me in this matter as the avrfreaks community always has been.

 

Here is the outlook of the situation. I have 3 different ISPs installed here,

 

ISP1: 192.168.1.254

ISP2: 192.168.1.1

ISP3: 192.168.15.1

 

I have a server running. It has a static IP which is provided by ISP1 (which means there are two different connections from ISP1, one connected to server and one for general use)

I used the w5500 driver available openly on the internet and with that i have been able successfuly connect to ISP1 over ethernet and send+receive data to/from server. Now the problem is that the w5500 does not works with ISP2 or ISP3. Of course i have not written the low level driver but i have checked multiple times there is nothing hardcoded which would cause the ethernet to connect only to ISP1.

 

The state machine below takes actions according to the status registers. What i keep seeing at debug is that the state machine keeps looping between SOCKET INIT and SOCKET CLOSED.

void loopback_tcpc(SOCKET s, uint16_t port)
{  
  switch (getSn_SR(s))
  {
   case SOCK_ESTABLISHED: 	     /* if connection is established */
      if(ch_status[s]==1)
      {
         USART_SendData_s(DEBUG_COM,(unsigned char*)"Connected\r\n");
         ch_status[s] = 2;
         states.GPRSStateOk=TRUE;
         eth_ready_flag=TRUE;
      }
   break;
      
   case SOCK_CLOSE_WAIT: 	     /* If the client request to close */
      USART_SendData_s(DEBUG_COM,(unsigned char*)"CLOSE_WAIT\r\n");
      disconnect(s);
      states.GPRSStateOk=FALSE;
      ch_status[s] = 0;
   break;
      
   case SOCK_CLOSED:	             /* if a socket is closed */
      states.GPRSStateOk=FALSE;
      if(!ch_status[s])
      {
         USART_SendData_s(DEBUG_COM,(unsigned char*)"Loop-Back TCP Client Started.\r\n");
         ch_status[s] = 1;
      }
      if(socket(s, Sn_MR_TCP, any_port++, 0x00) == 0)   /* reinitialize the socket */
      {
         USART_SendData_s(DEBUG_COM,(unsigned char*)"Socket Create Failed.\r\n");
         ch_status[s] = 0;
      }
   break;
      
  case SOCK_INIT:     		     /* if a socket is initiated */
      states.GPRSStateOk=FALSE;
      connect(s, Chconfig_Type_Def.destip, Chconfig_Type_Def.port, Chconfig_Type_Def.destmac);/* Try to connect to TCP server(Socket, DestIP, DestPort) */
      USART_SendData_s(DEBUG_COM,(unsigned char*)"SOCK_INIT\r\n");
      ch_status[s] = 1;
  break;
          
  default:
      break;
  }
}

I manually give IP to ethernet (not dhcp) and i can confirm there is no IP conflict. Gateway and SUBNET are also given manually. I can verfiy these values are successfully saved in the registers because when i read the registers with following functions, w5500 returns me correct values

    getSHAR(tmp_array);
    getSIPR(tmp_array);
    getSUBR(tmp_array);
    getGAR(tmp_array);
    
/*********************************************************************************************************
                                                    getGAR
                            This function read Source IP address 
*********************************************************************************************************/
void getGAR(uint8_t * addr)
{
    wiz_read_buf(GAR0, addr, 4);
}

The only thing hardcoded is MAC address and i think it should not be a problem because it is assigned later by router right? (sorry i am not a man of networking and know very little about it)

There are no proxys, i have tried connecting the modems directly with ethernet but it does not work. Another thing i would like to mention is that i am not giving DNS anywhere since the driver i found had no such thing either. I just cant understand why it will work with ISP1 but not with ISP2 or ISP3

 

Last Edited: Mon. Sep 29, 2014 - 07:26 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

any ideas or guesses?