Netduino home hardware projects downloads community

Jump to content


Photo

SD card not working on N+ 4.2 RC3


  • Please log in to reply
15 replies to this topic

#1 Geancarlo

Geancarlo

    Member

  • Members
  • PipPip
  • 24 posts

Posted 14 November 2011 - 05:47 AM

Hello. First of all, I'd like to say thanks for this fun and easy development platform.

The reason I am posting is that I am facing issues with micro SD cards(using a Kingston SDC/2GB atm), as other people have already posted.

The following code works just fine with firmware 4.1.0.6 on NetduinoPlus:

using System;
using System.IO;
using System.Net;
using System.Net.Sockets;
using System.Threading;
using Microsoft.SPOT;
using Microsoft.SPOT.IO;
using Microsoft.SPOT.Hardware;
using SecretLabs.NETMF.Hardware;
using SecretLabs.NETMF.Hardware.NetduinoPlus;

namespace MicroSdTest
{
    public class Program
    {
        public static void Main()
        {
            Thread.Sleep(1000);
            VolumeInfo vol = new VolumeInfo("\\SD");

            string dir = Directory.GetCurrentDirectory();
            string[] dirs = Directory.GetDirectories("\\");
            dirs = Directory.GetDirectories("\\SD\\");
            foreach (string d in dirs)
                Debug.Print(d);                

            Debug.Print("ok");
        }
    }
}

I usually set a breakpoint before
dirs = Directory.GetDirectories("\\SD\\");
so I can check the contents of vol or I can just let it pass crashing or printing. It turns out that on 4.1.0.6, it detects the FAT filesystem just fine and I can format/print the directories. On 4.2 RC3 none of that occurs and the code crashes whenever I try to access any of the card's features.


I have tried this simple code running back and forth from 4.1.0.6 to 4.2RC3 a few times and the behavior was consistent. Am I missing something like mounting it on 4.2RC3 or is it a bug? This particular issue is delaying a project of mine...

edit:forgot to post the actual exception I get
A first chance exception of type 'System.NotSupportedException' occurred in Microsoft.SPOT.IO.dll
A first chance exception of type 'System.IO.IOException' occurred in System.IO.dll
An unhandled exception of type 'System.IO.IOException' occurred in System.IO.dll

Thanks,
Geancarlo Rocha

#2 Geancarlo

Geancarlo

    Member

  • Members
  • PipPip
  • 24 posts

Posted 16 November 2011 - 09:42 PM

Hello. Any fix, idea, comment, help, progress... anything about this?

#3 Cabadam

Cabadam

    Advanced Member

  • Members
  • PipPipPip
  • 90 posts

Posted 10 December 2011 - 12:47 AM

Hello. Any fix, idea, comment, help, progress... anything about this?


Not much help - but I can recreate the same issue. I just upgraded to 4.2 RC3, and now my app throws an IOException on:
Directory.GetDirectories("\\SD")

#4 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7118 posts
  • LocationNew York, NY

Posted 11 December 2011 - 05:39 AM

Hi Geancarlo, Cabadam. The SD drivers in .NET MF 4.2 have some fairly big changes, so it's possible that they're not understanding something about your MicroSD card. Is there any chance that you'd be willing to lend your SD card to another community member for some testing? KodeDaemon did quite a bit of work on the 4.1 SD drivers...and I bet if we asked nicely he'd be happy to look at your SD card. Chris

#5 Cabadam

Cabadam

    Advanced Member

  • Members
  • PipPipPip
  • 90 posts

Posted 11 December 2011 - 05:27 PM

Chris, I could certainly try sending the SD card if you think that might be helpful. First though, I think I'm going to try a couple other different cards. I think I have one or two sitting around at work that I should be able to test with. For that matter, at work I have a card reader I can stick the current card into and confirm that it isn't just a dead card. I'll update this thread with what I find out. Will probably be tomorrow evening by the time I'm able to. P.S. May not be related, but I did realize that I had the SD card when I installed erased and then flashed the new bootloader. I assume erasing would (should?) only touch the onboard storage... but I can't help but wonder.

#6 Geancarlo

Geancarlo

    Member

  • Members
  • PipPip
  • 24 posts

Posted 12 December 2011 - 11:10 AM

Hi Chris,
at the moment I'm using a 1GB SanDisk card with no problems at all. I also have used another 2GB SanDisk too before. Sadly, I can't send you a card since I'm in Brazil...

Something I'm concerned about is that not all microSD cards are required to be SPI compliant. I haven't digged into netduino's .netmf implementation, but is it safe to assume that spi is the only communication available?

If you check this blog post you can find some interesting information that raises doubts about Kingston cards authenticity and some may not be SPI compliant at all.

Perhaps some of us who have problems with the cards have just been unlucky, but this is not something to be overlooked if we want to make a reliable product based on netduino(!!)

Thanks

#7 Cabadam

Cabadam

    Advanced Member

  • Members
  • PipPipPip
  • 90 posts

Posted 17 December 2011 - 07:42 AM

OK, sorry it took me so long to update this - turns out my week was busier than I thought. I've still had no luck getting it to read the same card that worked fine previously. That is an AData 8GB card. It is still readable by a separate card reader. It shows a FAT32 partition. I then looked into two other cards. Kingston 2GB and Transcend 1GB Both of these work in the RC3 firmware. They also both show a FAT partition.

#8 Igor Kondrasovas

Igor Kondrasovas

    Advanced Member

  • Members
  • PipPipPip
  • 105 posts
  • LocationPorto, Portugal

Posted 05 January 2012 - 08:42 PM

Hello Geancarlo, I am trying to reproduce your original problem, so copied exactly the code you posted, and I am getting compilation errors on the Directory class. (The name 'Directory' does not exist in the current context). I am using the same namespaces you use and alos included the Microsoft.SPOT.IO library. I am using netmf 4.2 RC3 also... Can you imagine what can be wrong? Acordinly to MSDN, the Directory class is on the mscorlib library (included in my project). Any thoughts? Igor.

Igor Kondrasovas

www.inovativatec.com


#9 Geancarlo

Geancarlo

    Member

  • Members
  • PipPip
  • 24 posts

Posted 05 January 2012 - 10:08 PM

Hi, you probably have to add System.IO.

#10 Igor Kondrasovas

Igor Kondrasovas

    Advanced Member

  • Members
  • PipPipPip
  • 105 posts
  • LocationPorto, Portugal

Posted 05 January 2012 - 10:30 PM

Hi, you probably have to add System.IO.


Hello,

I had already tried it, without sucess: Error 1 The type or namespace name 'Directory' does not exist in the namespace 'System.IO' (are you missing an assembly reference?)

It must be something very silly I suppose, but have no clue... can you please open the attached project (HelloWeb) and see if it at least compile sucessfully.?

Thank you,

Igor.

Attached Files


Igor Kondrasovas

www.inovativatec.com


#11 Geancarlo

Geancarlo

    Member

  • Members
  • PipPip
  • 24 posts

Posted 05 January 2012 - 10:41 PM

Hi Igor, I added System.IO to your project and it compiled right away.

#12 Igor Kondrasovas

Igor Kondrasovas

    Advanced Member

  • Members
  • PipPipPip
  • 105 posts
  • LocationPorto, Portugal

Posted 05 January 2012 - 10:54 PM

Hi Igor, I added System.IO to your project and it compiled right away.


Thank you Geancarlo,

I was looking at the namespace only and did not look the library file. I just added the Microsoft.SPOT.IO (my bad).


Thank you very much for the help.

Igor.

Igor Kondrasovas

www.inovativatec.com


#13 Old Hack

Old Hack

    New Member

  • Members
  • Pip
  • 6 posts

Posted 26 October 2012 - 02:49 AM

Same problem. I am using a 1GB SanDisk card. Works fine in my Arduino. I have tried reformatting as well. Hope someone gets this fixed soon. I really need to store data on the card.

#14 Old Hack

Old Hack

    New Member

  • Members
  • Pip
  • 6 posts

Posted 30 October 2012 - 11:39 PM

Any updates on this..... I am starting to feel like my investment in the Netduino may be in vain. If I cannot write to an SD card, my reason for buying it pretty much goes out the window. Any ideas? I have tried several cards and finally got a 1GB Sandisk that the unit can recognize but I still get these pesky First Chance errors. Is this just a software issue that can be resolved with a future (or current) update?

#15 Stefan

Stefan

    Moderator

  • Members
  • PipPipPip
  • 1965 posts
  • LocationBreda, the Netherlands

Posted 31 October 2012 - 07:17 AM

Hi,

I'm sorry to read you're still experiencing problems.
1GB should work just fine, but you're posting in a topic about the N+ 4.2 RC3 firmware.

You can best use Netduino v4.2.0 (Update 1) or Netduino Plus v4.2.0 (Update 1)

I have tested quite a few brands of SD cards with the netduino plus and didn't encounter any problem at all.
"Fact that I'm a moderator doesn't make me an expert in things." Stefan, the eternal newb!
My .NETMF projects: .NETMF Toolbox / Gadgeteer Light / Some PCB designs

#16 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7118 posts
  • LocationNew York, NY

Posted 02 November 2012 - 01:57 AM

Hi Old Hack,

Any updates on this.....

Do you have a link to where we can pick up one of the SD cards like the one you have? We'd like to figure out what's going on with it and add support for it in the software.

Chris




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2010-2014 Secret Labs LLC  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.