Hi,
I’ve successfully got OTA firmware updating over GSM (SIM7600) via FTP.
Works every time on small files (blinky) about 260KB, but when I try my application firmware (1114080) the file transfer to SPIFFS slows down around 700KB and finally stops short at 1105404.
FFS available memory: 1378241 bytes
FFS memory used: 1105404 bytes
I’m using this which is probably not the best way:
int filesize = 1114080;
File otafile = SPIFFS.open("/update.bin", FILE_WRITE);
for (int i = 0; i < filesize; i++) {
otafile.print(char(psRamFile[i]));
}
otafile.close();
It’s a bit tricky to transfer the files from the SIM7600 modem over serial, this is the process:
FTP site download file to SIM7600 internal flash.
Transfer the file over serial (460800 baud) to PSRAM.
Process and copy to a second PSRAM container to combine the 512 byte data blocks.
Then transfer this to the SPIFFS before calling updateFromFS() function.
Takes the same time as Wi-Fi ota apart from my PSRAM to SPIFFS process is slow.
I’m using two container buffers in PSRAM:
char* psRamBuffer = (char*)ps_malloc(1500000);
char* psRamFile = (char*)ps_malloc(1500000);
I did try this:
File otafile = SPIFFS.open("/update.bin", FILE_WRITE);
otafile.write((byte *)&psRamFile, sizeof(psRamFile));
otafile.close();
FFS available memory: 1378241 bytes
FFS memory used: 502 bytes
PSRAM size: 4194220 bytes
PSRAM available memory: 1194220 bytes
But only wrote 502 bytes, I don’t think I’ve got this quite right tbh, but may be the way to do it.
Any assistance would be appreciated and I will share the code in case anyone else needs it.