I'm trying to use the [Ultimate GPS Shield][/https://www.adafruit.com/product/1272] and the [Feather S3 2MB PSRAM][/https://www.adafruit.com/product/1272] together, and write to the SD Card - the reason I have chosen this is that the development grid in the middle forms a very convenient development space for my project.
I've made the following connections:
SD ----> ESP32-S3
MOSI(DI) ----> 11
SD_CS ----> (None, as it is pulled up by the shield).
I'm attempting to use the VSPI port (as I have a display using the default SPI port). My code is as follows:
Code: Select all
#include <SPI.h>
#include <SD.h>
#define VSPI_SCLK 13
#define VSPI_MISO 12 // 12 -> DI
#define VSPI_MOSI 11
#define VSPI_SS 14
#if CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3
#define VSPI FSPI
#endif
//uninitalised pointers to SPI objects
SPIClass * vspi = NULL;
SPIClass * hspi = NULL;
void setup() {
vspi = new SPIClass(VSPI);
hspi = new SPIClass(HSPI);
vspi->begin(VSPI_SCLK, VSPI_MISO, VSPI_MOSI, VSPI_SS); //SCLK, MISO, MOSI, SS
pinMode(vspi->pinSS(), OUTPUT); //VSPI SS
pinMode(hspi->pinSS(), OUTPUT); //HSPI SS
if (!SD.begin(VSPI_SS, *vspi)) {
while (1) {
Serial.println("card mount failed");
delay(100);
}
}
}
// the loop function runs over and over again until power down or reset
void loop() {
//use the SPI buses
Serial.println("1");
delay(100);
}