The WIZNET5500 reception is a bit slow

The official pyboard running MicroPython.
This is the reference design and main target board for MicroPython.
You can buy one at the store.
Target audience: Users with a pyboard.
Post Reply
User avatar
Meekdai
Posts: 45
Joined: Mon Jan 29, 2018 12:45 pm

The WIZNET5500 reception is a bit slow

Post by Meekdai » Sat Sep 29, 2018 5:49 am

I refer to the following to configure my pyboard and w5500.
https://github.com/micropython/micropyt ... 26da083558
Then I send a piece of data from the PC, and pyboard successfully received it. But when I send data from the PC every 100ms, my pyboard obviously does not receive smoothly.

Here is my code:

Code: Select all

    def read(self):
        if self._need_check:
            self._check_socket_state()

        msg_bytes = None
        try:
            print("read start\r\n")
            msg_bytes = self.ws.read()
            print(msg_bytes)
            print(rtc.datetime())

        except OSError:
            self.client_close = True

        if not msg_bytes and self.client_close:
            raise ClientClosedError()

        return msg_bytes
See the data I received in the REPL:

Code: Select all

read start

None
(2018, 9, 29, 1, 12, 48, 28, 53)
read start

None
(2018, 9, 29, 1, 12, 48, 28, 53)
read start

b'{"functionName":"setTemperature","ID":"LOW_CYLINDER","temperature":-273.15}\r\n{"functionName":"setTemperature","ID":"LOW_CYLINDER","temperature":-273.15}\r\n{"functionName":"setTemperature","ID":"LOW_CYLINDER","temperature":-273.15}\r\n'
(2018, 9, 29, 1, 12, 48, 28, 52)
read start

None
(2018, 9, 29, 1, 12, 48, 28, 50)
read start

None
(2018, 9, 29, 1, 12, 48, 28, 50)
read start
Here is my wiznet regs:

Code: Select all

Wiz CREG:
  0000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0010: 00 00 00 00 00 80 00 01 00 07 d0 08 28 00 00 00
  0020: 00 00 00 00 00 00 ff ff 00 00 00 00 00 00 bf 00
  0030: 00 00 00 00 00 00 00 78 25 04 00 00 00 00 00 00
  0040: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
Wiz SREG[0]:
  0000: 84 00 04 42 c0 00 ff ff ff ff ff ff 00 00 00 00
  0010: 00 00 05 c0 00 00 80 00 00 00 00 00 00 00 10 10
  0020: 40 00 12 cb 12 cb 00 00 4f 9e 4f 9e ff 40 00 00
Wiz SREG[1]:
  0000: 00 00 00 00 00 00 ff ff ff ff ff ff 00 00 00 00
  0010: 00 00 00 00 00 00 80 00 00 00 00 00 00 00 00 00
  0020: 00 00 00 00 00 00 00 00 00 00 00 00 ff 40 00 00
Wiz SREG[2]:
  0000: 00 00 00 00 00 00 ff ff ff ff ff ff 00 00 00 00
  0010: 00 00 00 00 00 00 80 00 00 00 00 00 00 00 00 00
  0020: 00 00 00 00 00 00 00 00 00 00 00 00 ff 40 00 00
Wiz SREG[3]:
  0000: 00 00 00 00 00 00 ff ff ff ff ff ff 00 00 00 00
  0010: 00 00 00 00 00 00 80 00 00 00 00 00 00 00 00 00
  0020: 00 00 00 00 00 00 00 00 00 00 00 00 ff 40 00 00
I will receive the data sent by the PC in the past 400ms together.If the PC is sent every 100ms, I will receive 3 sets of data at the same time.But if the PC is sent every 10ms, I will receive 30 or 40 sets of data at the same time.

I find wiznet is in MACRAW mode through https://github.com/micropython/micropython/pull/3379 , and dpgeorge also optimizes its speed, Is there any way to improve its real-time?

Please forgive my poor English, thanks.

User avatar
Meekdai
Posts: 45
Joined: Mon Jan 29, 2018 12:45 pm

Re: The WIZNET5500 reception is a bit slow

Post by Meekdai » Sun Sep 30, 2018 1:21 am

There are some new discoveries.It seems related to this post:
http://lwip.100.n7.nabble.com/lwIP-dela ... 26785.html

I tried to modify the TCP_TMR_INTERVAL (tcp_priv.h) value to 5 and make the firmware. Received real-time performance has been improved. :D

Unfortunately, even if TCP_TMR_INTERVAL is modified to 5ms, there will still be occasional blockages.

Post Reply