-
Notifications
You must be signed in to change notification settings - Fork 0
/
ArduinoDue.txt
executable file
·62 lines (37 loc) · 1.91 KB
/
ArduinoDue.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
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.