ESP32s NodeMCU 无法识别 SD 卡突破:“卡安装失败”

问题描述 投票:0回答:2

我正在尝试让我的 NodeMCU ESP32S 连接到我拥有的 SD 卡分线器。它是这样连接的:

我相信根据这张图正确纠正了这些问题,它显示了我特定板上的 SPI 连接:

不幸的是,在 arduino SDE 中对此进行简单测试时,我在串行监视器上得到以下输出:

13:37:22.839 -> rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
13:37:22.839 -> configsip: 0, SPIWP:0xee
13:37:22.839 -> clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
13:37:22.874 -> mode:DIO, clock div:1
13:37:22.874 -> load:0x3fff0018,len:4
13:37:22.874 -> load:0x3fff001c,len:1044
13:37:22.874 -> load:0x40078000,len:8896
13:37:22.874 -> load:0x40080400,len:5816
13:37:22.874 -> entry 0x400806ac
13:37:23.324 -> Card Mount Failed

一切似乎都连接正确,但我想知道是否有人知道为什么在尝试打开卡时这可能会明显失败。这是代码示例:


#include "FS.h"
#include "SD.h"
#include "SPI.h"
void setup() {
  Serial.begin(115200);
  pinMode(19, INPUT_PULLUP);
  SPI.begin(18, 19, 23);
  if (!SD.begin(5)) {
    Serial.println("Card Mount Failed!");
  }
}

void loop() {
  // put your main code here, to run repeatedly:

}
c arduino microcontroller sd-card esp32
2个回答
2
投票

对于任何其他与微型 SD 模块有相同问题的人,您应该将微型 SD 卡模块的 VCC 引脚连接到 ESP32 的引脚 Vin,而不是 3.3 V 输出。 micro-sd卡模块需要5V,不能用3.3V


0
投票

使用 VSPI 默认引脚,因为 GPIO12 (HSPI) 引脚会导致不断重启:

// define the SD card pins
const int SD_CS_PIN = 5;
const int SD_MOSI_PIN = 23;
const int SD_MISO_PIN = 19;
const int SD_SCK_PIN = 18;

// initialize the SPI bus
SPIClass spi(VSPI);


void setup(){

    Serial.begin(115200);

    spi.begin(SD_SCK_PIN, SD_MISO_PIN, SD_MOSI_PIN, SD_CS_PIN);
    SD.begin(SD_CS_PIN, spi);
    // enter code here

}
© www.soinside.com 2019 - 2024. All rights reserved.