HUZZAH32 esp32 SD card

For Adafruit customers who seek help with microcontrollers

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
billos
 
Posts: 20
Joined: Thu Nov 16, 2017 9:16 am

HUZZAH32 esp32 SD card

Post by billos »

Can you tell me how can I connect a sd card reader to the huzzah32? I saw in some projects that they connect :

Card Reader // Esp32
CS ---------------> IO5
MISO -----------> IO19
MOSI -----------> IO23
SCK -------------> IO18

but in the pinout of the HUZZAH32

MISO is in pin 19
MOSI is in pin 18
SCK is in pin 5

also where do I have to connect CS and can I use the examples of the arduino?
Thanks !!!

User avatar
billos
 
Posts: 20
Joined: Thu Nov 16, 2017 9:16 am

Re: HUZZAH32 esp32 SD card

Post by billos »

I tried this code in my HUZZAH32 esp32 feather:

Serial.println(MOSI);
Serial.println(MISO);
Serial.println(SCK);
Serial.println(SS);
in order to find out which pin is what and the result was:

MOSI --> 18
MISO --> 19
SCK ----> 5
SS ------> 2

** But which pin is the number 2 ??

User avatar
adafruit_support_mike
 
Posts: 67446
Joined: Thu Feb 11, 2010 2:51 pm

Re: HUZZAH32 esp32 SD card

Post by adafruit_support_mike »

Pin 2 isn't broken out on the HUZZAH32.

The pins that are broken out are labeled on the board, and shown in the Pinouts page of the tutorial:

https://learn.adafruit.com/adafruit-huz ... er/pinouts

GPIO 4 (also A5) is right next to the SPI pins, and would work as a CS signal.

User avatar
billos
 
Posts: 20
Joined: Thu Nov 16, 2017 9:16 am

Re: HUZZAH32 esp32 SD card

Post by billos »

Thanks !!!

User avatar
rmetzner49
 
Posts: 17
Joined: Wed Jul 01, 2015 10:51 am

Re: HUZZAH32 esp32 SD card

Post by rmetzner49 »

Hi Mike: I'm going to assume for the purpose of the above instructions, that these pins map to VSPI. Of course the ESP32 has three SPI ports; HSPI is also supposed to be available. Now you might ask, why would you want to use HSPI? I have tried and tried to make the blasted RA8875 display coexist with other SPI devices. Yes I know there is a bug in the hardware, and it's suggested to use a 74LVC125 to isolate MISO which the RA8875 "hangs on to". My display works just fine so long as I don't try to buffer MOSI. Even with OE grounded on the C125, the display refuses to work. The timing must be super critical if one buffer delay breaks it. So I've given up! I don't have the patience to try a buffer on each of the other lines so delay is consistent.

It seems the SPI library only accepts VSPI though. I saw some posts on GitHub that suggest someone has fixed this but I wanted to see if anyone to your knowledge has attempted to use HSPI. The third port is already used by the FLASH chip that holds the program. Sort of sad that no one has fixed the RA8875 as yet, but it is what it is. Great job on Adafruit's job on the RA8875 and GFX libraries though.

User avatar
RevRamp
 
Posts: 7
Joined: Tue Jul 10, 2018 3:37 pm

Re: HUZZAH32 esp32 SD card

Post by RevRamp »

Sorry to revive a somewhat old dead thread, but I feel like my question is related and could be useful for future googlers.

Card Reader // Esp32
CS ---------------> GPIO 4

Is that how Im supposed to wire it? If so, do I need to specify which pin that is used for the CS in the code, and how do I do that?

User avatar
adafruit_support_mike
 
Posts: 67446
Joined: Thu Feb 11, 2010 2:51 pm

Re: HUZZAH32 esp32 SD card

Post by adafruit_support_mike »

Yes, you need to specify the CS pin in your code. To do that, call the SD object's .begin() method with the pin number: sdcard.begin(4);

User avatar
mcwhittemore
 
Posts: 3
Joined: Tue Sep 25, 2018 11:06 pm

Re: HUZZAH32 esp32 SD card

Post by mcwhittemore »

A few weeks ago I made a PR to https://github.com/espressif/arduino-es ... _arduino.h to update the SS pin to 33. This was based on some other adafruit tutorials around SD cards and the ESP32 that indicated that chip select should be pin 33. I hope this helps future readers.

Source for moving to pin 33: https://learn.adafruit.com/adafruit-ada ... he-sd-card

User avatar
adafruit_support_mike
 
Posts: 67446
Joined: Thu Feb 11, 2010 2:51 pm

Re: HUZZAH32 esp32 SD card

Post by adafruit_support_mike »

Thanks!

User avatar
radhey04ec
 
Posts: 7
Joined: Sat Aug 03, 2019 12:41 am

Re: HUZZAH32 esp32 SD card

Post by radhey04ec »

rmetzner49 wrote:Hi Mike: I'm going to assume for the purpose of the above instructions, that these pins map to VSPI. Of course the ESP32 has three SPI ports; HSPI is also supposed to be available. Now you might ask, why would you want to use HSPI? I have tried and tried to make the blasted RA8875 display coexist with other SPI devices. Yes I know there is a bug in the hardware, and it's suggested to use a 74LVC125 to isolate MISO which the RA8875 "hangs on to". My display works just fine so long as I don't try to buffer MOSI. Even with OE grounded on the C125, the display refuses to work. The timing must be super critical if one buffer delay breaks it. So I've given up! I don't have the patience to try a buffer on each of the other lines so delay is consistent.

It seems the SPI library only accepts VSPI though. I saw some posts on GitHub that suggest someone has fixed this but I wanted to see if anyone to your knowledge has attempted to use HSPI. The third port is already used by the FLASH chip that holds the program. Sort of sad that no one has fixed the RA8875 as yet, but it is what it is. Great job on Adafruit's job on the RA8875 and GFX libraries though.

Hi dear;
Yes I am facing problem in ESP32 with SPI communication . Can you please suggest some tips ? either for HUZZAH32 or ESP32 DEV board.
How initialize VSPI or HSPI ?
How 8 or 16 byte data transfer ?
how read on SPI bus etc ...
I have checked same prgram with ESP8266 , it works fine but for ESP32 I cant do same thing

User avatar
zzztop
 
Posts: 1
Joined: Tue Feb 04, 2020 2:46 pm

Re: HUZZAH32 esp32 SD card

Post by zzztop »

Trying to put all this together, will this wiring work?
Wiring Diagram for Adafruit Feather-32.jpg
Wiring Diagram for Adafruit Feather-32.jpg (272.5 KiB) Viewed 1964 times

Locked
Please be positive and constructive with your questions and comments.

Return to “Microcontrollers”