Open jojo2357 opened 2 years ago
Hi, can we try the same without these lines:
File myFile;
myFile = SD.open("/testdb.db", FILE_WRITE);
// close the file:
myFile.close();
Does the example work without changes?
I removed the code as you suggested, along with the file check, and added while (!SD.begin()) delay(100);
to ensure that the SD was mounted in time, and I got the following:
Opened database successfully
create table surnames(name TEXT)
SQL error: unable to open database file
Time taken:23407
Select * from surnames where name = 'MICHELLE'
SQL error: no such table: surnames
Time taken:3470
After reverting back to the original example and running that out of the box, i get Can't open database: unable to open database file
if I wipe the testdb.db
file from the sd card, and rerun my example, I get the same result as the first block (with nearly indistinguishable times)
After that, upon checking the SD card, it seems that a file TEST.DB
with no disk size has been made. Thoughts?
Maybe it will help, but here is the partitioning of the SD card in use:
The partition in use is a FAT file system, and I doubt the fact that it only is allotted 16/32GB matters, since I have already run the demos provided by Arduino to verify that read and write both are working
sorry to bring this thread bacl to live but i'm having the same problem.. I can create db's and make queries on existing db files without problems on spiffs and sdcard, but cannot do inserts when using sdcard (spiffs is ok)
@pauloslf Not sure if your issue is the same as what was being discussed in this thread, but:
If you are able to read databases, is the Write protect switched on the SD Card?
If you are connecting SD Card with wires on the SPI Port, there could be some issues with EMI interference. Try reducing the speed. However, in this case both READ and WRITE should be affected.
There is no write protection on this card, and i can write other types of files to it without any issues. Also the db file is created, and i can make queries on existing dbs, just not inserts,updates or deletes..
In order to validate the EMI interference i tested with a of the shelf board (freenove esp32-s3 wroom) and i got the same result.
i'm using IDF 5.2.2, not arduino, but i assume it should be the same no ?
I am following the spi demo and I have so far only modified the setup function
The idea here is to create an empty db file (according to #53 which I somehow doubt) and then open it as a db, and then create a table, and run a query on it.
Expected output: i expect both queries to work and the select to return no entries
Actual output:
What doesnt make sense to me is how the two error messages are distinct from each other. I also opened the SD card on my computer and verified that it has created the file, and that it is still in fact empty.
I also have run a demo SD card writing program and verified that even obnoxiously large files can be written. If i am being a goofus I would like to know, but i suspect that there are supposed to be data files for me to put on the SD card similar to the esp8266 example. I also suspect that something fishy is going on in the
create table
query as it seems to time out, so there is a chance that error is actually lying.