WIZ550SR data buffering at small gap between messages

Hello,

I’m using the WIZ550SR Module to exchange data between a PC and multiple microcontrollers (each with it’s own WIZ550SR in server mode).

The communication and everything else works fine, however I have an issue with the received data (from PC to microcontroller via the module), if the data is sent with small time gap between.

If the gap between the messages is >200ms everything is fine. The module sends the data every 200ms.
However the minimal gap between the data from PC to the module ist about 15-20ms. The data contains 3-5 Bytes.
The module is not sending the data right away. The data seems to be buffered and is sent out every 200ms.
Since the microcontroller has to react according to the data received (at a certain time), there is a chance that the microcontroller hasn’t received the data but has to trigger some outputs according to the data.

Is there any setting I can change to prevent the module to buffer the data and transmit it imidiatly? Or at least reduce this buffer time?

Dear, PKalen

Both serial to ethernet and ethernet to serial process data by polling. In other words, data is delivered immediately. The cause of delay can occur when searching for AT command trigger code or when packing data. Disable At Command. And please do not use packing condition.

Hello Ricky,

thank you for your answer. I checked my settings and tried a few things, however I still have that delay.

Here are my settings:

I logged the communication with Hterm. I used the Evaluation Board WIZ550SR EVB to monitor the data sent out via uart. Additionally I watched the transmitted data with a scope.

I made a minimal TCP Client Application running on my PC. I’m sending two bytes from “p0” counting up to “p9” and then again from “p0”…
Everything above 200ms it send out immidiatly. Below 200ms I have that delay/buffering.

Here are some Logs from Hterm:
Logs.zip (69,3 KB)

The AT commands and packing is disabled. Since I send out 2 Bytes I triedthe same with the Size 2 in Packing Conditions without any changes.
Are my settings correct? Is there anything else I could do?

Dear, PKalen

As mentioned earlier, it polls the serial data and sends it to Ethernet. If the interval for sending serial data is short, serial data will continue to be generated while the module receives some serial data and sends it to Ethernet. This is the limit of the module. So we provide a function called serial data packing. If the serial you send has a certain rule, use that function. More information can be found at the link below.

https://wizwiki.net/wiki/doku.php?id=products:wiz550sr:wiz550sr_userguide_en

Packing Conditions

Normally, data received from UART are sent to Ethernet immediately. But in many cases, users want to send data as a chunk of the whole frame without separated ones. This option is for packetizing data into one frame.
Time (0 ~ 65535 ms, ‘0’: Function Disable) :
This field is for specifying time value (in ms) to judge whether one frame
is received totally. If the time specified in this field is expired
after receiving one byte, then WIZ550SR notice one data frame is finished,
make an Ethernet packet with all data in its serial buffer and send it to
the peer system via Ethernet.
If WIZ550SR receives another byte from UART before the specified time is expired,
it restart timer and add the received one to the end of serial data buffer.
Size (0 ~ 255 byte, ‘0’: Function Disable) :
This field is for specifying size value to judge whether one frame is
received totally. If the size specified in this field is received, then WIZ550SR
notice one data frame is finished, make an Ethernet packet with specifying size’s
data in its serial buffer and send it to the peer system via Ethernet.
Char :
This field is for specifying delimiter value to judge whether one frame is
received totally. Char delimiters can be set up to 4 bytes in HEX and valid
character count is decided according to the value in Length field. In case the
value of Length field is ‘0’, this option becomes inactivated.
Appendix is another option for this. If user selects any value in Appendix field,
WIZ550SR make an ethernet packet with all received data by Char delimiter and
next bytes in counts, which designated by Appendix field.
When Appendix is set with any value, not ‘0’, even though WIZ550SR received Char
delimiters, it will wait until it receives next data.

Your attempt to set and test the size to 2 is correct. Currently, there seems to be no other way.

Hello Ricky,

again, thank you for your time helping me out.

I tried a lot of different settings:

  • limit the size to 2
  • adding delimiters
  • used a time limit
  • combinations from above
    with no changes…

The description of the packing conditions mentions UART to Ethernet all the time. But is this valid for the data the other direction (Ethernet to UART)?
Because I have this issue from Ethernet to UART, if I send data continiously from my PC (Client) to the Module (Server) every <200ms it does that buffering.

Hello Ricky,

I got myself a WIZ850io, hooked it up to a STM32 NUCLEO board and
built my own TCP(server) to UART application to test the issue.
I used the ioLibrary (w550.c/h, socket.c/h and wizchip_conf.c/h).

First I had the same behavior. Everything send to the w5500 with less than 200ms
wouldn’t be send immidiatly.
I then searched anything indicating to that delay.
There is a define RTR in the w5500 header. The description says:

“And so the default timeout period is 200ms(100us X 2000). During the time configured by @ref RTR, W5500 waits for the peer response
to the packet that is transmitted by \ref Sn_CR (CONNECT, DISCON, CLOSE, SEND, SEND_MAC, SEND_KEEP command).”

If a socket has been opend, this timeout period will be used all the time. Except if the socket
is opened with “SF_TCP_NODELAY” as the socket flag parameter of the socket() function.

Checking the source code of the WIZ550SR the socked gets opend whith:
socket(sock, Sn_MR_TCP, net->local_port, SF_IO_NONBLOCK);
Therefor the timeout period is used.
Since I can measure the 200ms timeout I guess the WIZ550SR does not chnage the RTR value?!

With my test setup, before opening the socket with SF_NON_BLOCKING flag I set the timeout to 1 (=100µs).
The data will be sent out immidiatly (almost, 100µs delay is still there).
Changing the open socked parameters to (…, “SF_TCP_NODELAY”) without changeing the RTR value,
data will be send immidiatly. However the socket is no more non-blocking.

I’m not sure what will be the best setting for me (have to test this).
Since the socket open is hard-coded with SF_NON_BLOCKING, there is no option to change it to SF_TCP_NODELAY without changes to the firmware.
But is there a way to change the RTR value without changeing the firmware of the WIZ550SR?

Dear, PKalen

is there a way to change the RTR value without changeing the firmware of the WIZ550SR?

no. There is not. The firmware needs to be changed.

As mentioned earlier, Both serial to ethernet and ethernet to serial process data by polling. data is delivered immediately. The speed of polling depends on processor capabilities.

I think the SF_TCP_NODELAY, RTR, RCR are not related to this problem. However, I will provide the changed firmware if necessary for your test.

Hello Ricky,

if you could change the opening socket with SF_TCP_NODELAY so I can test it. This would be very helpful.

Dear, PKalen

Sorry for the late reply.

Attach the modified version with the SF_TCP_NODELAY option.

Please check and notify the results.

WIZ550SR_App.bin (58.3 KB)

Hello Ricky,

thank you for the firmware.
I don’t know if I have the time to test it this week. However I will notify you with the results.

Hello Ricky,

I flashed the module with your firmware.
After that the modul isn’t doing anything. No green led blinking, nor any reply from both serial interfaces.
Can I simply programm your binary with the ST tool? I did this with several moduls and firmware 1.1.7 and didn’t have any issue.

Dear, PKalen

The attached .bin file should be uploaded using the configuration tool and tftp server.
Please refer to the link below.
https://wizwiki.net/wiki/doku.php?id=products:wiz550s2e:wiz550s2e_download

To upload using the st tool, please use WIZ550SR.hex in the attached file. app and boot are the combined files.

After upload if “input mac?” message appears, send a message like S0008DC123456.
WIZ550SR_Out.zip (231.4 KB)