Announcement

Collapse
No announcement yet.

Unable to save data on SD card

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Unable to save data on SD card

    Hello,

    I am new here, and hope to help and get helped from others. I want to save data on SD card. I am using a 4Duino (Picaso Graphic processor). The issue I have is that I cannot seem to save data on SD card. Below is the code I used:


    void loop()
    {
    Display.gfx_Cls();
    word handle;
    handle = Display.file_Open("try1.txt",'a');
    Display.putstr("Writing to MicroSD... \n");
    Display.putstr("HELLO WORLD to SAMPLE.txt \n");
    delay(2000);
    Display.file_Write(11,"HELLO WORLD",handle);
    Display.file_Close(handle);
    Display.putstr("DONE!");
    }

    On the 4Duino screen, I can see the message:
    Writing to MicroSD
    HELLO WORLD to SAMPLE.txt
    DONE!

    When I open the file "try1.txt" on SD card, I don't see any message. Please help.

    After running a sample code, it display on the screen 'Drive not mounted'. Not sure what to do.
    Attached Files
    Last edited by Shurp; 14th October 2019, 11:37 AM.

  • #2
    Hello,

    Welcome to the forum.

    Your code is working fine on my end. What SD card are you using? Have you tried other SD card? Is your card formatted to FAT16? Please have a look at this appnote on how to format your SD card:
    AN-00042 General Partitioning a micro-SD into FAT and RAW Components

    Thanks and kind regards,
    Sherwin

    Comment


    • Shurp
      Shurp commented
      Editing a comment
      Thank you for responding. The current microSD card that I am using is a 32 Gb, HC formatted to FAT32. I have not tried another SD card. I will read the link
      you provided, and see if it solves the problem. I will keep you updated.
      Last edited by Shurp; 14th October 2019, 05:19 PM.

  • #3
    I did not receive the message "Driver not mounted" anymore after following the partitioning of MicroSD card. The issue I have now is that it does not save the data on MicroSD card. The image attached is the partitioned MicroSD info, and the code I ran. What can I do?
    Attached Files
    Last edited by Shurp; 15th October 2019, 02:10 PM. Reason: I forgot to mention "not" on a sentence.

    Comment


    • Shurp
      Shurp commented
      Editing a comment
      I found the issue, and solved it.

  • #4
    I am really thankful of sherwin4D of helping me. I was able to solve the issue. Thank you again.

    Comment


    • sherwin4D
      sherwin4D commented
      Editing a comment
      Hello,

      That's good news.

      Thanks for the update. Could you please share how you were able to solve the issue and what do you think exactly was the cause? It would be quite helpful to others should they run into this same problem.

      Kind regards,
      Sherwin

  • #5
    There were two issues: First one was that I got the message "Driver not installed". Second issue was that I was not able to save any data on the SD card.

    Solution for the first issue: I read the document "AN-00042 General Partitioning a micro-SD into FAT and RAW Components" provided by Sherwin4D, and partitioned 8Gb sandisk (RAW 3.70Gb and RAW 3.68Gb). After that, I did not receive "Driver not installed" message.

    Solution for the second issue: I found out in the code that I put the command "Display.file_Unmount() early as shown on the image below. I should put the command at the end.

    This solved my issue.
    Attached Files

    Comment

    Working...
    X