my requirement is to transmit data of 500 Kb and transfer it to server using wificlint.write. esp received data at spi bus ( spi slave). in this i am using sliding window mechanism for sending data to server means data,ack,data,ack ......
in this i am getting two issue
1- stability
2- it lost some frames after sending successful ack to master.
total time to received data is 4 Sec and esp works at 160 Mhz with iwIp Variant- 2.0 High Bandwidth.
please look at the code..
void setup()
{
SPISlave.begin();
Serial.begin(115200);
Serial.println("WIFI Module Started");
if( WiFi.status() != WL_CONNECTED) {
WiFi.macAddress(MacAddress);
}
SPISlave.onData([](uint8_t * data, size_t len) {
if (data[0] == 0x02 ){ // image data download
memcpy(&EData[index1],&data[1],31);
index1 += 31;
}
else if (data[0] == 0x06 && (data[1] == 0x06)){ // Ack for image data send to server
imageSend = true;
}
}
void loop()
{
if( iSend == true ) {
iSend = false;
if(firstTime) {
firstTime = false;
sprintf(str,"Content-Length: %d",HeaderLength);
client.println(str);
client.println();
}
resp = client.write(&EData[0],index1);
index1 = 0;
}
}
i am not getting complete data at server side for checking i am using frame sequence number.
Thanks