@KurtE
Out of curiosity I decided to give the BigFile sketch a try using SPIFFS just as a comparison, if I converted the sketch correctly: these are the results with a date code of 1905 on my flash chip:
Code:
Bytes Used: 0, Bytes Total:15414161
Start Big write of 7504000 Bytes
Big write took 14.23 Sec
Big write KBytes per second 527.32
bigfile.txt [0001] size:7504000
Couldn't resist this next one, looks like the max file size with SPIFFS is 14MB, otherwise I get an error on write, so:
Code:
Start Big write of 13912000 Bytes
Big write took 26.37 Sec
Big write KBytes per second 527.47
bigfile.txt [0001] size:13912000
This is the sketch I used if you are interested:
Code:
/*
This test uses the optional quad spi flash on Teensy 4.1
https://github.com/pellepl/spiffs/wiki/Using-spiffs
https://github.com/pellepl/spiffs/wiki/FAQ
ATTENTION: Flash needs to be empty before first use of SPIFFS
Frank B, 2020
*/
extern "C" uint8_t external_psram_size;
#include <spiffs_t4.h>
#include <spiffs.h>
spiffs_t4 myfs;
//Setup files IO
spiffs_file file1, file3;
void setup() {
while (!Serial);
Serial.println("\n" __FILE__ " " __DATE__ " " __TIME__);
Serial.printf("PSRAM: %d MB\n", external_psram_size);
Serial.println("\n Enter 'y' in 6 seconds to format FlashChip - other to skip");
uint32_t pauseS = millis();
char chIn = 9;
while ( pauseS + 6000 > millis() && 9 == chIn ) {
if ( Serial.available() ) {
do {
if ( chIn != 'y' )
chIn = Serial.read();
else
Serial.read();
}
while ( Serial.available() );
}
}
if ( chIn == 'y' ) {
int8_t result = myfs.begin();
myfs.eraseFlashChip();
}
myfs.begin();
Serial.println();
Serial.println("Mount SPIFFS:");
myfs.fs_mount();
Serial.println();
Serial.println("Directory contents:");
myfs.fs_listDir();
bigFile();
myfs.fs_listDir();
}
void loop() {}
void bigFile( ) {
char myFile[] = "bigfile.txt";
int resW;
uint32_t totalSize, usedSize;
char someData[4000];
uint32_t xx;
Serial.println("Getting space"); Serial.flush();
myfs.fs_space(&totalSize, &usedSize);
uint32_t toWrite = ((totalSize - usedSize)/2) - 202400; // allow for slack space
Serial.printf("\nBytes Used: %lu, Bytes Total:%lu\n\n", usedSize, totalSize);
Serial.flush();
xx = toWrite;
memset( someData, 'z', 4000 );
Serial.printf( "\nStart Big write of %lu Bytes\n", (toWrite - toWrite % 4000));
uint32_t timeMe = micros();
resW = myfs.f_open(file3, myFile, SPIFFS_CREAT | SPIFFS_TRUNC | SPIFFS_RDWR);
Serial.println(resW);
int hh = 0;
while ( toWrite > 4000 && resW > 0 ) {
resW = myfs.f_write(file3, someData , 4000 );
hh++;
if ( !(hh % 80) ) {
Serial.print('.');
myfs.fs_space(&totalSize, &usedSize);
Serial.printf(" Bytes To Write:%lu\tBytes Used: %lu, totalSize =%lu {diff=%lu)\n", (toWrite - toWrite % 4000), usedSize, totalSize, totalSize - usedSize );
}
toWrite -= 4000;
}
xx -= toWrite;
myfs.f_close(file3);
timeMe = micros() - timeMe;
myfs.f_open(file3, myFile, SPIFFS_RDWR);
if ( resW < 0 ) {
Serial.printf( "\nBig write ERR# %i 0x%X \n", resW, resW );
}
Serial.printf( "\nBig write took %5.2f Sec ", timeMe / 1000000.0, xx );
Serial.printf( "\n\tBig write KBytes per second %5.2f \n", xx / (timeMe / 1000.0) );
myfs.f_close(file3);
}