Freenove / Freenove_ESP32_WROVER_Board

Apply to FNK0060
Other
95 stars 38 forks source link

Available GPIO pins that can be used while using the camera #4

Open iweave1 opened 1 year ago

iweave1 commented 1 year ago

Hi. I want to add an external SD card reader to my project and need to know which GPIO pins I can use for this. In the pinout image there doesn't seem to be more than two unused GPIO pins. This doesn't seem correct. Would you please help me to know which pins I should use?

Zhentao-Lin commented 1 year ago

On our board, if the pin has a horizontal wire, it means that it is the pin of the camera, please avoid using it. I recommend using HSPI pins to read and write SD cards.

include

include

include "SD.h"

define HSPI_MISO 12 //External circuits cannot have pull-up resistors

define HSPI_MOSI 13

define HSPI_SCLK 14

define HSPI_SS 15

SPIClass hspi(HSPI);

void setup(){ Serial.begin(115200); pinMode(HSPI_SS, OUTPUT); hspi.begin(HSPI_SCLK, HSPI_MISO, HSPI_MOSI, HSPI_SS); if (!SD.begin(HSPI_SS, hspi)) { Serial.println("Card Mount Failed"); return; }

uint8_t cardType = SD.cardType(); if (cardType == CARD_NONE) { Serial.println("No SD card attached"); return; }

Serial.print("SD Card Type: "); if (cardType == CARD_MMC) { Serial.println("MMC"); } else if (cardType == CARD_SD) { Serial.println("SDSC"); } else if (cardType == CARD_SDHC) { Serial.println("SDHC"); } else { Serial.println("UNKNOWN"); }

uint64_t cardSize = SD.cardSize() / (1024 * 1024); Serial.printf("SD Card Size: %lluMB\n", cardSize);

Serial.printf("Total space: %lluMB\r\n", SD.totalBytes() / (1024 1024)); Serial.printf("Used space: %lluMB\r\n", SD.usedBytes() / (1024 1024)); }

void loop() {

}

I used a 16GB SD card,and esp32 print the contents by serial port: SD Card Type: SDHC SD Card Size: 15193MB Total space: 252MB Used space: 53MB

iweave1 commented 1 year ago

I tried to use this with a known good SD card reader board. I had to remove the connection to get the program uploaded because pin 12 is the bootstrap pin. Once I uploaded the program, it failed to detect the SD card reader. I took the SD card reader and connected it back up to another microcontroller and it still works there. Are there any other pins that can be used? Pin 12 is definitely problematic.