0

HUZZAH32 esp32 SD card
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

HUZZAH32 esp32 SD card

by billos on Tue Dec 19, 2017 9:29 am

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 !!!

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

Re: HUZZAH32 esp32 SD card

by billos on Tue Dec 19, 2017 10:44 am

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 ??

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

Re: HUZZAH32 esp32 SD card

by adafruit_support_mike on Wed Dec 20, 2017 12:17 am

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.

adafruit_support_mike
 
Posts: 58886
Joined: Thu Feb 11, 2010 2:51 pm

Re: HUZZAH32 esp32 SD card

by billos on Wed Dec 20, 2017 8:49 am

Thanks !!!

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

Re: HUZZAH32 esp32 SD card

by rmetzner49 on Sat Jan 13, 2018 6:52 pm

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.

rmetzner49
 
Posts: 13
Joined: Wed Jul 01, 2015 10:51 am

Re: HUZZAH32 esp32 SD card

by RevRamp on Sat Aug 04, 2018 10:27 am

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?

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

Re: HUZZAH32 esp32 SD card

by adafruit_support_mike on Sat Aug 04, 2018 11:03 pm

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);

adafruit_support_mike
 
Posts: 58886
Joined: Thu Feb 11, 2010 2:51 pm

Re: HUZZAH32 esp32 SD card

by mcwhittemore on Wed Feb 20, 2019 12:03 am

A few weeks ago I made a PR to https://github.com/espressif/arduino-esp32/blob/master/variants/feather_esp32/pins_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

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

Re: HUZZAH32 esp32 SD card

by adafruit_support_mike on Thu Feb 21, 2019 1:14 am

Thanks!

adafruit_support_mike
 
Posts: 58886
Joined: Thu Feb 11, 2010 2:51 pm

Re: HUZZAH32 esp32 SD card

by radhey04ec on Sun Aug 04, 2019 4:39 am

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

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

Please be positive and constructive with your questions and comments.