mbed_NXP-LPC1768 -> writing to SDCard using SDHCFileSystem with DFRobot 513137

21 Jul 2012

Hey fellas,

Board: NXP LPC1768. Firmware: 21164 SD Module: DFRobot 513137 (http://www.dfrobot.com/index.php?route=product/product&filter_name=sd%20card%20module&product_id=163) SD Card: PNY Premium 8GB SDHC Class 4 Developer: a true noob!

I am trying to set up an SD card for writing text. In a nutshell, nothing special, I am trying to set up my board to be able to write data and variables (strings) to the SD card, preferably to a specific file. If the file doesn't exist, I would like to create it. Likewise with directories... As for the moment, I am just trying to get something to write to SD card.

Here is my code...

/media/uploads/TheKirkwoods/sdhcfilesystem.zip

I was able to get this example, listed on DFRobot.com, working on my Arduino, but because the LPC1768 is much faster, I would like to play around with the mbed board.

The DFRobot SCCard Module is wired as such:

<<text>>
mbed LPC1768  ->  DFRobot SDCard Module
pin 1  (GND)  ->  GND
pin 5  (mosi) ->  MISO
pin 6  (miso) ->  MOSI
pin 7  (sck)  ->  SCK
pin 8  (cs)   ->  SS
pin 39 (5V)   ->  5V
<</text>>

When I run the program, and watch the output via serial, I get a statement which reads: "No disk, or could not put SD card in to SPI idle state" "init card = 0"

Can anyone help me out? I don't really know why this might be failing. Also, I'm still learning a lot about micro controllers.

Thanks in advance!

Scott

21 Jul 2012

The module was made for arduino. That is a 5V device. However SD cards are 3V3. There is no schematic of the module but I see some resistors on the photograph. They probably used some simple resistor dividers to adapt the 5V arduino controlsignals mosi ss and scl to 3V3. The mbed is a 3V3 device. Voltage dividers on these signals will probably mean that the levels are too low for the SD card to recognise and accept. You may be able to modify the module if you are experienced at soldering SMD. Otherwise try and find a module for 3V3. I think Sparkfun has them. BTW not sure that the current libs support 8GB cards. Try smaller cards first, like 2GB.

21 Jul 2012

I see what you're getting at with the power issue, and I agree that Arduino is 5V, mbed is 3V3. However, I was careful to supply the SD card with 5V directly. Something tells me that power is not an issue here, since I am essentially getting a "read" error, and the red LED on the board is turned on when power is provided to the mbed board.

As for the SD card, I have read a lot of information regarding SD card capacity and there being some issues with SD cards as high as 8Gb and 16Gb not being supported. So, I will try using a 1 or 2 Gb card and repost on the outcome.

Thank you for your efforts!!!

Scott

21 Jul 2012

I tried to explain above that it is not the powersupply. You provide 5V power and a regulator on the module converts that to 3V3 Power supply for the SD card and the LED lights up. The problem is with the control signals. The module was designed for 5V levels from the arduino. There is a voltage divider on the module to reduce these levels to 3V3 required for the SD card. You now provide the 3V3 levels from mbed. These levels are also reduced by the voltage dividers and will be too low to be recognised as a valid logic high by the SD card. This results in the SD card not responding.

21 Jul 2012

Oh...I'm sorry, I misunderstood that. That makes total sense. Sorry. Still searching for a smaller card to try...

Scott

22 Jul 2012

I have tried using a Lexar 128MB SD Card in conjunction with the DFRobot SD Card Module and apparently, I have no change in functionality. When I am able to get a hold of my multimeter, I will check the voltages being applied to the SD Card, but I am suspecting that your thought is directly on the money with this one. Physically, the DFRobot will not work with mbed. In the mean time, I have another SD Card on order from SparkFun for $9.95.

http://www.sparkfun.com/products/204