Hi!
I was studying und using part of the code of this project about Tiva TM4C123GXL and the WIFI module ESP8266: e2e.ti.com/.../666222
I have tested a lot of functions of that project concerning the various AT commands (like "ATesp()", "RSTesp()", "CWMODEesp()", "CWJAPesp()", and so on) which are able to drive this famous ESP8266.
They worked fine for me, but I have some problems with the important function "CIPSENDesp()" concerning the AT command "AT+CIPSEND".
Here is the body of this function:
bool CIPSENDesp(char *text) { int len = strlen(text)+2; // calculates the length of the string and adds 2 (for CR & LF which will be added later) itoa(len,str); // converts int to string char* AT_CMD_SEND = "AT+CIPSEND="; char CMD_TEXT[128]; strcpy(CMD_TEXT,AT_CMD_SEND); strcat(CMD_TEXT,str); // appends "str" to "CMD_TEXT" memset(ReceivedData, 0, sizeof(ReceivedData)); SendATCommand(CMD_TEXT); // sends the string, with CR & LF at the end delay(5); SendATCommand(text); // sends the string, with CR & LF at the end return recvFind("SEND OK",2000, true); }
I know that it isn't a forum about ESP8266, so I won't ask about that module.
From what I understood (from the ESP8266 documentation), after sending the "CMD_TEXT" string, I must wait that the WIFI module answers a string where the last char is the ">" symbol, before I could send the "text" string.
So, during the executing of the code line "delay(5);", the code waits the response of the WIFI module, and this response will contain the ">" symbol.
So, I think that a possible solution, which could work for me, is to substitute the code line "delay(5);" with a small piece of code which gets the characters arriving from UART2 (the UART module which I actually use for the ESP8266), and that notifies when the ">" arrives (by escaping from a "while" cycle I think).
Is my question clear? Could someone explain me how to write this piece of code?
Thanks in advance.