10 Replies Latest reply on Feb 5, 2014 2:19 PM by Clayton Hofrock

    SD Card access from Arduino?

    Clayton Hofrock

      Can the SD card slot on the Galileo board be accessed from an Arduino sketch? Is it like there is an SD Shield attached to the board? If so, which pin is connected to the Chip Select?

        • 1. Re: SD Card access from Arduino?
          arduino_4_life

          Hi,

               You can use the arduino SD library to access the SD slot on the board.

          Yes, like you suggested, the SD library works the same way as if you were using an arduino with an SD shield attached.

          However, if you actually do have an SD shield, you will not be able to use it with the SD library on Galileo. The SD library is only for the board's native SD slot.

          1 of 1 people found this helpful
          • 2. Re: SD Card access from Arduino?
            Clayton Hofrock

            I have tried using the SD card slot on the Galileo board, and have used the SD library that came with the IDE. I have not been able to get any of the SD examples to work. I have tried multiple SD cards, the cards do not get detected.

            • 3. Re: SD Card access from Arduino?
              arduino_4_life

              that's weird. Let me try the examples on my own board and I'll get back to you.

              • 4. Re: SD Card access from Arduino?
                arduino_4_life

                hey, I created a dummy text file on my SD card and tried out the 'DumpFile' example, worked no problem for me.

                my apologies if this sounds condescending, but did you try the SD cards in your computer to make sure they work?

                Have you done the firmware update from the IDE?

                You might also see this issue if you already had the SD card mounted through linux when you run the sketch

                1 of 1 people found this helpful
                • 5. Re: SD Card access from Arduino?
                  Clayton Hofrock

                  The last time I tried, I did have Linux booted on the Galileo. Which I think means that it had mounted the SD card, since that is where I put the image.

                   

                  Does that mean that I cannot use a Linux image, and use the SD card for storing data from my Arduino sketch?

                   

                  I was hoping I could create a sketch that would read some temperature and other readings, store this to a file, and then allow the Linux side to access the file.

                  • 6. Re: SD Card access from Arduino?
                    Clayton Hofrock

                    So I have tested it again. This time with a blank SD card.

                     

                    I can access the card just fine. I can check if files exist, I can check if directories exist, I can create directories, I can remove directories.

                     

                    However, I cannot create a new file. Maybe I am doing something silly? I am attaching my sketch, maybe someone can figure out what I did wrong?

                    • 7. Re: SD Card access from Arduino?
                      Ulises_CR

                      hi

                      there is an error on your code at line 44

                       

                      // Check to see if the file already exists:

                      if (SD.exists("temp/test.txt")) {     // here it is the path you miss a ''/' before temp

                        

                           Serial.print("File /temp/test.txt exists.\n");

                            myFile = SD.open("/temp/test.txt", FILE_WRITE);

                            // if the file o...........

                       

                      maybe that could be part of your issues...

                      • 8. Re: SD Card access from Arduino?
                        DAM

                        I had the same problem. The code I got back from initilize was 0.

                        Then I found the getting started guide that said I should upgrade the firmware using the ide.

                         

                        I did this and have gotten to the step Upgrading... This may take upto 5 minutes, Please Wait!

                         

                        It has been over 30 minutes and no change (same messag)

                         

                        Is this going to be an all nighter?

                         

                        It says not to power down or unplug the USB

                         

                        I also found in the Getting started guide, that I should mark the partion active etc usiing diskpart.

                        I folloed all of those steps.

                         

                        the card is not in the Adruino at this point and I have to wait before I can see if anything changed.

                         

                        OK so I upgraded the firmware succesfully and initilized the sd card as an active partition as per the getting started  and now, the sd commands are functional. I am not sure which of these 2 steps accomplished that but obviously at least one of them was needed.

                         

                        by the way, I transferred the default empty code (just the empty setup and the empty loop) to the board first before upgrading the last time (the time that it worked). I dont know that it matters but I forgot that I had sent it until after I sent update. this is just FYI for anyone still having problems.

                        • 9. Re: SD Card access from Arduino?
                          LeonardoL

                          I'm having similar problems.

                           

                          I can read/write an existing file, but I cannot create it.

                          • 10. Re: SD Card access from Arduino?
                            Clayton Hofrock

                            I found an answer to my own question, but I guess I never came back to this thread to post it.

                             

                            Workaround for SD file creation bug.