Pages: 1 2 [3] 4   Go Down
Author Topic: SdFat for Due posted  (Read 20980 times)
0 Members and 1 Guest are viewing this topic.
nr Bundaberg, Australia
Offline Offline
Tesla Member
***
Karma: 126
Posts: 8471
Scattered showers my arse -- Noah, 2348BC.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

@fat16lib

Quote
I plan to play with 4-bit SDIO mode sometime in the future for SdFat.
Any progress with this?

I'm designing a Due clone at present and wondering if I should incorporate the HSMCI interface to an SD socket.

______
Rob

Logged

Rob Gray aka the GRAYnomad www.robgray.com

0
Offline Offline
Edison Member
*
Karma: 63
Posts: 1599
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

It is unlikely that SdFat will support 4-bit SDIO on SAM3X since it won't work on Due.

I am reconsidering support for non Arduino boards.  I can't test unless I have a board and it's a lot of labor for a few users.

I have been playing with SDIO on STM32F4 for my own RTOS use.  SDIO provides super performance but you need large transfers with a lot of buffer.

I would be interested to know what Arduino applications would require more than a few MB/sec of I/O to an SD card.
Logged

nr Bundaberg, Australia
Offline Offline
Tesla Member
***
Karma: 126
Posts: 8471
Scattered showers my arse -- Noah, 2348BC.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I can't test unless I have a board and it's a lot of labor for a few users.
I understand, maybe I can bribe you with some hardware when the time comes smiley

As for the number of users, that's in the lap of the Gods.

Quote
SDIO provides super performance but you need large transfers with a lot of buffer.
External RAM is supported, so buffer space should not be a problem.

Quote
I would be interested to know what Arduino applications would require more than a few MB/sec of I/O to an SD card.
That's probably the $64 question. I'm hoping to also have I2S support so maybe audio apps that analyse sound, a DSO that saves the waveform, logic analyser.

I guess I'm working on the "if you build it they will come" model, but they may not.

______
Rob
Logged

Rob Gray aka the GRAYnomad www.robgray.com

0
Offline Offline
Edison Member
*
Karma: 63
Posts: 1599
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I wouldn't do anything to prevent  use of HSMCI.  I was very disappointed with Due.

All of these sound great:
Quote
I'm hoping to also have I2S support so maybe audio apps that analyse sound, a DSO that saves the waveform, logic analyser.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 29
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I would like to experiment with the new system. But I am in the dark how you hook up an Arduino Due with an Sd card shield (I have a SEEED Studio SD card shield v 3.1). Could you please give me some details on how you do that?

Kindest Regards,
MJM
Logged

nr Bundaberg, Australia
Offline Offline
Tesla Member
***
Karma: 126
Posts: 8471
Scattered showers my arse -- Noah, 2348BC.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

How about a link to that shield?

In lieu of one I assume it uses SPI so you would connect it to the SPI pins and a CS pin of your choice on the Due.

One possible problem is that it may be designed for a 5v host and level shift the voltages, this may or may not work well with a 3v3 host.

Once again more information (and a schematic) of the shield would help.

_____
Rob
Logged

Rob Gray aka the GRAYnomad www.robgray.com

Offline Offline
Newbie
*
Karma: 0
Posts: 29
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The web site with only a description (no schematic) is http://www.seeedstudio.com/depot/sd-card-shield-p-492.html
There is no description of the connectors to this SD shield. It seems to me that a 6 pin connector on the arduino due (next to the processor chip) needs to be connected to the connectors on the SD shield. I don't know the name of these and at the store they couldn't help.  The 5V vs 3.3 V problem you mention could be solved with a jumper from the Due to the SD shield. Any ideas on the connectors and how to connect them?

MJM
Logged

nr Bundaberg, Australia
Offline Offline
Tesla Member
***
Karma: 126
Posts: 8471
Scattered showers my arse -- Noah, 2348BC.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

The first thing I see on that page is

Quote
Arduino and Seeeduino compatible ( Do not compatible with Mega)

That might be a problem smiley

But without a schematic or some real information I don't know what to suggest except map out the schematic yourself from the PCB or buy a board from someone who does provide proper documentation.

______
Rob
Logged

Rob Gray aka the GRAYnomad www.robgray.com

Offline Offline
Newbie
*
Karma: 0
Posts: 29
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks, That is probably wise councel.

Kindest Regards,
MJM
Logged

Offline Offline
God Member
*****
Karma: 32
Posts: 507
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

There's an issue when SdFat and the VGA library are used together (see http://arduino.cc/forum/index.php/topic,150517.msg1226434.html#msg1226434)

I've been looking into this and the problem seems to be down to an SPI overrun. The VGA library is quite a DMA hog, and what appears to happen is that in spiRec() the TX DMA sends data faster than the RX DMA can write it to memory due to the bus contention.

Looking at the data sheet, the SPI_MR register has a flag SPI_MR_WDRBT which should hold up the TX DMA until the RX DMA has read the SPI_RDR register. I'm experimenting with the following fix:

in Sd2Card.cpp, in spiRec() around line 234
after this line: #if USE_SAM3X_DMAC
add this line:   pSpi->SPI_MR |= SPI_MR_WDRBT;

in spiSend() around line 268
after this line: #if USE_SAM3X_DMAC
add this line:  pSpi->SPI_MR &=~ SPI_MR_WDRBT;

The idea is that in spiRec() the SPI_MR_WDRBT flag helps keep the two DMA channels in sync, but spiSend needs the flag turned off again otherwise it will hang.

I have not given this fix much testing other than running bench and QuickStart, and a modified QuickStart which outputs to VGA, which all work correctly.
Logged


0
Offline Offline
Edison Member
*
Karma: 63
Posts: 1599
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I am rearranging SPI into files for each processor so I will add the SPI_MR_WDRBT fix to SAM3X.

I will soon post this in an SdFat beta.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 1
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi
I followed that thread but i cant get it to work.
I am using Breakout Board for SD-MMC Cards: https://www.sparkfun.com/products/11403
I am confused about the pin connection.
what i did so far i connected:
D0   ===>    MISO  (ICSP-1)
CLK ===>    SCK   (ICSP-3)
CMD ===>   MOSI  (ICSP-4)
D3   ===>   PIN 10
GND ===>   GND
VCC ===>   3.3V

 the rest of the ICSP pins are not connected

can anyone help me with schematic for this break board connection to the DUE?
Logged

0
Offline Offline
Edison Member
*
Karma: 63
Posts: 1599
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I did tests with the SPI_MR_WDRBT bit set on SPI receive. 

I used a 1 GB ATP industrial grade SD card which has SLC flash.

Setting the bit slows read a lot.

Here are results of bench with SPI_MR_WDRBT set in receive:
Quote
Free RAM: 79135
Type is FAT16
File size 10MB
Buffer size 16384 bytes
Starting write test.  Please wait up to a minute
Write 3833.62 KB/sec
Maximum latency: 65578 usec, Minimum Latency: 3866 usec, Avg Latency: 4265 usec

Starting read test.  Please wait up to a minute
Read 2993.18 KB/sec
Maximum latency: 5752 usec, Minimum Latency: 5457 usec, Avg Latency: 5472 usec

Here are the results with SPI_MR_WDRBT clear in receive.
Quote
Free RAM: 79135
Type is FAT16
File size 10MB
Buffer size 16384 bytes
Starting write test.  Please wait up to a minute
Write 3832.15 KB/sec
Maximum latency: 65958 usec, Minimum Latency: 3864 usec, Avg Latency: 4267 usec

Starting read test.  Please wait up to a minute
Read 4391.14 KB/sec
Maximum latency: 3956 usec, Minimum Latency: 3715 usec, Avg Latency: 3730 usec

Read is about 1,400 KB/sec slower with the bit set so I don't think I can justify setting the bit as the default.
Logged

Offline Offline
God Member
*****
Karma: 32
Posts: 507
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Yes that's too much of a compromise :-( I've been experimenting with other flags and DMA settings and I can't get the lost speed back.

Also after modifying the bench example to output to the VGA library, it turns out that setting SPI_MR_WDRBT is slower than disabling DMA (#define USE_SAM3X_DMAC 0) when using both libraries together. There is no way I can find of getting the two libraries to share DMA without either SdFat going too slow or getting SPI underruns, or the VGA library getting visual glitches. Disabling DMA in SdFat is faster by about 50% (800KB/s v 1200KB/s) with no glitching.

Logged


Offline Offline
Newbie
*
Karma: 0
Posts: 1
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

NOOB ALERTHi,

Don't mind me asking this NOOBY question, but how do i connect my Arduino Due --> SD Card Shield?
Can i got the proper pin number and if req., any resistors?

Thanks for your help.

--
Rohin
Logged

Pages: 1 2 [3] 4   Go Up
Jump to: