I'm using an external SD/NAND with an ESP32-S3 to create and save log values to a file. NAND is a surface mount version of an SD card. I connect the NAND over SPI using pin 15 for the CS. This is part of my Reflections open-source project https://github.com/frankcohen/ReflectionsOS.
File mylog = SD.open( "/log1", FILE_WRITE );
if( !mylog )
{
Serial.print( F( "Unable to create log file " ) );
}
Serial.print( "mylog.size() = " );
Serial.println( (long) mylog.size() );
I see random size values in the Serial monitor. For example mylog.size = 1070537564. When I write the the file first, then the size values return correctly.
File mylog = SD.open( "/log1", FILE_WRITE );
if( !mylog )
{
Serial.print( F( "Unable to create log file " ) );
}
int logval2 = mylog.print( "Starting log" );
Serial.print( "mylog.size() = " );
Serial.println( (long) mylog.size() );
size returns 14, which is correct.
What's the process to open a bug report?
-Frank
Bug SD size() returns random value until file has non-zero bytes of content
-
- Posts: 25
- Joined: Mon Apr 05, 2021 4:03 am
-
- Posts: 828
- Joined: Mon Jul 22, 2019 3:20 pm
-
- Posts: 25
- Joined: Mon Apr 05, 2021 4:03 am
Who is online
Users browsing this forum: No registered users and 118 guests