Code Monkey home page Code Monkey logo

Comments (17)

terjeio avatar terjeio commented on September 14, 2024

Change this line

if(fs) {

to
if(card && fs) {

and the guru should keep meditating.

If you get the Failed to initialize SD card message when a formatted card is inserted then check your wiring as well.

from esp32.

SuksesAmin avatar SuksesAmin commented on September 14, 2024

yes. now
[MSG:Warning: Failed to initialize SD card]
error:60 - SD Card mount failed.

I have tested, the wiring work well using this sketch

#include "FS.h"
#include "SD.h"
#define SD_CS 5
void listDir(fs::FS &fs, const char * dirname, uint8_t levels){
Serial.printf("Listing directory: %s\n", dirname);
File root = fs.open(dirname);
if(!root){
Serial.println("Failed to open directory");
return;
}
if(!root.isDirectory()){
Serial.println("Not a directory");
return;
}
File file = root.openNextFile();
while(file){
if(file.isDirectory()){
Serial.print(" DIR : ");
Serial.println(file.name());
if(levels){
listDir(fs, file.name(), levels -1);
}
} else {
Serial.print(" FILE: ");
Serial.print(file.name());
Serial.print(" SIZE: ");
Serial.println(file.size());
}
file = root.openNextFile();
}
}
void setup(){
Serial.begin(115200);
SD.begin(SD_CS);
if (!SD.begin(SD_CS)) {
Serial.println("failed");
return;
}
uint8_t cardType = SD.cardType();
if (cardType == CARD_NONE) {
Serial.println("No sdcard");
return;
}
Serial.println("Reading SD...");
listDir(SD, "/", 0);
}
void loop(){
}

from esp32.

terjeio avatar terjeio commented on September 14, 2024

Your test program is using the same pins for communicating with the card as grblHAL does?
Which board map are you using - there could be pin conflicts?

from esp32.

SuksesAmin avatar SuksesAmin commented on September 14, 2024

Yes, it is using the same pins. 8GB microsd and bdring v4

from esp32.

SuksesAmin avatar SuksesAmin commented on September 14, 2024

I left all settings as default except CMakeLists.txt. I changed it on line 33 from OFF to ON

from esp32.

terjeio avatar terjeio commented on September 14, 2024

Which version of the SDK are you using? You can use $I to check:

...
[DRIVER OPTIONS:v4.3.1-dirty]
...

from esp32.

SuksesAmin avatar SuksesAmin commented on September 14, 2024

[FIRMWARE:grblHAL]
[NVS STORAGE:*FLASH]
[DRIVER:ESP32]
[DRIVER VERSION:220726]
[DRIVER OPTIONS:v4.3.2-dirty]
[BOARD:BDRING v4]

from esp32.

terjeio avatar terjeio commented on September 14, 2024

I have now tested with the same board map as you and it works for me. A bug/regression/breaking change in the IDF framework?
Anyway here is the binary that works for me:
app-template.zip

from esp32.

SuksesAmin avatar SuksesAmin commented on September 14, 2024

I have tried compiling the sd_card example program from esp-idf which also doesn't work. I'm confused, it's working on arduino ide with a libraries that also made by Espressif.

Using library FS at version 2.0.0 in folder: C:\Users\DASHA\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.3\libraries\FS

Using library SD at version 2.0.0 in folder: C:\Users\DASHA\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.3\libraries\SD

Using library SPI at version 2.0.0 in folder: C:\Users\DASHA\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.3\libraries\SPI

So, the problem is coming from my hardware or isp idf on my computer. I will try other hardware after buying it.

from esp32.

SuksesAmin avatar SuksesAmin commented on September 14, 2024

Now it works with grblhal after I removed the LVC125A IC and connected it directly to the eps32 pin. Still working with the Arduino IDE sketch above.

Hope this helps all of you who are having the same problem.

from esp32.

terjeio avatar terjeio commented on September 14, 2024

after I removed the LVC125A IC

On which hardware? The schematic I have for for the V4.1 board do not show any pin buffering.

from esp32.

SuksesAmin avatar SuksesAmin commented on September 14, 2024

images (2)
this sdcard module that I use.

where can i get the schematic for v4.1?

from esp32.

terjeio avatar terjeio commented on September 14, 2024

this sdcard module that I use.

ok, so the buffer is on module - I have not seen that before. It needs 5V VCC? This since there is a regulator on the module, did you supply that?

where can i get the schematic for v4.1?

I believe I found it here.

from esp32.

terjeio avatar terjeio commented on September 14, 2024

Hmm - maybe this module is not suited for the ESP32 as, IIRC, it is not 5V tolerant. If supplied with 5V it will fry the ESP32 inputs?

from esp32.

SuksesAmin avatar SuksesAmin commented on September 14, 2024

Yes, I'm supplying this with 5v connected to v-in pin of esp32. The AMS117 is 3.3V. so i think it's safe.

I also use this module for stm32f103. the miso, mosi, clk and cs pins are connected to the controller via the LVC12SA ic.

from esp32.

terjeio avatar terjeio commented on September 14, 2024

Most STM32F103 pins are 5v tolerant, not sure about the ESP32 - the MISO pin is an input to the MCU.

from esp32.

terjeio avatar terjeio commented on September 14, 2024

Closing as I've had hours upon hours of successful SD card streaming with the ESP32 recently.

from esp32.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.