Looking for some assistance on how to connect an SD Card adapter to the WifitKit 32 V3 board. I’m a bit of a beginner at this level but I’ve gone through all the ESP-IDF / ESP32 documentation and the 3/4 posts on this board with people having similar issues to no avail.
Adapter Board Reference:
Using 5V output from mainboard to power adapter.
Wifi Kit 32 V3 Pinout Reference: https://resource.heltec.cn/download/WiFi_Kit_32_V3/HTIT-WB32_V3.png
It looks like the SPI bus ( SCK, CS, MISO, MOSI ) pins are taken by the LoRa chip: https://resource.heltec.cn/download/WiFi_Kit_32_V3/HTIT-WB32_V3_Schematic_Diagram.pdf
My understanding is that any of the GPIO pins can be set to handle SD communications with the board. I’ve tried something like this and it failed:
#define SD_CS 2
#define SD_MISO 33
#define SD_MOSI 34
#define SD_SCK 26
SPIClass *hspi = NULL;
void setup() {
Serial.begin(115200);
while(!Serial);
hspi = new SPIClass(HSPI);
hspi->begin(SD_SCK, SD_MISO, SD_MOSI, SD_CS);
pinMode(SD_CS, OUTPUT);
if(!SD.begin(SD_CS, *hspi)){
Serial.println("Card Mount Failed");
return;
}else{
Serial.println("Card Mounted");
}
}
I then tried just updating the internal reference for those pins in the pins_arduino.h
file for my board.
Then tried a simple task like this and it failed:
Serial.begin(115200);
while(!Serial);
pinMode(SS, OUTPUT);
if(!SD.begin(SS)){
Serial.println("Card Mount Failed");
return;
}else{
Serial.println("Card Mounted");
}
Instead of compiling through Arduino IDE I tried ESP-IDF / idf.py menuconfig to see if there is a setting I need to toggle but found nothing.
I then spent a few hours trying as many combinations as I could. EG:
All digital pins 2,3,4,5
All pins listed as SPI I2c: 26, 33, 34, 35
Tried moving Chip Select to a digital so that MISO/MOSI/CLK were on SPI pins that weren’t connected: CS == 2, MISO/MOSI/CLK == 26, 33, 34
Tried the pins MTCK, MTDO, MTDI, MTMS and all the permutations there.
Nothing works and I am so confused as to why. Is it a wiring issue maybe or a software issue. Didn’t try VSPI but presume it would be the same issues. Can’t wait for it to be a super silly issue but any help would be appreciated.
FWIW:
Works flawlessly on Arduino UNO R3 so SD Card Adapter + Card are good.
Heltec BLE and OLED work great so I think the ESP32S3 is good too.