You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Steps to Reproduce
Without modification, K64F can connect to mDC but NUC472 cannot.
Starting mbed Client example
[EasyConnect] IPv4 mode
[EasyConnect] Using WiFi (ESP8266)
[EasyConnect] Connecting to WiFi VVVVVVVVVV
[EasyConnect] Connected to Network successfully
[EasyConnect] MAC address a0:20:a6:09:95:db
[EasyConnect] IP address 192.168.43.196
SOCKET_MODE : TCP
Connecting to coap://api.connector.mbed.com:5684
simulate button_click, device not registered
simulate button_click, device not registered
simulate button_click, device not registered
simulate button_click, device not registered
simulate button_click, device not registered
simulate button_click, device not registered
simulate button_click, device not registered
simulate button_click, device not registered
simulate button_click, device not registered
simulate button_click, device not registered
simulate button_click, device not registered
simulate button_click, device not registered
simulate button_click, device not registered
simulate button_click, device not registered
simulate button_click, device not registered
simulate button_click, device not registered
simulate button_click, device not registered
simulate button_click, device not registered
simulate button_click, device not registered
simulate button_click, device not registered
simulate button_click, device not registered
simulate button_click, device not registered
[ERROR:] M2MInterface::SecureConnectionFailed
With further check into ESP8266 driver, there is mismatch between driver and AT command. According to +IPD - Receives Network Data command in AT command set, there is no "OK" in response. So _parser.recv("OK") always returns false and socket layer needs another ESP8266::recv call to get packet data. If this happens as a complete packet has received by driver, there will be no further interrupt to inform socket layer and this ESP8266::recv call is the last one. That's why NUC472 fails to connect to mDC.
int32_t ESP8266::recv(int id, void *data, uint32_t amount)
{
while (true) {
// check if any packets are ready for us
for (struct packet **p = &_packets; *p; p = &(*p)->next) {
if ((*p)->id == id) {
struct packet *q = *p;
if (q->len <= amount) { // Return and remove full packet
memcpy(data, q+1, q->len);
if (_packets_end == &(*p)->next) {
_packets_end = p;
}
*p = (*p)->next;
uint32_t len = q->len;
free(q);
return len;
} else { // return only partial packet
memcpy(data, q+1, amount);
q->len -= amount;
memmove(q+1, (uint8_t*)(q+1) + amount, q->len);
return amount;
}
}
}
// Wait for inbound packet
if (!_parser.recv("OK")) {
return -1;
}
}
}
If I make the following modification,
int32_t ESP8266::recv(int id, void *data, uint32_t amount)
{
while (true) {
...
// Wait for inbound packet
if (!_parser.recv("OK")) {
// MY FIXUP
struct packet **p = &_packets;
if (*p && (*p)->id == id) {
continue;
}
return -1;
}
}
}
NUC472 can connect to mDC successfully.
Starting mbed Client example
[EasyConnect] IPv4 mode
[EasyConnect] Using WiFi (ESP8266)
[EasyConnect] Connecting to WiFi VVVVVVVVVV
[EasyConnect] Connected to Network successfully
[EasyConnect] MAC address a0:20:a6:09:95:db
[EasyConnect] IP address 192.168.43.196
SOCKET_MODE : TCP
Connecting to coap://api.connector.mbed.com:5684
simulate button_click, device not registered
Registered object successfully!
simulate button_click, new value of counter is 1
simulate button_click, new value of counter is 2
The text was updated successfully, but these errors were encountered:
Description
Bug
Target
NUMAKER_PFM_NUC472
Version information
mbed-os-example-client (mbed-os-5.5.2)
Steps to Reproduce
Without modification, K64F can connect to mDC but NUC472 cannot.
With further check into ESP8266 driver, there is mismatch between driver and AT command. According to +IPD - Receives Network Data command in AT command set, there is no "OK" in response. So
_parser.recv("OK")
always returnsfalse
and socket layer needs anotherESP8266::recv
call to get packet data. If this happens as a complete packet has received by driver, there will be no further interrupt to inform socket layer and thisESP8266::recv
call is the last one. That's why NUC472 fails to connect to mDC.If I make the following modification,
NUC472 can connect to mDC successfully.
The text was updated successfully, but these errors were encountered: