-->
Page 1 of 1

UNLINK error when ESP receives data from server

PostPosted: Thu Jul 23, 2015 5:24 pm
by Klyf
I'm using ESP8266 with arduino, and I'm getting Unlink error when server sends data to ESP.
This case works:

setup () {
ESP -> Server - connect to server
}

loop() {
ESP -> Server - Send data to server
ESP <=> await an answer
ESP <- Server - Server send an answer back
Arduino read the answer of ESPserial
}
Everything works fine! But the outlined case below is NOT working.

setup () {
ESP -> Server - connect to server
}

timeToSend() {
ESP -> Server - Send data to server
ESP <=> await an answer
ESP <- Server - Server send an answer back
}

loop() {

if (canSend) {
timeToSend();
}
check (ESPserial->available()) {// if there is data in this connection from time to time (1 sec)
readESPData();
}
}
When the server send data to ESP (without ESP send data to server first), ESPserial->available() detect that data has arrived, but when I'm gonna to read it, ESP returns UNLINK, and everything gets bad.
Why can't ESP receive any data in any time? It works only when ESP send data first and want to read an answer...

Marcio

Re: UNLINK error when ESP receives data from server

PostPosted: Thu Jul 23, 2015 6:58 pm
by Klyf
Only more one information, after I get this UNLINK error, I try to connect again and the same error happens forever. Logs:
// when the server tries to send data any time, I get the first unlink error

Unlink
readCmd:0
nByRead:0

// when is detected that is not connected
AT+CIPSEND=41

link is not
AT+CIFSR

192.168.1.5

OK
// try to connect again
AT+CIPSTART="TCP","192.168.1.4",1883

OK
Linked
AT+CIPSEND=41

> 0'weathertemperature:19*C,humidity:61%,
SEND OK
avail:2
avail:2
avail:2
avail:2

// for no reasons, after I connect and send the data again, I got the same error when I try to read the server responses
ERROR
Unlink
readCmd:0
nByRead:0

Re: UNLINK error when ESP receives data from server

PostPosted: Tue Jul 28, 2015 10:55 am
by Klyf
Anyone had this problem? I thought this forum was more active!
My tip for the ESP manufactures is improve the error codes returned by this device. I loop up at documentation and there is only one hit for "unlink" that is not related to my problem.