do you want to check if this version of SD adapted for esp32 can help you ?
this library take in account the 3 versions of esp32 known in SPI library for esp32.
' ESP32:
' FSPI = 1, SPI attached To flash / normally Not used
' HSPI = 2, uses SPI2 => MOSI (13), SCK (14), MISO (12), SS (15)
' VSPI = 3, uses SPI3 => MOSI (23), SCK (18), MISO (19), SS (5)
' VSPI is SPI by default
' ESP32-S2:
' FSPI = 1, uses SPI2 =>MOSI (13), SCK (14), MISO (15) And SS (12) / 6 SS lines any other pin
' HSPI = 2, uses SPI3 =>MOSI (35), SCK (36), MISO (37) And SS (34) / 3 SS lines at any other pin
' VSPI Not defined
' ESP32 C3:
' FSPI = 0, uses SPIx =>MOSI (5), SCK (6), MISO (7) And SS (10) / 6 SS lines any other pin
' HSPI Not defined
' VSPI Not defined
with this library, you can choose between 4 initialize depending of your configuration:
bool Initialize(uint8_t spi, uint8_t SDss, bool format_if_empty);
bool Initialize1(uint8_t spi, uint8_t SDss, ULong frequency, byte max_files, bool format_if_empty);
bool Initialize2(uint8_t spi, uint8_t SDss, uint8_t SCLK, uint8_t MISO, uint8_t MOSI, bool format_if_empty);
bool Initialize3(uint8_t spi, uint8_t SDss, uint8_t SCLK, uint8_t MISO, uint8_t MOSI, ULong frequency, byte max_files, bool format_if_empty);
several SPI types are defined to select VSPI/HSPI/VSPI depending of esp version
#define /*byte ESP32_FSPI;*/ B4R_FSPI 0x1
#define /*byte ESP32_HSPI;*/ B4R_HSPI 0x2
#define /*byte ESP32_VSPI;*/ B4R_VSPI 0x3
#define /*byte ESP32C3_FSPI;*/ B4RC3_FSPI 0x0
#define /*byte ESP32C3_HSPI;*/ B4RC3_HSPI 0x1
#define /*byte ESP32S2_FSPI;*/ B4RS2_FSPI 0x1
#define /*byte ESP32S2_HSPI;*/ B4RS2_HSPI 0x2
and after selection of SPI type, you can select what pins you want to use .
i hope it can answer at all configurations.