G400D- Unable to write file-content to sd-card

… not the reason for your problem, but writing data with a size of 1 MByte to a byte array is a possible problem. The max. size of a byte array in NETMF is 768 KB according to this thread.

I think it is better to write the data in chunks to the SD-card and in a separate thread to avoid that the system is unresponsive while writing to the SD-Card.

@ scardinale - at runtime your code is working without any error.
I added a text at the beginning of the file. those text has not been overwritten or extended by the additional text.

we use the basic concept of the ghi-sd-breakout (rev 1.5). there are capacitors used.
I downloaded your breakout - there are no capacitors used.

I’ve read anywhere that some sd-cards have already integrated capacitors. Double use of capacitors - any problem?
Currently I am using AData 16GB MicroSdHC card.

The provided code will append a new line of text to the file each time it is run. If it is not appending anything then your problem is hardware related and not software related.

Please show us your schematic and perhaps one of the hardware gurus here can point out any obvious problems.

My design on the custom board includes the appropriate capacitors.

During development, we used a Sparkfun SD breakout that did not include any capacitors as you have discovered and only a Pull-Up resistor on the Card Detect line. There were no problems with this configuration.

The above code was run successfully using a cheap Memorex 8Gb SD card.

I do not know anything about the SD Cards having built-in capacitors.

@ scardinale - Which Firmware do you use?
I am using

I am using the latest GHI SDK and NetMF 4.3.1

Loader (TinyBooter) version information: on this computer. on this device.
 >>> The Loader (TinyBooter) is up to date. <<<

 Firmware (TinyCLR) version information: on this computer. on this device.
 >>> The Firmware (TinyCLR) is up to date. <<<
 Please wait for the device to reboot... Done.

@ scardinale - no difference in behave. since the one case for about 50tries, nothing has been written successfully
each line of the hardware sd-link has been check, direct connection - no use of capacitors.
the only big difference in our applications is the card-type, i use micro-sdhc.

sorry: I only updated the netmf application layer, not HAL (loader)

It should make any difference if you are using a MicroSD or SD MMC Card. Our custom board is using a MicroSD while development was done on a SD Card. during development, both GHI MicroSD Module, GHI SD Card Module and a Sparkfun SD Breakout Board. All performed the same.

On a side note, you should always update TinyBooter to match the Firmware version to avoid problems.

Have you tried to use other Micro SD Cards?

@ scardinale - yes, up to 5.
for updating bootloader. i have to user PA13. It is intern sp1 clk and not used at g400TH.

is there existing any hardware-design guide to fulfil any requirements?
i took a ghi gadget as reference.

To update the BootLoader refer to the following instructions. [url]https://www.ghielectronics.com/docs/336/g400-bootloader-installation[/url]

And correct, PA13 is the correct pin.

@ scardinale - I check other… ghi sd gadget (standard size) results in unformated storage device, the same car which has been detected as formated. switching back to my own g400 controller -system --> card will be detected as formated.

for me it seems, that there is a specific line, which ich responsible for basis detection.
unfortunately i am firm with the very basics of sd-card bus communication.

@ scardinale - PA13 is only internally used - not realized as if gpio on header board g400TH.

What are you using PA13 for internally? GHI warns against using any SPI1 pins as SPI1 is also used for G400D memory.

@ scardinale - sorry, missunderstandig - I found the correct reference (the pinout table leaks)

G400-D_Module_Brochure-526395.pdf (Page2)