W5500 链接速度慢

MicroPython相关代码、库、软件、工具
回复
skylin008
帖子: 22
注册时间: 2020年 7月 21日 20:26

W5500 链接速度慢

#1

帖子 skylin008 »

各位大佬好,发现以太网芯片 W5500 需要比较长的时间(接近 3秒 )才能 连接上, 以下是参考代码,有什么办法改善,谢谢!

class Ethernet():    
    def __init__(self, max_try = 50,debug = False):
        spi = SPI(1, SPI.MASTER, baudrate = 20000_000)        # baudrate 20000000 bps
        cs = Pin('E_SS', mode= Pin.OUT)                    
        rst =Pin('E_RST', mode= Pin.OUT)
        rst.value(0)
        delay(10)
        rst.value(1)
        self._debug = debug
        self._run = False
        nic = network.WIZNET5K(spi, cs, rst)
        nic.active(False)
        nic.active(True)        
        if dhcp == True:            
            nic.ifconfig('dhcp')
        else:
            nic.ifconfig((IP_ADDRESS, SUBNET_MASK, GATEWAY_ADDRESS, DNS_SERVER))
        cnt = 0        
        
        while not nic.isconnected():                                       # wait connected
            cnt = cnt + 1
            utime.sleep_ms(50)
            if max_try is not None and cnt >= max_try:
                if self._debug:
                    print("Couldn't establish a connection!\r\n")
                break
 
 
 

回复

  • 随机主题
    回复总数
    阅读次数
    最新文章