dmays / google-code-arduino

Automatically exported from code.google.com/p/arduino
Other
0 stars 0 forks source link

WARNING: Arducam SD Card to quick DUE Board #1130

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
The SD card speed is much faster than ArduCAM shield, so if they work together, 
the SPI should configurate with the lower speed.

Please read the following to work with DUE board.
For ArduCAM shield work with Arduino DUE, you have to modify the SD library.
1. Please add the last line to \libraries\SD\utility\Sd2Card.h like follows.
/** Set SCK to max rate of F_CPU/2. See Sd2Card::setSckRate(). */
uint8_t const SPI_FULL_SPEED = 0;
/** Set SCK rate to F_CPU/4. See Sd2Card::setSckRate(). */
uint8_t const SPI_HALF_SPEED = 1;
/** Set SCK rate to F_CPU/8. Sd2Card::setSckRate(). */
uint8_t const SPI_QUARTER_SPEED = 2;
uint8_t const SPI_ARDUCAM_SPEED = 3;
2. Please change the SDClass::begin() function in the \libraries\SD\SD.cpp file 
like follows:
boolean SDClass::begin(uint8_t csPin) {
/*
Performs the initialisation required by the sdfatlib library.
Return true if initialization succeeds, false otherwise.
*/
//return card.init( SPI_FULL_SPEED, csPin) &&
//return card.init(SPI_HALF_SPEED, csPin) &&
//return card.init(SPI_QUARTER_SPEED, csPin) &&
return card.init(SPI_ARDUCAM_SPEED, csPin) &&
volume.init(card) &&
root.openRoot(volume);
}

Please report new issues here:

https://github.com/arduino/Arduino/issues

Thanks!

Original issue reported on code.google.com by razupal...@gmail.com on 4 Dec 2013 at 7:56