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
  • Dear Zack
    Thank you for your explanation
    I change my network component to V7 beta but in this states with this new code and other settings(Such as SPI and IP) I can't ping device's IP

    
    #include "cmsis_os.h"
    #include "rl_net.h"
    
    uint32_t sock;
    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_OptionTOS, 30);
                    if (sock >=0) {
                    netTCP_Listen (sock, 2000);
            }
    
                    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);
    }
    
    

    what is my mistake?

Reply
  • Dear Zack
    Thank you for your explanation
    I change my network component to V7 beta but in this states with this new code and other settings(Such as SPI and IP) I can't ping device's IP

    
    #include "cmsis_os.h"
    #include "rl_net.h"
    
    uint32_t sock;
    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_OptionTOS, 30);
                    if (sock >=0) {
                    netTCP_Listen (sock, 2000);
            }
    
                    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);
    }
    
    

    what is my mistake?

Children