RT-Thread-packages / wiznet

WIZnet TCP/IP chips (such as W5500/W5100..) SAL framework implement.
Apache License 2.0
49 stars 35 forks source link

wizchip_connect()中while循环时间太长,会造成看门狗没法喂,使得系统重启 #45

Closed shishirong closed 1 year ago

shishirong commented 4 years ago

wizchip_socket.c int8_t wizchip_connect(uint8_t sn, uint8_t * addr, uint16_t port)之中

while (getSn_SR(sn) != SOCK_ESTABLISHED) 
{
    if (getSn_IR(sn) & Sn_IR_TIMEOUT) 
    {
        setSn_IR(sn, Sn_IR_TIMEOUT);
        return SOCKERR_TIMEOUT;
    }

    if (getSn_SR(sn) == SOCK_CLOSED) 
    {
        return SOCKERR_SOCKCLOSED;
    }
}
xiangxistu commented 3 years ago

在开启线程守护进程时,会导致系统频繁重启的问题,对吧

RulerCN commented 1 year ago

Many places in this project have the similar bugs. I don't think it's a normal design solution. But if you don't abandon it, how else can you do besides adding rt_thread_mdelay(1)?

shishirong commented 1 year ago

在开启线程守护进程时,会导致系统频繁重启的问题,对吧

就是在调用wizchip_connect()时,如果网络有问题会在while (getSn_SR(sn) != SOCK_ESTABLISHED) 里一直循环很久,造成没法调度别的任务没法喂狗。可能这个SOCKERR_TIMEOUT 的超时时间太长了吧,太久以前的issue了,记不得当时是啥情况了。