Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.

HaxyMaxy

Member Since 08 Nov 2013
Offline Last Active May 13 2014 04:14 AM
-----

Topics I've Started

Adafruit data logger SD card communication

22 January 2014 - 02:18 AM

I am unable to communicate with an SD card attached to a netduino 1 (formatted 4.2.0.1) via adafruit pre assembled SD card

logger shield.

 

using System;using System.IO;using Microsoft.SPOT.IO;using System.Threading;using Microsoft.SPOT;using Microsoft.SPOT.Hardware;using SecretLabs.NETMF.Hardware;using SecretLabs.NETMF.IO;using SecretLabs.NETMF.Hardware.Netduino;namespace _2010testapp{    public class Program    {	    public static void Main()	    {		    StorageDevice.MountSD("SD1", SPI_Devices.SPI1, Pins.GPIO_PIN_D10);		    string[] directories = System.IO.Directory.GetDirectories(@"");		    Debug.Print("directory count: " + directories.Length.ToString());		    for (int i = 0; i < directories.Length; i++)		    {			    Debug.Print("directory: " + directories[i]);		    }		   			 string[] files = System.IO.Directory.GetFiles("SD1");		    Debug.Print("file count: " + files.Length.ToString());		    for (int i = 0; i < files.Length; i++)		    {			    Debug.Print("file: " + files[i]);		    }		    while (true)		    {		    }	    }    }}

 

 

when it gets to the line "string[] files = System.IO.Directory.GetFiles("SD1");"

 

I get an exception "An unhandled exception of type 'System.IO.IOException' occurred in System.IO.dll"

 

I have tried with a 4 gb micro sd card in an adapter and a 16gb sd card.

both have been tried in every format availible in the built in windows sd card formatter.

 

Thank you in advance for any insight to my problem,

Maxwell

 


SD Card problems

28 November 2013 - 10:14 AM

I am trying to use an adafruit logger shield but I am unable to read or write to sd card. Can someone let me know what critical piece I am missing?

 

I get this:

 

The thread '<No Name>' (0x2) has exited with code 0 (0x0).
Current Directory =
A first chance exception of type 'System.IO.IOException' occurred in Microsoft.SPOT.IO.dll
error encounteredException was thrown: System.IO.IOException
The thread '<No Name>' (0x1) has exited with code 0 (0x0).
The program '[18] Micro Framework application: Managed' has exited with code 0 (0x0).
 

 

My main function is this:

public static void Main()        {            StorageDevice.MountSD("SD", SPI.SPI_module.SPI1, Pins.GPIO_PIN_D10);            Debug.Print("Current Directory = " + Directory.GetCurrentDirectory());            try            {                for (int i = 0; i < 5; i++)                {                    Directory.CreateDirectory(Directory.GetCurrentDirectory() + "Folder" + i);                    Debug.Print("successfully created Folder" + i + "!");                }            }            catch (Exception e)            {                Debug.Print("error encountered" + e.Message);            }         }

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