SdFat for Due posted

Hi.

I can't initialize faster then SPI_DIV6_SPEED, but even with only this speed, I get double the speed in slideshow that I had previously. My tft is ITDB32WD (400x240), and I load a full image in 0.37s. Without DMAC, it tooks 0.70s.

Thank you very much!!!

But about speed, how do you have it wired to be able to handle 42Mhz?

I have an SD socket connected directly to the SPI header with very short, under an inch, wires on a proto shield.

stimmer has this setup.

Incidentally I am using 6 inch flying leads from the SPI port into a breadboard and an SD breakout. No errors

Ok, thank you.

I've one SD module somewhere, I'll wire it up to test it.

BR,

Joao

Well, confirmed.

Wired directly to ICSP header on due I get full speed!! :grin:

I getting from a Sandisk Extreme PRO (95MB/s):

Type any character to start
Free RAM: 62747
Type is FAT32
File size 50MB
Buffer size 32768 bytes
Starting write test.  Please wait up to a minute
Write 4235.57 KB/sec
Maximum latency: 30782 usec, Minimum Latency: 7633 usec, Avg Latency: 7732 usec

Starting read test.  Please wait up to a minute
Read 4436.36 KB/sec
Maximum latency: 7791 usec, Minimum Latency: 7373 usec, Avg Latency: 7385 usec

Done

The best speed is obtained with 32k buffer.

I'm running slideshow now in 295mSec per picture, outstanding!!! ]:smiley:

Would it be to hard to implement the paralell mode in arduino? I don't mind to sacrifice the card reader to have it working this way!!! :smiley:

I don't think the SDIO 4-bit mode can be implemented on Due. It appears that I/O line PA21 is used to drive the TX LED.

The High Speed MultiMedia Card Interface uses PA21 for MCDA0, data line 0 of the SD.

I plan to play with 4-bit SDIO mode sometime in the future for SdFat.

There are drivers for STM32F4 and I have an Olimex STM32-H407 so that may be first. This is an amazing card for about $39 STM32-H407 - Open Source Hardware Board.

168 MHz, 1 MB Flash, 196 KB RAM

I agree, the specs are amazing! :wink:

Ok, I just thought abut the 4 bit interface because it could be simpler and faster to implement.

I'll google on that to see what I get.

Thank you! :wink:

The 4-bit SDIO interface is usually not simpler to use than SPI.

The protocol is propitiatory and only practical using the built in SDIO controller. With Due it appears you can't use the SDIO controller since one I/O line from the SDIO controller is used for the TX LED.

Using SDIO requires writing a new SD card layer since it is very different than the SD SPI protocol.

Humm, ok, that's bad news. We have to stick with SPI then, ok.

Thank you for the info.

Here is a measurement I did with SDIO on stm32f4 for block sizes 512b-32kB

I make the following connection between the Due and the Sparkfun SDshield:
Due SDshield


Ground Ground
3.3V 3.3V
D8 D8
MOSI D11
MISO D12
SCK D13

It is working at full speed!!!
Here are the result with a Kingston 2 GB microSD card:

Type any character to start
Free RAM: 62747
Type is FAT16
File size 20MB
Buffer size 32768 bytes
Starting write test. Please wait up to a minute
Write 2224.90 KB/sec
Maximum latency: 721045 usec, Minimum Latency: 8101 usec, Avg Latency: 14716 usec

Starting read test. Please wait up to a minute
Read 3954.20 KB/sec
Maximum latency: 9005 usec, Minimum Latency: 7940 usec, Avg Latency: 8286 usec

Done

Then I enable CRC checking (USE_SD_CRC set to 2 in SdFatConfig.h) and I modify bench.ino so that it loops for ever.
After more than 100 loops, I don't get any error

=========== Pass number 106 ===========
Free RAM: 62743
Type is FAT16
File size 20MB
Buffer size 32768 bytes
Starting write test. Please wait up to a minute
Write 1268.47 KB/sec
Maximum latency: 370285 usec, Minimum Latency: 19459 usec, Avg Latency: 25752 usec

Starting read test. Please wait up to a minute
Read 1686.36 KB/sec
Maximum latency: 20292 usec, Minimum Latency: 19243 usec, Avg Latency: 19429 usec

Done
=========== Pass number 107 ===========

I guess than, despite of large (and ugly) connections between the two cards, the buffer on the SDshield help to reformat the signals.
Thank you fat16lib for your library!

I am having trouble getting my card prepped for the DUE, I am using the SanDISK Extreme Pro 16 Gb (95Mbps)

Running QuickStart

Enter the chip select pin number: 10

Card successfully initialized.

Can't determine the card size.
Try another SD card or reduce the SPI bus speed.
The current SPI speed is: 10.50 MHz
Edit spiSpeed in this sketch to change it.

Running PrintBenchmark

Type any character to start
Free RAM: 95507
Can't access SD card. Do not reformat.
SD errorCode: 0X4,0XFF

Any ideas why this is the case?

Dan

Hi!

How are you connecting the SDcard to Due?

Lmao, yes..

I am using a similar stand lone like this:

http://arduino-direct.com/sunshop/index.php?l=product_detail&p=246

SS to pin 10 and everything else connected to the SPI header in the middle of the due.

Daniel

Ok, might be because of that chips and resistors.

Try to go to the lowest speed possible first.

If it works, start increasing until it fails.

Hmmm, interesting, I changed it to EIGHTH speed and quickstart, benchmark and sdformatter all worked. But that was the only speed that allows me. I hope this is fast enough for my application. How can I try and obtain a faster speed. Perhaps the 6'' cables are too long.

Dan

If you reduce cabling, you might get close to 14Mhz. But with that resistors, you'll not move further then that.

I've used the sdcard in my tft also, and I've managed to get up to 28Mhz by removing the resistors and just put a shunt in their place.

The only way I've got 42Mhz, was with one sdcard reader like that with wires directly attached to the sdcard reader socket bypassing all the electronics there. Those electronics are for voltage translation and are very slow. Since Due is already 3.3V, you can safely bypass it.

I can place a picture here later for your reference.

I think I am okay with the speed I have - I am just logging 2 byte numbers at 50Hz - so if I need the extra space, I will change the design.

Thanks :smiley:

Hi.

Ok, that's up to you off course, I was just suggesting.

Anyway, the is the modded sdcard reader for Due.

Regards,

Joao

Thanks for the work on the library! Here's first results from bench for an 8 GB PNY micro class 4 in the Adafruit micro SD breakout:

Type any character to start
Free RAM: 95415
Type is FAT32
File size 5MB
Buffer size 100 bytes
Starting write test.  Please wait up to a minute
Write 85.27 KB/sec
Maximum latency: 159470 usec, Minimum Latency: 15 usec, Avg Latency: 1171 usec

Starting read test.  Please wait up to a minute
Read 1208.31 KB/sec
Maximum latency: 865 usec, Minimum Latency: 15 usec, Avg Latency: 81 usec

What were they thinking when they put the pins in the middle, right under the edge of the shield footprint? (I guess they were thinking minimum conductor length, and matching the original layout but not to accommodate existing shields that ignored the ICSP header...)

Here's the same card with 20 MB and 32768 Buffer at full speed.

Free RAM: 62747
Type is FAT32
File size 20MB
Buffer size 32768 bytes
Starting write test.  Please wait up to a minute
Write 2074.35 KB/sec
Maximum latency: 452410 usec, Minimum Latency: 7830 usec, Avg Latency: 15788 usec

Starting read test.  Please wait up to a minute
Read 4381.52 KB/sec
Maximum latency: 12166 usec, Minimum Latency: 7413 usec, Avg Latency: 7476 usec

more details at Good Things... Small Packages: uSD on the Arduino DUE including the connection system I rigged up for the Adafruit breakout board.

Hey Guys

I have LCD with SD card + shield for him + arduino DUE

the shield got this conection with sd card and due board

D_BUSY pin 7
D_CLK pin 6
D_CD pin 5
D_DIN pin 4
D_OUT pin 3
D_IRQ pin 2
F_WP pin 1 TX0
F_HOLD pin 0 RX0

Ok so, where i find pin definition in lib ?