"\0" command SOMETIMES does not terminate AT+CIPSENDEX transmission
Re: "\0" command SOMETIMES does not terminate AT+CIPSENDEX transmission
Postby StefanS » Mon Dec 07, 2020 9:25 pm
Hi all,
first let me add some more details on my configuration:
I am using an ESP-01 and I am communicating with 19.200 Baud. I have done an Over-The-Air OTA Update a few months back. And the software release is:
In the meantime, I did some more trials and found that missing the \0 as an termination marker depends on the length of the buffer. Specifically it always failed when the buffer length ends on 99 in decimal writing, e.g. for 99, 199, 299, and so on!
A simple example is shown in the following log:
The receiving end of this link is configured to send back a verbatim copy of what it has received. So it can be seen that the first \0 is not recognized as termination but is included in the payload, which becomes now 99+2=101 bytes. (When I do not sent the second \0, the communication gets stuck.)
When sending massive amounts of messages with different length, I have found that sometimes also at length xx00 (100, 200, 300..) and very rarely also with lengths xx98 and xx01 the \0 can be missed as a termination.
WORKAROUND:
For now, I have implemented a byte counter and when at the end of the message the length is ending between xx97 and xx02 (inclusive), I am adding 0x00 (NUL) bytes until the message length reaches xx03 before sending the \0. In my application (an http server), the receivers can silently ignore the additionally received 0x00 bytes.
So far, I have not seen any more issues when using this workaround.
QUESTION:
Can anybody reproduce this problem? I doubt that it is directly related to the number of bytes, but at least for me (e.g. with my baud rate etc.) it shows this peculiar behavior.
Regards,
Stefan
first let me add some more details on my configuration:
I am using an ESP-01 and I am communicating with 19.200 Baud. I have done an Over-The-Air OTA Update a few months back. And the software release is:
Code: Select all
AT+GMR
AT version:1.7.4.0(May 11 2020 19:13:04)
SDK version:3.0.4(9532ceb)
compile time:May 27 2020 10:12:20
Bin version(Wroom 02):1.7.4
OK
In the meantime, I did some more trials and found that missing the \0 as an termination marker depends on the length of the buffer. Specifically it always failed when the buffer length ends on 99 in decimal writing, e.g. for 99, 199, 299, and so on!
A simple example is shown in the following log:
Code: Select all
AT+CIPSENDEX=2048
OK
> 123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789\0\0
Recv 101 bytes
SEND OK
+IPD,101:123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789\0
The receiving end of this link is configured to send back a verbatim copy of what it has received. So it can be seen that the first \0 is not recognized as termination but is included in the payload, which becomes now 99+2=101 bytes. (When I do not sent the second \0, the communication gets stuck.)
When sending massive amounts of messages with different length, I have found that sometimes also at length xx00 (100, 200, 300..) and very rarely also with lengths xx98 and xx01 the \0 can be missed as a termination.
WORKAROUND:
For now, I have implemented a byte counter and when at the end of the message the length is ending between xx97 and xx02 (inclusive), I am adding 0x00 (NUL) bytes until the message length reaches xx03 before sending the \0. In my application (an http server), the receivers can silently ignore the additionally received 0x00 bytes.
So far, I have not seen any more issues when using this workaround.
QUESTION:
Can anybody reproduce this problem? I doubt that it is directly related to the number of bytes, but at least for me (e.g. with my baud rate etc.) it shows this peculiar behavior.
Regards,
Stefan
Who is online
Users browsing this forum: No registered users and 129 guests
Login
Newbies Start Here
Are you new to ESP8266?
Unsure what to do?
Dunno where to start?
Start right here!
Latest SDK
Documentation
Complete listing of the official ESP8266 related documentation release by ESPRESSIF!
Must read here!
- All times are UTC+08:00
- Top
- Delete all board cookies
About Us
Espressif Systems is a fabless semiconductor company providing cutting-edge low power WiFi SoCs and wireless solutions for wireless communications and Internet of Things applications. We are the manufacturer of ESP8266EX.