Arduino SD library


#6

Check if you are closing the file before removing the SD. Files may not be updated if you don’t. This is a normal behavior (and one of the potential problems I mentioned in another thread a while ago). Or if you keep the file open, you have to flush the file with File::flush() after a write, or you can open the file with the O_SYNC flag to flush every write automatically to the SD.

What about the \AppData\Local\Arduino15\packages\artekit\hardware\stm32f4\1.0.1\libraries\SD\examples\ReadWrite\ example?


#7

Yes I’m using that example.
it reads nothing from the file, both if the file already exists or has to be created (and it’s not)


#8

So you are seeing the following at the serial port, excluding the last line (testing 1, 2, 3)?

Initializing SD card...initialization done.
Writing to test.txt...done.
test.txt:
testing 1, 2, 3.

If so, it is very strange. I would say to try with another SD card.


#9

I’ve tried this:
to retrieve the number od bytes written by the print function

Serial.println("Writing to test.txt...");
num = myFile.println("testing 1, 2, 3.");
Serial.println(num);
// close the file:
myFile.close();
Serial.println("done.");

and I get always zero bytes written

Initializing SD card...initialization done.
Writing to test.txt...
0
done.
test.txt:

#10

that’s my model.


#11

ok, is the SD card model.
I used the SD of a saber sound card and it works. (it’s a SanDisk 4GB class 4 )

By the way, which one are you using @Ivan ?


#12

A bunch of them (around 10 different models/brands). I don’t have precisely the one you posted (I have a 64GB kingston). I am about to order a couple of those.


#13

ok so I’m quite unlucky :joy:


#14

I tried to test as much brands/models as I can. Still have to try with some problematic Sandisk.


#15

If you can, please post a list of the working ones, so we have a reference.


#16

For reference, this is the working SanDisk 4GB Class 4.


#17

Thank you.

We should receive these days 2 different models/brands (the ones beta testers have reported problems).

I should put a list of tested SDs in a separate thread or in the documentation. There is also a new improved SD handling code in queue for version 1.0.2.


#18

Hi @Mangaman.

We’ve ordered 8GB SD card from two different places and we received 16GB instead! Could it be that they are going out of production? How long do you have this SD?

By the way, these SD work without problems.


#19

Hi @Ivan, i got it from Amazon, bought last year.


#20

got one today from Amazon.

Here is the link:
https://www.amazon.it/gp/product/B001CQT0X4/ref=oh_aui_detailpage_o00_s00?ie=UTF8&psc=1


#21

Ok. We’ll try with that vendor.


#22

Have also these two.
I will try them asap.



#23

@Mangaman please try also this with the SD that is not working for you.

Thank you.


#24

Hi @Ivan,
with the new routines it works. Thanks.

What did you change? some timings in the write process?


#25

Mostly initialization code and pin settings.