For few days I'm struggling to establish backup my files from SD card to FTP server using Arduino C++ and Metro M4 Airlift.
In my program, I'm using Adafruit forked WiFiNINA library, which supposes to work best with this hardware setup.
Code: Select all
uint8_t clientBuf[1024];
size_t bufferSize = 1024;
uint32_t WriteBuffered(char * ftpfile) {
file.open(ftpfile, O_RDONLY);
uint32_t dataLength = file.fileSize();
Serial.println (dataLength);
uint32_t m;
while((m = file.read(clientBuf, bufferSize))>0) {
dclient.write(clientBuf, m);
}
}
I've tried to debug how the WiFiClient.h, server_drv.h and spi_drv.h are working but I could not find any reason why on the 6th loop data are not transferred fully and no data transferred on next portions of the same file.
Then I understand that communication between M4 and ESP32 via SPI seems to be working fine, so I received real confirmation how much data was transferred to ESP32, but it doesn't mean that ESP32 have already sent it to the FTP server via TCP, am I right?
The question is what is the size of buffer inside ESP32 which is buffering data received by SPI from M4 to be sent to Network?
Is there any function which I can check the status of this buffer inside ESP32?
How to make sure that ESP32 has already sent the data and "cleaned" the buffer before I send another portion of data via SPI?
Does my understanding of how the WiFiNINA works are correct?