SD shield with netduino firmware 4.1 alpha 7
#1
Posted 17 February 2011 - 07:57 AM
I am trying to run the following sample and running into volume not found exceptions....
public static void Test()
{
Debug.Print("SDCardTest.Test\n");
StorageDevice.MountSD("SD1", SPI_Devices.SPI1, Pins.GPIO_PIN_D5);
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());
}
StorageDevice.Unmount("SD1");
}
Thanks in advance.
Mehmet
#2
Posted 17 February 2011 - 08:31 AM
#3
Posted 17 February 2011 - 04:40 PM
#4
Posted 17 February 2011 - 10:18 PM
Thank you for the information. The sample code I am using is setting the card to use D5 as chip select. I am a little confused as I am kind of new to this. Should I use D4 and short the physical pin to D10?
Hi Mehmet,
Which pin does your shield use for "chip select" of the SD card? Whichever one it uses...place a jumper wire between that pin header and D10. If it uses D10 (which many shields with SD use), you're already set.
We'll expand this capability in the beta...
Chris
#5
Posted 18 February 2011 - 05:40 AM
I have checked out the schematic for the arduino shield and it looks like it's using #8... I went ahead and removed pin 8 of the shield and jumpered it to pin 10 so pin 10 would connect to the shields CS line. arduino micro sd shield drawing....
I still get the volume not found exception... Could it be the hex converter on the sd shield causing the problem?
Thanks,
Mehmet
#6
Posted 18 February 2011 - 08:01 AM
#7
Posted 18 February 2011 - 06:05 PM
#8
Posted 19 February 2011 - 12:17 AM
#9
Posted 26 February 2011 - 07:58 AM
#10
Posted 26 February 2011 - 08:29 AM
I finally got it to work. Now my challenge is to create directories and files on the card. Are there any samples for that on here? I can't search for sd as it is a 2 letter word.
Hi Mehmet,
Good news!
Take a look at System.IO.FileStream in the .NET MF online docs. Or just search for StreamReader or FileStream on the forums amd you'll find a few...
Chris
#11
Posted 28 February 2011 - 02:16 PM
Chris,
I finally got it to work.
...
You got it to work with the Sparkfun SD Shield with voltage converter chip? Any special actions required?
I've got a Sparkfun shield with voltage converter too any i'm a bit confused. The netduino supplies 3.3V spi signals, so you the shield doesn't actually require a voltage converter on the shield? So that was only for Arduino?
Thanks for the info.
#12
Posted 07 March 2011 - 10:26 PM
You got it to work with the Sparkfun SD Shield with voltage converter chip? Any special actions required?
I've got a Sparkfun shield with voltage converter too any i'm a bit confused. The netduino supplies 3.3V spi signals, so you the shield doesn't actually require a voltage converter on the shield? So that was only for Arduino?
Thanks for the info.
For everybody having the same question, for 4.1.0 alpha 7: just short pin 8 and 10 for the sparkfun shield with voltage converter. Then it works with something like this:
StorageDevice.MountSD("SD", SPI.SPI_module.SPI1, Cpu.Pin.GPIO_Pin8); FileStream filestream = new FileStream(@"SD\filename.txt", FileMode.Append, FileAccess.Write, FileShare.None); StreamWriter streamWriter = new StreamWriter(filestream); streamWriter.WriteLine("WriteSomeText"); streamWriter.Close(); filestream.Close(); StorageDevice.Unmount("SD");
#13
Posted 11 March 2011 - 07:44 PM
The weirdest thing is that the pins have other names on the back:
Any suggestion on how to connect this one?
My .NETMF projects: .NETMF Toolbox / Gadgeteer Light / Some PCB designs
#14
Posted 12 March 2011 - 10:05 AM
My .NETMF projects: .NETMF Toolbox / Gadgeteer Light / Some PCB designs
#15
Posted 15 March 2011 - 09:28 AM
Cheap trick: if you just want some quick and dirty onboard storage, I think you could actually just solder jumper wires directly onto most sd cards' cs, clk, di, do, vcc (3.3v) and gnd connectors. I'm gonna try this myself since I got a lot old and "small" sized (below 1 Gb) that I don't use anymore anyway. I probably need to be careful not soldering too hot for too long.Never mind, I'm a newbie... I used google and found it out: http://en.wikipedia....ower_supply_pin
VDD and VSS are other means for V+ and V-
I got it working with that shield like this:
RSV: Unused
/CS: Pin 10
DI: Pin 11
VDD: 3V3
CLK: Pin 13
VSS: Gnd
D0: Pin 12
If I solder on twin wires I can use a dummy in the other end too so that I even can stick it into a pc for occasional file management while disconnecting it from the netduino. Sure, I could even have a dipswitch and a header for easy access, but then price is getting closer to a bob Better yet, carefully break the sd apart, take the chip(s) out and use the plastic cover for a dummy in the other end.
This trick should work on any sd that boots in spi mode.
Edited by hanzibal, 15 March 2011 - 09:32 AM.
#16
Posted 15 March 2011 - 10:24 AM
#17
Posted 15 March 2011 - 04:27 PM
Exactly, I recently purchased a full size SD bob (before I realized the above) and it was twice the price for a micro and roughly equal to the price of my vs1053 mp3 decoder chip so pricing is definately wrong somwhere.I've used a micro SD breakout board as above and that does nothing more than expose the card's pins. SPI access to the card worked just fine. I can't see why some careful soldering directly to a SD card wouldn't work, if that's your thing. SD (full size) breakout boards do seem strangely more expensive than the micro version.
#18
Posted 17 March 2011 - 09:00 PM
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users