Weird behavior using microSD card reader/writer.

I was using a microSD card reader/writer and found a really weird behavior, using this code (library is the SD library co-developed by SparkFun, v1.2.4).

#include <SD.h>
#include <SPI.h>

File datasheet;

void setup() {
  Serial.begin(115200);

  Serial.println("Intializing SD Card...");

  if(!SD.begin(4))
  {
    Serial.println("SD Card initialization failed.");
    return;
  }

  Serial.println("SD Card intialization successful.");

  Serial.println("Creating files...");

  datasheet = SD.open("testlog.txt", FILE_WRITE);
  datasheet.close();

  datasheet = SD.open("datasheet.txt", FILE_WRITE);
  datasheet.close();

  Serial.println("Files found / created.");
}

void loop() {

}

This code creates a file named "TESTLOG.txt", as expected, but do not create a file named "DATASHEET.txt".

However, if I change, and change only that, "datasheet.txt" into anything else, such as "datashet.txt", it now does create a file named "DATASHET.txt".

So effectively, having datasheet = SD.open("datashet.txt", FILE_WRITE); works but not datasheet = SD.open("datasheet.txt", FILE_WRITE);... nothing else but the name changed, how can that change anything ?

Can anyone else reproduce it with any other microSD modules or is it just a weird behavior/bug of mine ?

Delta_G:
Check the reference. Always check the reference.

SD - Arduino Reference

Right there in the first paragraph is the answer to your problem. datasheet.txt is not a file name that the SD library can work with.

I have checked the reference but couldn't find this info anywhere. That's new & strange to me, that's why wanna confirm.

As your problem is concerned, you can use datasheet1.txt, I think it will work.

jackthom41:
I have checked the reference but couldn't find this info anywhere. That's new & strange to me, that's why wanna confirm.

As your problem is concerned, you can use datasheet1.txt, I think it will work.

You cannot use datasheet1.txt for a filename, for the same reason DATASHEET.txt will not work.

..... The library supports FAT16 and FAT32 file systems on standard SD cards and SDHC cards. It uses short 8.3 names for files. .....