DatabaseOnSD.h Problem

Hey,

I'm using Arduino Nano ESP32 board with SD card module and i want to create a data base on SD card. I'm using DatabaseOnSD library.

Problem: SD card gets initialized, arduino creates test.csv file on it, but when it comes time to write to the file or read it, ir gets realy slow and prints:
"/test.csv does not exist"
When i check the SD card on a PC there is just an empty test.csv file.

i know that the wiring is ok because SD test code runs fine, reads, writes, creates files an so on.

i tried formating the card and different cards, tried reading back the table name, and everything checks out ok. I tried the debug sketch and it says, initialized ok.

only thing is that i'm using legacy pin numbering.

I have been playing with this for two days.

Please post the sketch that you are testing, using code tags when you do

In my experience the easiest way to tidy up the code and add the code tags is as follows
Start by tidying up your code by using Tools/Auto Format in the IDE to make it easier to read. Then use Edit/Copy for Forum and paste what was copied in a new reply. Code tags will have been added to the code to make it easy to read in the forum thus making it easier to provide help.

Code is just a Test.ino sketch from examples on DatabaseOnSD library.

#include <DatabaseOnSD.h>

MyTable testTable("test.csv");  //this will create or open a table named test.csv in the root of the SD card

void setup(){
delay(3000);
// Serial.begin(115200); //start serial monitor with a baud rate of 115200 (good for ESP32)
Serial.begin(9600); // start serial monitor with a baud rate of 9600 (good for Arduino)

testTable.printSDstatus(); //[optional] print the initialization status of SD card
//testTable.emptyTable(); //[optional] empty table content (make sure to call begin(rowN, colN) after emptying a table) // you could always add more rows.
testTable.begin(3, 2); //[optional] initialize an empty table with 3 rows and 2 columns (has no effect if table is not empty)
//NOTE: there is no need to call begin() if table in NOT empty

//write table content
Serial.println("writing to table...");
testTable.writeCell(0, 0, "NAME");   testTable.writeCell(0, 1, "AGE");
testTable.writeCell(1, 0, "Divino"); testTable.writeCell(1, 1, "23");
testTable.writeCell(2, 0, "Fire");   testTable.writeCell(2, 1, "22");
Serial.println("finished writing!");

Serial.println(testTable.getName());
}


void loop(){

	//read all table content cell by cell
  if (SD.exists(testTable.getName()) == false) {
    Serial.print(testTable.getName()); Serial.println(" does not exist");
  }else{
    Serial.print(testTable.getName()); Serial.println(" OK");
  }

	int numRows = testTable.countRows();
	int numCols = testTable.countCols();

	Serial.println("-------------read all table content cell by cell ----------------------");

	for (int i = 0; i < numRows; ++i)
	{
		for (int j = 0; j < numCols; ++j)
		{
			Serial.println(testTable.readCell(i, j));
			delay(100); // one second delay after each read
		}
	}

	Serial.println(); // space separate the next serial print by an empty line

	delay(300);
	//read all table content at once
	Serial.println("-------------read all table content at once ----------------------");
	testTable.printTable(); //print entire table content to serial monitor
	Serial.println("\n"); // space separate the next serial print by 5 empty lines

	//to erase the data in a cell, parse in an empty string as the data content
	//when you read a cell, it returns a String object, if it is a number, you can convert using toint or toFloat method on the String
	delay(1000);
	
}



It sounds like there might be an issue with the file path or the way the DatabaseOnSD library handles the file operations. Double-check the file path in your code and ensure it's correctly formatted. Additionally, verify that the library is compatible with the legacy pin numbering you're using. please visit for more information.

The path is as simple as it gets, it's "/test.csv", i double checked it with getName command and it matched.

Legacy pin numbering does not seem to be the problem i tried default pin numbering and the problem is still there.

SD card formated to FAT32, i tried 16GB, 8GB, 4GB.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.