I'm in a trouble controlling a SDCard(1GB) with FAT16-formatted.
I changed the firmware of my netduino v.4.1.1-alpha usin MFDeploy.exe.
I use GPIO_PIN_D3 as CS-pin of SDCard.
Here's my code. And I could build with no errors.
using System; using System.Threading; using Microsoft.SPOT; using System.IO; using Microsoft.SPOT.Hardware; using SecretLabs.NETMF.IO; using SecretLabs.NETMF.Hardware; using SecretLabs.NETMF.Hardware.Netduino; namespace NetduinoApplication3 { public class Program { public static void Main() { StorageDevice.MountSD("SD1", SPI_Devices.SPI1, Pins.GPIO_PIN_D3/*CS pin*/); 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("filename: " + files[i]); FileStream fs = new FileStream(files[i], FileMode.Open, FileAccess.Read, FileShare.None, 512); StreamReader sr = new StreamReader(fs); Debug.Print("contents: " + sr.ReadToEnd()); } } } }
I connected my netduino with "TFT-LCD & SDCard shield"(this shield was made in JPN) hit "F5" key to start debug.
But VS2010 just say, "The debugging target is not an initialized state;rebooting".
So I Stopped debuging. And I plugged USB cable after unplugged my netduino,but There's no changes.VS2010 just say rebooting. :-p
So give me any advice?
- Sim likes this