This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Ethernet Stop working

Hello
Here is my program

int main (void) {
        net_initialize();
        socket = tcp_get_socket (TCP_TYPE_SERVER, 0, 20, tcp_callback);

                if (socket) {
                tcp_listen (socket, 4050);
                }

        if (tcp_check_send(socket) ){
        sprintf(msg,"W%04d%04d%04d%04d%04d%04d%04d%04d%05dR\n",10,20,30,40,50,60,70,80,90);
        len=sizeof(msg);
        sendbuf = tcp_get_buf (len);
        memcpy (sendbuf, msg, len);
        tcp_send (socket, sendbuf,len);
                                }

                                 osDelay (1000);

                }

}

when I remove this par

        if (tcp_check_send(socket) ){
        sprintf(msg,"W%04d%04d%04d%04d%04d%04d%04d%04d%05dR\n",10,20,30,40,50,60,70,80,90);
        len=sizeof(msg);
        sendbuf = tcp_get_buf (len);
        memcpy (sendbuf, msg, len);
        tcp_send (socket, sendbuf,len);
                                }


I can't connect to chip via TCP/IP protocol but it shows only

W0010002000300040005000600070008000090R

and the do nothing but connection is alive.and when I add

        if (tcp_check_send(socket) ){
        sprintf(msg,"W%04d%04d%04d%04d%04d%04d%04d%04d%05dR\n",10,20,30,40,50,60,70,80,90);
        len=sizeof(msg);
        sendbuf = tcp_get_buf (len);
        memcpy (sendbuf, msg, len);
        tcp_send (socket, sendbuf,len);
                                }

I can't open the port and I fail to connect to my chip.

what is my mistake?

Parents
  • Hello
    I download the MDK v7.0 but ping command (in my pc) can't detect my board IP.My all configs are the same as the old ones ( with MDK v6.5) but it doesn't do anything.

    uint32_t Tcp_Stat(int32_t socket, netTCP_Event event, const NET_ADDR *addr, const uint8_t *buf, uint32_t len) ;
    
    int main (void) {
            netInitialize ();
            sock = netTCP_GetSocket (Tcp_Stat);
            netTCP_SetOption (sock,netTCP_OptionTimeout, 120);
                    if (sock >=0) {
                    netTCP_Listen (sock, 4050);
            }
    
    
            while(1){}
    }
    
    
    uint32_t Tcp_Stat(int32_t socket, netTCP_Event event, const NET_ADDR *addr, const uint8_t *buf, uint32_t len) {
      switch (event) {
        case netTCP_EventConnect:return (1);
        case netTCP_EventEstablished:break;
        case netTCP_EventClosed :break;
        case netTCP_EventAborted:break;
        case netTCP_EventACK :break;
                    case netTCP_EventData:break;
      }
      return (0);
    }
    
    
    

    should I do anything else?

Reply
  • Hello
    I download the MDK v7.0 but ping command (in my pc) can't detect my board IP.My all configs are the same as the old ones ( with MDK v6.5) but it doesn't do anything.

    uint32_t Tcp_Stat(int32_t socket, netTCP_Event event, const NET_ADDR *addr, const uint8_t *buf, uint32_t len) ;
    
    int main (void) {
            netInitialize ();
            sock = netTCP_GetSocket (Tcp_Stat);
            netTCP_SetOption (sock,netTCP_OptionTimeout, 120);
                    if (sock >=0) {
                    netTCP_Listen (sock, 4050);
            }
    
    
            while(1){}
    }
    
    
    uint32_t Tcp_Stat(int32_t socket, netTCP_Event event, const NET_ADDR *addr, const uint8_t *buf, uint32_t len) {
      switch (event) {
        case netTCP_EventConnect:return (1);
        case netTCP_EventEstablished:break;
        case netTCP_EventClosed :break;
        case netTCP_EventAborted:break;
        case netTCP_EventACK :break;
                    case netTCP_EventData:break;
      }
      return (0);
    }
    
    
    

    should I do anything else?

Children
No data