ESP32-Arduino: How to use SD library with VSPI

birdofpreyX
Posts: 1
Joined: Tue Dec 04, 2018 11:44 am

ESP32-Arduino: How to use SD library with VSPI

Postby birdofpreyX » Tue Dec 04, 2018 1:25 pm

Hello,

what changes exactly do I need to perform in sd.h and sd.cpp of the SD library to change the SD-Drive connection references from standard HSPI to VSPI. Im using a ESP32 Devkit board:
https://github.com/espressif/arduino-es ... braries/SD

I have a kind of Mode 1 SPI Sensor on HSPI which does not accept other devices on the same bus.

I want to use both SPI (sensor and sdcard reader) with this method:
https://github.com/espressif/arduino-es ... _Buses.ino

Sorry for this probably easy question, but Im a newbie.

Thank you very much for your help.

FreddyVictor
Posts: 8
Joined: Sat Dec 01, 2018 11:34 am

Re: ESP32-Arduino: How to use SD library with VSPI

Postby FreddyVictor » Wed Dec 05, 2018 1:13 pm

OK, proviso, I'm new to ESP32....

I don't believe you need to make any changes to the sd.* files
Just use the code as per your link
Connect sdCard to vspi pins:
//SCLK = 18, MISO = 19, MOSI = 23, SS = 5
and connect your sensor to hspi pins:
//SCLK = 14, MISO = 12, MOSI = 13, SS = 15

or, you can choose whatever pins you want by using the:
spi->begin(sck_pin_no, miso_pin_no, mosi_pin_no, ss_pin_no);
function instead

SPI is a straightforward protocol (unlike i2c) and can easily be 'bit-banged' (if no hardware support)

Who is online

Users browsing this forum: No registered users and 67 guests