Description of AT+CIPSEND command is confusing. It can be used in single connection mode (AT+CIPSEND=<length>) and in multiple connection mode (AT+CIPSEND=<link ID>, <length>). However, in the "response" section description states: "This command can only be used in transparent transmission mode which require to be single connection mode." There is no description how it works in multiple connection mode. Maybe in the multiple connection "+++" terminator is ignored. Or maybe "+++" termination was available in earlier versions of AT commands and is redunant now, who knows.
Also AT+CIPSEND description says that "<length> data length, MAX 2048 bytes ", and then says: "Wrap return ">" after execute command. Enters unvarnished transmission, 20ms interval between each packet, maximum 2048 bytes per packet." What is a "packet"? How ESP8266 distinguish one packet from another? When should I wait 20 ms?
One way to interpret that is to think that the "packet" is the whole data message sent via AT+CIPSEND. Thus, the sequence should be as follows:
- send "AT+CIPSEND=<link ID>, <length>"
- wait for ">" (in fact I always see "OK >")
- send <length> of data bytes, it is a "packet"
- wait 20 ms, after that I can issue next AT+CIPSEND command. Maybe ESP8266 returns "OK" when ready, but description does not promise that.
If it is true, then my throughput heavily depends on packets length. If I send short packets, say, 20 bytes long, then troughput cannot be greater than 1 kbytes/sec, because I have to add 20 ms delays between packets.
I guess AT+CIPSENDBUF was added exactly for that reason: probably it was intended to increase performance while sending short packets. But the problem is that I need to know in advance how much data in total I will send via AT+CIPSENDBUF. I cannot declare length 2048, then send several short packets, and the force buffer to send. The "+++" does not work as expected, data not being sent, after "+++" ESP8266 discards the accumulated data. As far as I can see, AT+CIPSENDBUF works only if I send the declared <length> bytes exactly. Because of that, I cannot see the difference between AT+CIPSEND and AT+CIPSENDBUF commands, in practice they work the same way.
Maybe AT+CIPSENDEX can do the job, I did not try it yet. Its description is very brief. It says: "when data length or "\0" is met, starts transmission of data.". Probably it means that sending a data byte 0x00 to ESP8266 will terminate AT+CIPSENDEX command and forces ESP8266 to transmit buffered data. Statement "So if sending "\0" is needed, please send it as "\\0"" probably means that data bytes 0x00 in the packet should be replaced by the pair 0x92 0x00. Description does not say how such a pair will be counted for the <length>, as one byte or as two bytes. Description does not say what should I do if the last byte in my packet has value of 0x92. Perhaps I should add some dummy byte of any vlue other than 0x00 and then send 0x00.
An unclear AT commands description is yet another reason why it is scary to change to a new revision of AT commands. I explored a specific revision and made my program to match ESP8266 behavior, but all that might be ruined with a new revision. Because significant part of behavior is not described and therefore it can be changed without notice.Statistics: Posted by akouz — Fri May 13, 2016 8:35 am
]]>