Problem with M2 and SD Card

MS: Cannot initialize the SD card: MS: Card is unusable, try another one
FS: Can’t open 0:/data to write, error code 12
FS: Attempt to write string to a non-open file.
FS: Attempt to close a non-open file.

Trying to use DataLogger_dif. Builds and loads fine but this is the error that I get. I’ve re-formatted the card per the tool specified on your forum. But still doesn’t work. Help please.

What size is this sdcard?

I tried with a 16 and a 32 gig.

If you have a card available that is less than 4gig try it… The format on a <4gig card is different than a 4gig or bigger card and some devices have trouble taking to them. Atleast take that out of the equation.

Rodney

Works with a 4gig card. Is this working as expected? Doesn’t seem very current to have such a small size limitation.

You can look for an Arduino Due library that supports larger cards. A 3 second google search shows that you need to insure the card is Fat32 and it SHOULD support up to 32gig of storage. It is a standard Arduino Due SDCard setup and library if I am not mistaken. I have not tried to use it yet.

Above 32gig and the sdcard uses a different technology but it looks like there are libraries out for them too if needed.

Rodney

Yeah, like Rod said, the limitation is that you need FAT32 formatting. Newer/larger cards are likely to be formatted with exFAT which is a newer formatting type and supports larger sizes. But, up to a certain size you should be able to reformat as FAT32 and be OK. We probably should investigate options to support the newer systems but Microsoft likes to patent their file systems so exfat isn’t so likely to be supported by free and open source drivers. Thus, your best bet really is to stick with 16GB cards and smaller. This is still quite a bit of space for a little embedded processor to use.

I will check my 16 gig cards to make sure they are FAT32. Thanks for everyone’s help.

Just did a little test. On my Mac, I checked the format of a 16gig card and it said it was FAT32. However, the cataloguer sketch distributed with M2 didn’t like it. Same error as before. Still works with a 4 gig card, of course. Will look for another library as previously suggested.

Hey dshield09, I am curious if you ever resolved your problem with large cards? If so, how?

@dshield09 I’m having some issues with a Kingson 4GB SD Card while running the sample DataLogger_dif with the prints stating that my card is unusable. I also tried a 16GB and 32GB from SanDisk with no luck.

I’ve used the native Windows 10 and the SD Association card formatter and it says my card is formatted as FAT32.

Could you share your solution for using the 4GB card?

Here’s a link to the sdcard I’m using as a reference. https://www.amazon.com/Kingston-microSDHC-Adapter-SDC10-4GB/dp/B004S1PNAO

Thank you in advance!

For anyone playing along at home, I tried several different cards (of different sizes and brands) before I found one that worked.
The older the better…

As an additional data point for anyone worried it will be hard to find a suitable card: I bought 64GB card last year for another project (https://www.amazon.ca/gp/product/B07DTGMFFD), and after re-partitioning the card into 2 32GB partitions and formatting each with FAT32 using the regular Windows disk manager, the first partition works fine with the M2.

I’m sure the 32GB variant would work also too.