SD Card not accessible
Risposta
04/05/15 18.21
Dear all,

I have a problem with the SD card, which I cannot access. Running the SDC_sdCardApp, which is one of the XDK-Examples, I get the following output in the console:
 INFO | XDK DEVICE 1: SD card is not inserted in XDK
 INFO | XDK DEVICE 1: SD card is not inserted in XDK
 INFO | XDK DEVICE 1: SD card is inserted in XDK
 INFO | XDK DEVICE 1: SD card Write to file complete..
 INFO | XDK DEVICE 1: SD card is inserted in XDK
 INFO | XDK DEVICE 1: SD card Write to file complete..

So, the SD card (formatted in FAT16) is recognized, however no file is written onto the card.

Playing around a bit more, I got the error code FR_NOT_READY, when I try to generate a new directory ('mkdir'). Needless to say, that the SD card works perfectly well in my computer.

Any ideas, how I can get the SD card to work, or does anybody have a (simple) sample code for SD card operation?

BTW, in the operating instructions, a demo called 'Data Logger' is referenced, which I cannot find. Is it available somewhere?

Many thanks for your help, Simon
0 (0 Voti)
SD Card not accessible
Risposta
06/05/15 12.38 come risposta a Jochen Traub.
Hello patu-t,

the „Data Logger“ demo isn’t available right now, but it will be released soon.
What type of SD-card did you use? Did you try another one or did you try to reformat the card?
If the SDC_sdCardApp was successful, a file called „TEST_XDK.txt“ should be written on the card.

Regards,
Manuel
0 (0 Voti)
SD Card not accessible
Risposta
11/05/15 20.47 come risposta a Manuel Cerny.
Hello Manuel

Thanks for your answer. I was using quite an old SD card. In the meantime, I bought a new one (class 10/16GB). With this card, the file "TEST_XDK.txt" is written to the card. However, when putting the card into the computer, the file is reported as being corrupt. Is this the normal behavior?

As I am new to embedded systems and C++ programming, I would be really grateful if you (or somebody else) could provide a simple(!) code sample for writing data to the card. I do not seem to able to mount and write with the correct parameters.

Many thanks for your help, Simon
0 (0 Voti)
SD Card not accessible
Risposta
12/05/15 8.32 come risposta a Jochen Traub.
Hi Simon,

the SDC_sdCardApp is the right application to test your SD-card. You have to be careful, when you take the sd-card out of the XDK. If you do it at the wrong moment (during the write process) the file system may be destroyed. 

Please let me know, if this helps you

Regards,
Manuel
0 (0 Voti)
SD Card not accessible
Risposta
29/05/15 10.27 come risposta a Manuel Cerny.
Same problem here. At first, I was able to write the file but it was corrupted. Now I can't even write the file... It gets an error on the f_open function. It tries to create the file and it can't... Possibly some weird error as I have an 64 Gb card but since I only used on the sensor, it appear as an 15,9 Gb card on my computer... any idea?
0 (0 Voti)
SD Card not accessible
Risposta
02/06/15 3.17 come risposta a Miguel Silveira.
Hi miguelsilveira,

Unfortunately, I can only repeat what I said before. 
When the SD card is removed while you write data to it, which basically happens once you remove power from the XDK, you create an invalid filesystem and the SD card is not writeable anymore.
It's a common problem on FAT filesystems as they don't have a journal and can't be recovered automatically.

About your 64/16GB misrecognition problem:
Check your SD Card on your PC and make sure to have the size correctly determined on your PC. It wouldn't be the first time that a SD Card that claims to be 64GB from the printing on the SD and what Windows shows in the explorer, is only 16GB in reality...

Regards,
Florian
0 (0 Voti)
SD Card not accessible
Risposta
02/06/15 7.11 come risposta a Manuel Cerny.
Ok, thanks.

But can you tell me which type of card is supported? I didn't find any documentation about it but it is referred on some other post that you should have a 32 Gb card because of the SPI or whatever.

32 GB SDHC class 10 should work, right?
0 (0 Voti)
SD Card not accessible
Risposta
03/06/15 4.25 come risposta a Miguel Silveira.
Hello miguelsilveira,

as mentioned in this thread: https://xdk.bosch-connectivity.com/xdk-community/category/sd-card-missing-/21031-t/21030#id21030
The XDK only supports SD cards up to 32GB due to the limitation that comes by using the SPI to communicate with the SD Card reader. That limits us to SDHC cards which are up to 32GB in size.

The class 10 specification is only a detail for your cards speed and the XDK doesn't require a specific speed. So any speed from class 6 and up will work just fine.

Regards,
Florian
0 (0 Voti)
SD Card not accessible
Risposta
14/08/15 13.00 come risposta a Manuel Cerny.
Just in case anyone else got stuck trying to get SDC_sdCardApp to work, I'll share my solution.

I had two issues with the supplied code:
  1. The cycle of formatting and writing is never terminated, so it's not possible to pop the card out of the XDK without ending up with a corrupted file and / or a corrupted file system. I solved this problem by inserting a call to SDC_sdCardWriteReadDeInit() after data validation in function SDC_sdCardFatFileSystemWriteRead
  2. There is a problem in the f_mkfs function call, because Windows 7 (which is running on my workstation) does not support multiple partitions on removable disks. I fixed that by changing the second parameter SDC_PARTITION_RULE_FDISK to 1 (SFD mode).
0 (0 Voti)