62 lines
1.9 KiB
Plaintext
62 lines
1.9 KiB
Plaintext
|
Support has been added for the Arduino Due.
|
||
|
|
||
|
You must connect your SD socket to the 6-pin "ISP connector". You must have short
|
||
|
wires or a custom shield to run at full speed, 42 MHz.
|
||
|
|
||
|
If you have problems use a lower SPI speed. You can also check for SPI
|
||
|
errors by editing SdFatCobfig.h to enable CRC checking.
|
||
|
|
||
|
You should be be able to use any digital pin for SD chip select. The default
|
||
|
pin is SS which is pin 10 for Due.
|
||
|
|
||
|
The default SPI rate is 42 MHz. You can set SD chip select and the SPI rate
|
||
|
by calling:
|
||
|
|
||
|
bool SdFat::begin(uint8_t chipSelectPin, uint8_t spiRateID);
|
||
|
|
||
|
The second argument, spiRateID, sets the SCK rate and can be these symbols:
|
||
|
|
||
|
SPI_FULL_SPEED - 42 MHz
|
||
|
|
||
|
SPI_DIV3_SPEED - 28 MHz
|
||
|
|
||
|
SPI_HALF_SPEED - 21 MHz
|
||
|
|
||
|
SPI_DIV6_SPEED - 14 MHz
|
||
|
|
||
|
SPI_QUARTER_SPEED 10.5 MHz
|
||
|
|
||
|
SPI_EIGHTH_SPEED 5.25 MHz
|
||
|
|
||
|
Large reads and writes use fast multi-block SD read/write commands. For optimal
|
||
|
speed, use records that are a multiple of 512 bytes.
|
||
|
|
||
|
Run the bench.ino example to explore large read/write speed.
|
||
|
|
||
|
Replace this line:
|
||
|
|
||
|
#define BUF_SIZE 100
|
||
|
|
||
|
With a large size like this:
|
||
|
|
||
|
#define BUF_SIZE 8192
|
||
|
|
||
|
For best results the record size should be a power of two (512, 1024, 2048,
|
||
|
4096, 8192). In this case records will be aligned with FAT cluster boundaries.
|
||
|
|
||
|
Since Due is fast, increase the test file size by editing this line:
|
||
|
|
||
|
#define FILE_SIZE_MB 5
|
||
|
|
||
|
Run the PrintBenchmark.ino example to compare text formatting speed of Due
|
||
|
with AVR boards.
|
||
|
|
||
|
A number of options are available to configure SPI for the Due board.
|
||
|
|
||
|
You can use the standard SPI.h library by editing SdFatConfig.h and set
|
||
|
USE_ARDUINO_SPI_LIBRARY nonzero. You must include SPI.h in your sketch.
|
||
|
|
||
|
Several options can be set in Sd2Card.cpp in the USE_NATIVE_SAM3X_SPI
|
||
|
section. These include USE_SAM3X_DMAC to control use of DMA and
|
||
|
USE_SAM3X_BUS_MATRIX_FIX to change Bus Matrix operation. Most people
|
||
|
will not need to change these.
|