Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Did not work at ESP32-CAM #469

Open
JoergTiedemann opened this issue Feb 17, 2024 · 6 comments
Open

Did not work at ESP32-CAM #469

JoergTiedemann opened this issue Feb 17, 2024 · 6 comments

Comments

@JoergTiedemann
Copy link

Hi I'm using latest version on a ESP-32-CAM board.
But i didn't got it to run
I use the followingfor initialization:
if (!SD.begin(SS, SD_SCK_MHZ(10))) { Serial.println("SD Card Mount Failed"); return; }
but everything was i got was
SD-card mount failed.
SO what is the right configuration for an ESP32-CAM board ?

@greiman
Copy link
Owner

greiman commented Feb 17, 2024

What happens if you run the QuickStart example?

@JoergTiedemann
Copy link
Author

JoergTiedemann commented Feb 18, 2024

quickstart example did not work:

I got standard SD library running with this parameters:

....
#define SD_MISO 2
#define SD_MOSI 15
#define SD_SCLK 14
#define SD_CS 13
SPIClass sdSPI(VSPI);
sdSPI.begin(SD_SCLK, SD_MISO, SD_MOSI, SD_CS);
if(!SD.begin(SD_CS, sdSPI)){ 
...

So at my ESP32-CAM board the CS Pin is definitly GPIO 13
If I enter 13 in the serial monitor of quickstart example I got the following message:

13
Assuming the SD is the only SPI device.
Edit DISABLE_CHIP_SELECT to disable another device.
SD initialization failed.
Do not reformat the card!
Is the card correctly inserted?
Is chipSelect set to the correct value?
Does another SPI device need to be disabled?
Is there a wiring/soldering problem?
errorCode: 0x1, errorData: 0x0
Restarting
Enter the chip select pin number: 

Because of I got standard SD library running I suppose that something with SPI Interface to access SDFat is going wrong
problably you can help me or give me some tips how to get the example working on ESP32-CAM

@greiman
Copy link
Owner

greiman commented Feb 18, 2024

Try the following.

#define SD_MISO 2
#define SD_MOSI 15
#define SD_SCLK 14
#define SD_CS 13
SPIClass sdSPI(VSPI);
#define SD_CONFIG SdSpiConfig(SD_CS, USER_SPI_BEGIN | SHARED_SPI, SD_SCK_MHZ(10), &sdSPI)

...

  sdSPI.begin(SD_SCLK, SD_MISO, SD_MOSI, SD_CS);
  if (!SD.begin(SD_CONFIG)) { Serial.println("SD Card Mount Failed"); return; }

I don't have your ESP32 board so I can't test it.

@greiman
Copy link
Owner

greiman commented Feb 18, 2024

I did compile the following. But can't test it.

#include "SdFat.h"
SdFat SD;

#define SD_MISO 2
#define SD_MOSI 15
#define SD_SCLK 14
#define SD_CS 13
SPIClass sdSPI(VSPI);
#define SD_CONFIG SdSpiConfig(SD_CS, USER_SPI_BEGIN | SHARED_SPI, SD_SCK_MHZ(10), &sdSPI)

void setup() {
  Serial.begin(9600);
  while (!Serial) {}
  sdSPI.begin(SD_SCLK, SD_MISO, SD_MOSI, SD_CS);
  if (!SD.begin(SD_CONFIG)) { Serial.println("SD Card Mount Failed"); return; }
}
void loop() {
}

@JoergTiedemann
Copy link
Author

this works,
thank you for support :-)
you should at minimum add an addidional example in your repo please
found many posts on google about people with same problem

@greiman
Copy link
Owner

greiman commented Feb 18, 2024

you should at minimum add an addidional example in your repo please

There is a example of more general way to use non standard SPI.

The arguments for SdSpiConfig are defined in the html documentation.

opt

The problem is that there are now hundreds arduino compatible boards. I can't really even test on very many.

See this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants