Sorry @Hansen but I don’t understand, I used the SD_Test code to write and read the “mickey.txt” and “mouse.txt” files and everything went ok. I changed the “#define USESPIFLASH” to #undef USESPIFLASH “and I wrote and read” foo.txt "and pluto.txt on SD and everything went ok. I tried to read SD files on PC and everything is OK. I load the Milti_partition software and if I only use the “listDir” everything is ok I insert the readFile routine copied from SD_Test and trying to read the files I created previously the program gives me a read error.
If I remove the inclusion of “SFUD / Seeed_SFUD.h” and the code related to the FLASH, the reading of the SD is successful.
I am attaching the result of the Serial Monitor.
I await your help
Thank you
Gianfranco
Click to see the code
Using the SD_Test code
I write and read on Flash by setting #define USESPIFLASH
09:30:46.444 -> flash Size: 4MB
09:30:46.444 -> Listing directory: /
09:30:46.444 -> Writing file: /mickey.txt
09:30:46.479 -> File written
09:30:46.618 -> Writing file: /mouse.txt
09:30:46.653 -> File written
09:30:46.793 -> Reading Dir: /mickey.txt
09:30:46.793 -> Read from file: Mickey
09:30:46.793 -> Reading Dir: /mouse.txt
09:30:46.793 -> Read from file: mouse
09:30:46.793 -> Listing directory: /
09:30:46.793 -> FILE: /mickey.txt SIZE: 7
09:30:46.793 -> FILE: /mouse.txt SIZE: 6
09:30:46.828 -> Total space: 3MB
09:30:46.828 -> Used space: 0MB
I write and read on SD by setting #undef USESPIFLASH
09:34:38.957 -> SD Card Size: 15079MB
09:34:38.957 -> Listing directory: /
09:34:38.957 -> DIR : /System Volume Information
09:34:38.992 -> Writing file: /pippo.txt
09:34:39.040 -> File written
09:34:39.060 -> Writing file: /pluto.txt
09:34:39.095 -> File written
09:34:39.132 -> Reading Dir: /pippo.txt
09:34:39.132 -> Read from file: pippo
09:34:39.132 -> Reading Dir: /pluto.txt
09:34:39.132 -> Read from file: pluto
09:34:39.132 -> Listing directory: /
09:34:39.132 -> DIR : /System Volume Information
09:34:39.132 -> FILE: /pippo.txt SIZE: 6
09:34:39.132 -> FILE: /pluto.txt SIZE: 6
09:34:39.165 -> Total space: 2774MB
09:34:39.165 -> Used space: 0MB
Using the Multi_partition code
original code only with listdir
09:35:55.242 -> Flash Size: 4MB
09:35:55.242 -> SD Card Size: 15079MB
09:35:55.242 -> Total space: 3MB
09:35:55.242 -> Used space: 0MB
09:35:55.242 -> Total space: 2774MB
09:35:55.242 -> Used space: 0MB
09:35:55.242 -> Listing directory: 1:/
09:35:55.242 -> DIR : 1:/System Volume Information
09:35:55.242 -> FILE: 1:/pippo.txt SIZE: 6
09:35:55.277 -> FILE: 1:/pluto.txt SIZE: 6
09:35:55.277 -> Listing directory: 0:/
09:35:55.277 -> FILE: 0:/mickey.txt SIZE: 7
09:35:55.277 -> FILE: 0:/mouse.txt SIZE: 6
I insert a readFile routine copied from SD_Test
09:38:23.553 -> Flash Size: 4MB
09:38:23.553 -> SD Card Size: 15079MB
09:38:23.553 -> Total space: 3MB
09:38:23.553 -> Used space: 0MB
09:38:23.553 -> Total space: 2774MB
09:38:23.553 -> Used space: 0MB
09:38:23.553 -> Listing directory: 1:/
09:38:23.584 -> DIR : 1:/System Volume Information
09:38:23.584 -> FILE: 1:/pippo.txt SIZE: 6
09:38:23.584 -> FILE: 1:/pluto.txt SIZE: 6
09:38:23.584 -> Listing directory: 0:/
09:38:23.584 -> FILE: 0:/mickey.txt SIZE: 7
09:38:23.584 -> FILE: 0:/mouse.txt SIZE: 6
09:38:23.584 -> Reading Dir: /pippo.txt
09:38:23.584 -> Failed to open file for reading
09:38:23.584 -> Reading Dir: /pluto.txt
09:38:23.584 -> Failed to open file for reading