WIZnet Developer Forum

WizFi360 TCP message delay & SoftAP+STA

Hello,

We have a problem when using WizFi360 as SoftAP + STA with TCP connections. Certain devices get their messages delayed (from 2 up to 30 seconds delay) when WizFi is sending them while it is connected to an AP with its STA. If the STA isn’t used, then the devices connected to the Module’s SoftAP don’t receive delayed messages, but when STA is connected to somewhere then the delay starts happening.

Any idea why this is happening and how can it be resolved? We would really need to use the Module both SoftAP and STA while using the TCP connections too, it is important for our project, but this delay in receiving messages is not optimal for us at all.

Thank you for your answer in advance!

Hello,

Would you mind to provide more details? As I understood WizFI360 is running in SoftAP+STA mode and you have TCP server running on the module. Then you are trying to send messages from server to other clients connected to WizFi360 SoftAP, but messages are delayed. Is my understanding correct?
Any screenshots, exact command sequences will be highly appreciated.

Thanks in advance,
Viktor

Hello,

WizFi360 is running SoftAP+STA indeed. WizFi is running a TCP server, and if WizFi is connected to an AP then it is connected to as a TCP client to a server on that AP too, while other devices which are connected to the WizFi SoftAP are connected as TCP clients to the SoftAp TCP server.

I’m trying to send messages to the TCP clients with the AT commands of
AT+CIPSENDBUF, the exact sequence is this:

AT+CIPSENDBUF,0,[len]
<wait 10ms>
‘>’
[message]
<wait 20ms>

AT+CIPSENDBUF,1,[len]
<wait 10ms>
‘>’
[message]
<wait 20ms>

AT+CIPSENDBUF,2,[len]
<wait 10ms>
‘>’
[message]
<wait 20ms>

Waiting happens with delays in the MCU program. The Program sends a message seperately to a device or to all three of them in a manner like I showed above. Even when it just sends one message to one device it can arrive to the device delayed.

These messages arrive to the TCP clients just fine IF the WizFi360 is not connected to an AP through its STA. But when It is connected, some of the devices get these messages delayed up almost up to a minute in some cases.
For example: Device 1 and 3 would get their messages before Device 2, even though in the command sequence Device 2 is getting sent its message sooner than Device 3.
This Delay only doesn’t happen if after power up, the WizFi360 does not connect to an AP. If it connect to an AP, the delay happens, even if it disconnects from the AP, until another power up.

WizFi360’s Firmware version currently is 1.1.1.2 but it was 1.0.7.2, I thought upgrading firmware would help but the problem still persist even after changing to 1.1.1.2 from 1.0.7.2 .

The exact sequence I take when I set up the module is:
-ATE0
-AT+CWMODE_DEF=3
-AT+CWDHCP_DEF=0,1
-AT+CWSAP_DEF="[our ssid]","[our password]",1,3,3,0
-AT+CIPAP_DEF=“192.168.100.1”,“192.168.100.1”,“255.255.255.0”
-AT+CWDHCPS_DEF=1,120,“192.168.100.100”,“192.168.100.200”
-AT+CIPMUX=1
-AT+CIPSERVERMAXCONN=3
-AT+CIPSERVER=1,5000
-AT+CIPSTO=1200
-AT+CIPSTAMAC_CUR? [To get the MAC address]
-AT+CIPSTA_DEF? [To get the IP Address]

When trying to connect to an AP:
-AT+CWJAP_DEF=“example”,“password”

If it connected then trying to connect to the server:
-AT+CIPSTART=4,“TCP”,“192.168.137.1”,50000

I hope this will help trying to find a solution, if you need anything else just tell me

Thank you in advance!

Hello,

I am now checking our module performance.
By message delay, do you mean that message itself is being delayed or delay for “SEND OK” message?

Hello,

Sorry, I might misunderstand your question. Are you asking if SEND OK is being delayed after the message has been sent?
Because SEND OK only comes after the message has been sent, in which case, yes it is delayed with the message itself, but after I get the delayed message, I get the SEND OK too.

Hello,

Yes, that was my question.
Base on my tests so far, messages are being delivered almost immediately, while as “SEND OK” messages are being delayed sometimes. But since you are using AT+CIPSENDBUF, it is not necessary to wait for “SEND OK” message.

Since you mentioned that you get messages itself delayed, would you mind informing me whether there is any noise in WiFi channel that you are using or any other circumstances that could impact communication? From my side, I will conduct more tests and check Firmware code.

Hello,

There aren’t much wifi hotspots around, so I don’t think there is noise in the WiFi channel.
The circumstances I am using is, having three different devices [a phone, a tablet, and a smart watch] with our android program as a TCP client connected to the WizFi SoftAP and communicating like that.

When WizFi360 does not use its STA, then the messages what come from the Module arrive almost instantly too, but when the STA is being used to connect to an AP so that the WizFi can connect to a TCP server on that network, then the delays start happening noticably on the devices. It doesn’t have to be even connected to the TCP server only to the AP and the delays can be noticed.

I have tested with a TCP Client terminal tester and the delays still happened on that too when WizFi was connected to an AP. What I find weird still, that the delay still remains if I connect to an AP and disconnect from it with WizFi, but if I don’t connect to an AP after power up, the delays don’t happen.

I hope this was helpful.

Hello,

I don’t want to seem impatient or pushy, but can I have an update on how things are going so far?
Thank you!

Hi,

Sorry it takes longer time than expected. I am still working on this issue, I will let you know the results.

Hello,

Would you mind to test with FW v 1.0.7.5?
It can be downloaded here:

Meanwhile I will look for other workarounds.

Hello,

I have uploaded the FW v 1.0.7.5 to our WizFi360 as you requested but the problem about the delayed TCP messages sadly is still present.

Hello,

Would you mind to provide full logs from UART of WizFi360? Preferably with timestamps, I made exactly same settings that you mentioned above, and tested with similar setup (WizFi360 as SoftAP+STA/TCP Server, smartphone and table as TCP client and another Wizfi360 as TCP client), in my case it worked without any delays.

Hello,

I have asked for some logs from one of the devices which has the messages delayed more frequently, and they sent me a log from one session of testing while connected to 2 terminals and one Tablet.
TCP link ID was: 0 - Terminal1; 1 - Tablet; 2 - Terminal2; and the messages were sent in this order too.

The left Terminal is Terminal1 while the right Terminal is Terminal2, the log file is from the Tablet’s program when it gets the messages.

As you can see, the Tablet gets the messages delayed compared to the terminals on the Network where the server is found.
(Like on line 10, where the message which was sent at 9:54:05 was delayed and so is the two messages after that and they arrived at the same time at 9:54:11)

I hope this helps figuring out the problem, if you need more logs just tell me.

Hello,

Unfortunately based on your screenshot it is impossible to understand which commands were given to WizFi360. That’s why I asked log from UART1 of WizFi360. If possible, please provide me one, so that I would be able to reproduce your setup exactly and find out the reason.

Hello,

If you want to know which commands I used, it’s the AT+CIPSENDBUF one, I only use that for message sending and I already written that down, so now I don’t understand what you would like to know, could you elaborate about it?
If it’s about how I use it in code for the Microcontroller then it’s like this:

void wizfi_TCPMessageSender(char * tcpLinkID, char * message, uint16_t msgLen) //max len 2048
{

uint8_t mesSend[80] = "AT+CIPSENDBUF=";

char msgLenStr[5] = {0};
uint16_to_string((uint8_t *)msgLenStr,4,msgLen);

strcat((char *)mesSend,tcpLinkID);
strcat((char *)mesSend,",");
strcat((char *)mesSend,(char *)msgLenStr);
strcat((char *)mesSend,"\r\n");

wizfi_sendData(mesSend,strlen((char *)mesSend)); //Sends CIPSENDBUF command into UART sending it to WizFi as an AT command
Timing.delay_ms(10); //Waits for > prompt

wizfi_sendData((uint8_t *)message,msgLen); //Puts message to UART, sending it to WizFi as a message
Timing.delay_ms(20); 
}

And I use it something like this:

wizfi_TCPMessageSender("1","Message",7);  //Sends "Message" to TCP client on LinkID 1 

And as you could see I am sending to three Clients with a message sender like this, just a bit more elaborate to get the desired messages I need, the ones on the screenshot on the terminals.

I cannot provide timestamps for when I send the AT commands because we don’t have an RTC for the MCU in this project, the closest time stamp I can get about when the command is sent is when the message arrives on the terminal on the left side on the screenshot since that was on LinkID 0.

The Terminals got the messages in time because they were on the AP to which the WizFi was connected.

Also, even if I send it only to one client, the delay can still happen. But as I said, it only happens if WizFi’s STA is connected to an AP.

I hope this was helpful.

Hello,

Were there any other commands used for settings except those that you informed before?
Can you test with the same setup but without MCU and sending commands directly to WizFi360?

Hello,

There isn’t any other commands I use for settings, I have listed all which I use to set the WizFi.

You mean directly sending to the WizFi-s UART through a terminal?
I don’t think we can do that, since the WizFi is already integrated into the Project, but I will try to ask around if we have a spare one for this.

Hello,

Could it be that the delays in the messages to the devices are happening because of the server answering to the keep alive messages which are sent every 2 seconds? Or by sending messages to the server at all?
I was focused on the other aspects that I forgotten that there is keep alive communication with the server.

AT+CIPSENDBUF,4,[len]
[10 ms delay]
‘>’
[Keep Alive message to which the server answers]
[20 ms delay]

This happens every 2 seconds. Could it be that WizFi isn’t able to send message to the STA-s because of this so the messages get delayed?

Hello,

Regarding first question, yes if possible please conduct test on WizFi360 directly without MCU.

Regarding question #2. I don’t really think that could be the cause, but is there any specific reason to send request every 2 seconds?

Hello,

To answer your second question: We need the Keep Alive function so the server knows that the program is connected to it and so does the MCU knows he is connected to the Server.

I could make some logs with reading out what the MCU sends to the WizFi360 and then checking the messages on the Tablet on a terminal program to see the delay with timestamps.

And here is the log from YAT:

(11:11:13.996) [CR]AT+CIPSENDBUF=0,0006
(11:11:14.111) 00167[CR]AT+CIPSENDBUF=1,0006
(11:11:14.111) 00167[CR]AT+CIPSENDBUF=2,0006
(11:11:14.111) 00167
(11:11:19.104) [CR]AT+CIPSENDBUF=0,0006
(11:11:19.104) 00168
(11:11:19.236) [CR]AT+CIPSENDBUF=1,0006
(11:11:19.236) 00168[CR]AT+CIPSENDBUF=2,0006
(11:11:19.236) 00168
(11:11:24.195) [CR]AT+CIPSENDBUF=0,0006
(11:11:24.321) 00169[CR]AT+CIPSENDBUF=1,0006
(11:11:24.321) 00169[CR]AT+CIPSENDBUF=2,0006
(11:11:24.321) 00169
(11:11:29.286) [CR]AT+CIPSENDBUF=0,0006
(11:11:29.420) 00170[CR]AT+CIPSENDBUF=1,0006
(11:11:29.420) 00170[CR]AT+CIPSENDBUF=2,0006
(11:11:29.420) 00170
(11:11:34.394) [CR]AT+CIPSENDBUF=0,0006
(11:11:34.394) 00171
(11:11:34.512) [CR]AT+CIPSENDBUF=1,0006
(11:11:34.512) 00171[CR]AT+CIPSENDBUF=2,0006
(11:11:34.512) 00171
(11:11:39.486) [CR]AT+CIPSENDBUF=0,0006
(11:11:39.486) 00172
(11:11:39.604) [CR]AT+CIPSENDBUF=1,0006
(11:11:39.604) 00172[CR]AT+CIPSENDBUF=2,0006
(11:11:39.604) 00172
(11:11:44.593) 6
(11:11:44.577) [CR]AT+CIPSENDBUF=0,000
(11:11:44.593) 00173
(11:11:44.700) 00173
(11:11:44.700) [CR]AT+CIPSENDBUF=1,0006
(11:11:44.700) 00173[CR]AT+CIPSENDBUF=2,0006
(11:11:49.685) [CR]AT+CIPSENDBUF=0,0006
(11:11:49.808) 00174[CR]AT+CIPSENDBUF=1,0006
(11:11:49.808) 00174[CR]AT+CIPSENDBUF=2,0006
(11:11:49.808) 00174
(11:11:54.776) [CR]AT+C
(11:11:54.825) IPSENDBUF=0,0006
(11:11:54.825) 00175[CR]AT+CIPSENDBUF=1,0006
(11:11:54.825) 00175
(11:11:55.007) 00175
(11:11:55.007) [CR]AT+CIPSENDBUF=2,0006
(11:11:59.884) [CR]AT+CIPSENDBUF=0,0006
(11:12:00.005) 00176[CR]AT+CIPSENDBUF=1,0006
(11:12:00.005) 00176[CR]AT+CIPSENDBUF=2,0006
(11:12:00.005) 00176
(11:12:04.976) [CR]AT+CIPSENDBUF=0,0006
(11:12:05.124) 00177[CR]AT+CIPSENDBUF=1,0006
(11:12:05.124) 00177[CR]AT+CIPSENDBUF=2,0006
(11:12:05.124) 00177
(11:12:10.083) [CR]AT+CIPSENDBUF=0,0006
(11:12:10.212) 00178[CR]AT+CIPSENDBUF=1,0006
(11:12:10.212) 00178[CR]AT+CIPSENDBUF=2,0006
(11:12:10.212) 00178
(11:12:15.174) [CR]AT+CIPSENDBUF=0,0006
(11:12:15.305) 00179[CR]AT+CIPSENDBUF=1,0006
(11:12:15.305) 00179[CR]AT+CIPSENDBUF=2,0006
(11:12:15.305) 00179
(11:12:20.266) [CR]AT+C
(11:12:20.282) IPSENDBUF=0,0006
(11:12:20.282) 00180
(11:12:20.490) [CR]AT+CIPSENDBUF=1,0006
(11:12:20.490) 00180[CR]AT+CIPSENDBUF=2,0006
(11:12:20.490) 00180
(11:12:25.373) [CR]AT+CIPSENDBUF=0,0006
(11:12:25.373) 00181
(11:12:25.503) [CR]AT+CIPSENDBUF=1,0006
(11:12:25.503) 00181[CR]AT+CIPSENDBUF=2,0006
(11:12:25.503) 00181
(11:12:30.465) [CR]AT+CIPSENDBUF=0,0006
(11:12:30.584) 00182[CR]AT+CIPSENDBUF=1,0006
(11:12:30.584) 00182[CR]AT+CIPSENDBUF=2,0006
(11:12:30.584) 00182
(11:12:35.557) [CR]AT+CIPSENDBUF=0,0006
(11:12:35.693) 00183[CR]AT+CIPSENDBUF=1,0006
(11:12:35.693) 00183[CR]AT+CIPSENDBUF=2,0006
(11:12:35.693) 00183
(11:12:40.664) [CR]AT+CIPSENDBUF=0,0006
(11:12:40.664) 001
(11:12:40.790) 84[CR]AT+CIPSENDBUF=1,0006
(11:12:40.790) 00184[CR]AT+CIPSENDBUF=2,0006
(11:12:40.790) 00184
(11:12:45.755) [CR]AT+CIPSENDBUF=0,0006
(11:12:45.886) 00185[CR]AT+CIPSENDBUF=1,0006
(11:12:45.886) 00185[CR]AT+CIPSENDBUF=2,0006
(11:12:45.886) 00185
(11:12:50.863) [CR]AT+CIPSENDBUF=0,0006
(11:12:50.863) 00186
(11:12:50.988) [CR]AT+CIPSENDBUF=1,0006
(11:12:50.988) 00186[CR]AT+CIPSENDBUF=2,0006
(11:12:50.988) 00186
(11:12:55.955) [CR]AT+CIPSENDBUF=0,0006
(11:12:56.077) 00187[CR]AT+CIPSENDBUF=1,0006
(11:12:56.077) 00187[CR]AT+CIPSENDBUF=2,0006
(11:12:56.077) 00187
(11:13:01.062) ,0006
(11:13:01.046) [CR]AT+CIPSENDBUF=0
(11:13:01.062) 00188
(11:13:01.184) 00188
(11:13:01.184) [CR]AT+CIPSENDBUF=1,0006
(11:13:01.184) 00188[CR]AT+CIPSENDBUF=2,0006
(11:13:06.154) [CR]AT+CIPSENDBUF=0,0006
(11:13:06.301) 00189[CR]AT+CIPSENDBUF=1,0006
(11:13:06.301) 00189[CR]AT+CIPSENDBUF=2,0006
(11:13:06.301) 00189
(11:13:11.261) [CR]AT+CIPSENDBUF=0,0006
(11:13:11.261) 00190
(11:13:11.402) [CR]AT+CIPSENDBUF=1,0006
(11:13:11.402) 00190[CR]AT+CIPSENDBUF=2,0006
(11:13:11.402) 00190
(11:13:16.353) [CR]AT+CIPSENDBUF=0,0006
(11:13:16.485) 00191[CR]AT+CIPSENDBUF=1,0006
(11:13:16.485) 00191[CR]AT+CIPSENDBUF=2,0006
(11:13:16.485) 00191
(11:13:21.460) [CR]AT+CIPSENDBUF=0,0006
(11:13:21.593) 00192[CR]AT+CIPSENDBUF=1,0006
(11:13:21.593) 00192[CR]AT+CIPSENDBUF=2,0006
(11:13:21.593) 00192
(11:13:26.567) [CR]AT+CIPSENDBUF=0,0006
(11:13:26.567) 00193
(11:13:26.715) [CR]AT+CIPSENDBUF=1,0006
(11:13:26.715) 00193[CR]AT+CIPSENDBUF=2,0006
(11:13:26.715) 00193
(11:13:31.659) [CR]AT+CIPS
(11:13:31.675) ENDBUF=0,0006
(11:13:31.675) 00194
(11:13:31.775) 00194
(11:13:31.775) [CR]AT+CIPSENDBUF=1,0006
(11:13:31.775) 00194[CR]AT+CIPSENDBUF=2,0006
(11:13:36.767) [CR]AT+CIPSENDBUF=0,0006
(11:13:36.767) 00195
(11:13:36.900) [CR]AT+CIPSENDBUF=1,0006
(11:13:36.900) 00195[CR]AT+CIPSENDBUF=2,0006
(11:13:36.900) 00195
(11:13:41.858) [CR]AT+CIPSENDBUF=0,0006
(11:13:41.989) 00196[CR]AT+CIPSENDBUF=1,0006
(11:13:41.989) 00196[CR]AT+CIPSENDBUF=2,0006
(11:13:41.989) 00196
(11:13:46.966) [CR]AT+CIPSENDBUF=0,0006
(11:13:46.966) 00
(11:13:47.103) 197[CR]AT+CIPSENDBUF=1,0006
(11:13:47.103) 00197[CR]AT+CIPSENDBUF=2,0006
(11:13:47.103) 00197
(11:13:52.057) [CR]AT+CIPSENDBUF=0,0006
(11:13:52.185) 00198[CR]AT+CIPSENDBUF=1,0006
(11:13:52.185) 00198[CR]AT+CIPSENDBUF=2,0006
(11:13:52.185) 00198
(11:13:57.149) [CR]AT+CIPSENDBUF=0,0006
(11:13:57.277) 00199[CR]AT+CIPSENDBUF=1,0006
(11:13:57.277) 00199[CR]AT+CIPSENDBUF=2,0006
(11:13:57.277) 00199
(11:14:02.256) [CR]AT+CIPSENDBUF=0,0006
(11:14:02.256) 00200
(11:14:02.388) [CR]AT+CIPSENDBUF=1,0006
(11:14:02.388) 00200[CR]AT+CIPSENDBUF=2,0006
(11:14:02.388) 00200
(11:14:07.348) [CR]AT+CIPSENDBUF=0,0006
(11:14:07.473) 00201[CR]AT+CIPSENDBUF=1,0006
(11:14:07.473) 00201[CR]AT+CIPSENDBUF=2,0006
(11:14:07.473) 00201
(11:14:12.455) [CR]AT+CIPSENDBUF=0,0006
(11:14:12.583) 00202[CR]AT+CIPSENDBUF=1,0006
(11:14:12.583) 00202[CR]AT+CIPSENDBUF=2,0006
(11:14:12.583) 00202
(11:14:17.547) [CR]AT+CIPSENDBUF=0,0006
(11:14:17.704) 00203[CR]AT+CIPSENDBUF=1,0006
(11:14:17.704) 00203[CR]AT+CIPSENDBUF=2,0006
(11:14:17.704) 00203
(11:14:22.654) [CR]AT+CIPSENDBUF=0,0006
(11:14:22.654) 00204
(11:14:22.783) [CR]AT+CIPSENDBUF=1,0006
(11:14:22.783) 00204[CR]AT+CIPSENDBUF=2,0006
(11:14:22.783) 00204
(11:14:27.746) [CR]AT+CIPSENDBUF=0,0006
(11:14:27.866) 00205[CR]AT+CIPSENDBUF=1,0006
(11:14:27.866) 00205[CR]AT+CIPSENDBUF=2,0006
(11:14:27.866) 00205
(11:14:32.853) [CR]AT+CIPSENDBUF=0,0006
(11:14:32.853) 00206
(11:14:33.006) [CR]AT+CIPSENDBUF=1,0006
(11:14:33.006) 00206[CR]AT+CIPSENDBUF=2,0006
(11:14:33.006) 00206
(11:14:37.961) [CR]AT+CIPSENDBUF=0,0006
(11:14:37.961) 00207
(11:14:38.095) [CR]AT+CIPSENDBUF=1,0006
(11:14:38.095) 00207[CR]AT+CIPSENDBUF=2,0006
(11:14:38.095) 00207
(11:14:43.053) [CR]AT+CIPSENDBUF=0,0006
(11:14:43.190) 00208[CR]AT+CIPSENDBUF=1,0006
(11:14:43.190) 00208[CR]AT+CIPSENDBUF=2,0006
(11:14:43.190) 00208

I had the MCU to send a message every 5 seconds for this.

I will try to do this without MCU but I don’t know if I’m able.

I hope this will be helpful.

Copyright © 2017 WIZnet Co., Ltd. All Rights Reserved.