Main Site Documentation

sD card interrupt handler possible?


#1

I have been going through the eBook and cannot find an example or confirmation if it is possible or not to create a interrupt handler for when a SD card is inserted. The code for the USB interrupt handler is extremely useful and I would like to implement a similar strategy for handling my SD devices.

// Subscribe to RemovableMedia events
            RemovableMedia.Insert += new InsertEventHandler(RemovableMedia_Insert);
            RemovableMedia.Eject += new EjectEventHandler(RemovableMedia_Eject);

            // Subscribe to USB events
            USBHostController.DeviceConnectedEvent += new USBH_DeviceConnectionEventHandler(USBHostController_DeviceConnectedEvent);

This is the code from the eBook which I guess most of the FEZ users know pretty well. My problem with not being able to do this is that, if I cannot use an interrupt routine then I need to use a loop that continuously scans the SD slot for if the device is connected, so my code is going to be frozen at this point.

Also, a side question. If I design a pcb board that has a connection for the larger SD cards instead of the micro sD’s, would the fez still operate the same with the larger cards. *Assuming I can make a PCB correctly. I have zero experience designing with SD memory, but from what I can tell they are pretty much the same port for the regular and the micro besides the size difference.

Regards,
Aaron


#2

No built in way but you can have a low priority thread that checks the SD availability once a second


#3

To answer your side question,

Basically, SD Card use SPI interface.

You can look at FEZ Cobra schematic, Cobra use ordinary SD Card on the board.

Common pins for SD Card to connect to FEZ Domino

1 - CS connect to any digital pin i.e Di10
2 - DATA IN connect to MOSI (Di11)
3 - GND connect to GND
4 - VDD 3.3V connect to 3.3V
5 - CLK connect to SCLK (Di13)
6 - GND connect to GND
7 - DATA OUT connect to MISO (Di12)
8 - DATA 1 not connect
9 - DATA 2 not connect


#4

Actually no. This is another unique feature about most GHI products. We use a standard 4-bit SD interface.


#5

Gus:
Ok, let me rephrase my answer

:wink:


#6

I was just about to ask a question the eBook already answered. I am getting better! :stuck_out_tongue:

So I got alot of information about the sd card from you, but I am still unclear as to whether I can impliment the micro sd on a regular size sd. For the time being all I want to know is if it is possible, and if so are the connections one to one?

Thanks for the info.

Aaron


#7

Aaron:

I have never done the implementation on regular size SD on FEZ either!!
It’s possible though, but you may have to write a lot more code.

You probably need some resistors and may be diode, etc. in between SD and microController.

the attached schematics show you a few option to connect SD to microController.

I was able to do as shown on both schematics, using Arduino (ATMega168/328 microcontroller) with available SD libraries.

Here is my question,
I wonder why you want to use the ordinary SD Card, it about to fade away and it is expensive per unit to buy??


#8

My project is a portable station to transfer files between commonly used portable memories. I am going to integrate a USB hub onto a PCB and wanted the option to make it compatible with SD.

I am not sure about this but I think the larger SD is still used in cameras. However I have a feeling that your right, the micro SD is probably going to be taking over that area of electronics soon too. I should do some research on the subject before trying to put that into the project. Thank you the schematic though! ;D


#9

Right! That’s why they also selling, or bundle an SD card adapter with micro SD card.