tomicdesu
Member
I can't seem to puzzle out how to get SdFat to use SPI1, eg. pins 1, 26 and 27 (MISO1, MOSI1, SCK1). I tried to satisfy the SdSpiDriver config but nothing works -- I get an error return from begin(). I can't use the default pins as they're being used by VGA DMA done by the FlexIO.
Either of these solutions would solve my problem:
* Can the default SPI device driver be told to use different, arbitrary pins?
* How do I tell the SdFat driver to use SPI1 and not SPI?
The code below is about as simple as possible, and does only begin() on one drive. I posted a similar question in the Technical Support section. I don't mean to spam, I think that one is too complex and I wasn't sure what board to post in.
Any help appreciated.
tom
Either of these solutions would solve my problem:
* Can the default SPI device driver be told to use different, arbitrary pins?
* How do I tell the SdFat driver to use SPI1 and not SPI?
The code below is about as simple as possible, and does only begin() on one drive. I posted a similar question in the Technical Support section. I don't mean to spam, I think that one is too complex and I wasn't sure what board to post in.
Any help appreciated.
tom
Code:
#include <SPI.h>
#include "sdios.h"
#include "SdFat.h"
#define SD_USE_CUSTOM_SPI
#define SDCARD_SD1_PIN 36
#define SDCARD_SD2_PIN 37
#define SDCARD_MISO_PIN 1
#define SDCARD_MOSI_PIN 26
#define SDCARD_SCLK_PIN 27
SdExFat sd1;
void setup() {
Serial.begin(9600);
// disable sd2 while initializing sd1
pinMode(SDCARD_SD2_PIN, OUTPUT);
digitalWrite(SDCARD_SD2_PIN, HIGH);
delay (500);
Serial.println ("\n\nsd1.begin()");
if (!sd1.begin (SdSpiConfig (SDCARD_SD1_PIN, SHARED_SPI, SD_SCK_MHZ (16)))) {
Serial.println ("SD1 begin error");
}
}
void loop() {}