ESP32 SD Card Interfacing Fast!

Поділитися
Вставка
  • Опубліковано 27 лис 2024

КОМЕНТАРІ •

  • @c_o_n_t_e_n_t3420
    @c_o_n_t_e_n_t3420 4 роки тому +7

    using esp-wroom-32, doit dev, v1.0 (pretty old, dunno if they still make this), and elegoo uno (for testing sd adapter module)
    spi /w 5v module -> works with uno and v5 logic, not with esp32
    spi /w soldered microsd to sd adapter -> works with esp32
    mmc/sdio 1-bit -> needed external 1k pullup on d2
    mmc/sdio 4-bit ...... the rest of this comment...
    after doing some digging.. I found that the pullups added in code in this video might be module dependent.
    seeing NO effect with the software pullups, I tried physical 1k pullups (I didnt do any math on whether this is too much or not enough for spec, try at your own risk) on my breadboard.
    the physical pullups specifically on d12 prevented the module from booting.
    So after some more digging, I found that it looks like there are actually other lanes to access flash on the module that arnt broken out entirely to pins
    but at least on my board, the d12 pin IS shared. so pulling d12 high on boot will not allow the esp32 to access the flash on the module used to boot..
    but I keep finding more things that say all four data pins on the sd card should be pulled high (apparently youre supposed to do this even in 1-bit mode?) including, d12
    so, what I didnt do, was add a delay in code before trying to mount the card (5000-10000ms should be enough, and it should only be d12 that needs this)
    then plug in the resistor to main+ while the code is waiting for me. Then let the code run the mount, list directory, read/write test....
    What I did do, was add the physical 1k resistors to d2, d4, and d15. and connected d12 to a 1k resistor.. to the emitter of an npn transistor.
    ***after boot*** a software pullup on d27 wired to the transistor base (middle pin), completes the circuit from main high, to d12 through the resistor pulling it high.
    it works!
    note: this should only necessary if your module doesnt have software pullups on those sdio pins (which my module does not)
    note: this should only be necessary if your module requires d12 not to be pulled up during boot, so it can access on board flash (which mine does)
    now if only there were a clever way to wire this so I could leave d2 wired and the microsd in place during flashing. I would be super happy.
    thanks for the vid, it didnt get me all the way, but it got me started and in too deep to give up.
    details from espressif on variability between different "official" modules and availability of software pullups
    docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/peripherals/sd_pullup_requirements.html

  • @pikachugo1402
    @pikachugo1402 4 роки тому +7

    Ok i did exactly as you said but things didn't work out for the MMC initially adding the configurations you mentioned, so here's what i did:
    I did not set the pins as INPUT_PULLUP however i did change the SD_MMC.begin() function to SD_MMC.begin("/sdcard", true);
    the i flashed the esp32 without the sd card in the module
    After flashing as expected it says Card mount failed, i added a 2k pullup resister externally to GPIO 2 or D2 and the blue led on the board turns on and it is working, however connect the resister only after the esp32 is flashed.

    • @ArtsyEngineering
      @ArtsyEngineering  4 роки тому +1

      Interesting, so you have no pullups anymore and you also have 1 resistor between Data0 and gpio2 on the esp32? That seems like a strange configuration to me, but if it works I'm glad you pushed through and found a solution! I wonder why you had to do that so differently, though? Nice work, regardless!

  • @MPElectronique
    @MPElectronique 4 роки тому +3

    You are fantastic!!! man :))

  • @bertbrecht7540
    @bertbrecht7540 4 роки тому +3

    I really enjoyed your vid. Thank you! I duplicated your process for SPI and it worked great. Not having to buy an SD board is so great. However your speed results for MMC 1bit and SPI did not seem that much different. Did I miss something or perhaps I am not looking in the right place?

    • @ArtsyEngineering
      @ArtsyEngineering  4 роки тому +5

      I'm so glad it helped!! I just took a look at the video and the important metrics on the different serial console results (to me) are the final (total) read / write times. Unfortunately I cutoff the write times on some of them, but you can see that the 1 bit mode is right around twice the speed (takes half as long) as the spi version. 4 bit mode isn't a whole lot faster, though. I wouldn't consider that to be totally worth it, although it's almost no extra effort.
      With all that said, you may not need the faster speeds for most projects, but if you're ever reading video or sound data off the sd cards or streaming ALOT of logging data to the card it would be a nice option to have.

  • @aurelhollowgram
    @aurelhollowgram 4 роки тому +1

    hello, I have a question: I am not an electronics engineer, except for drones. in short, I would like to make a "fake" micro sd card, and be able to take what goes into the card directly to retransmit it. (video stream) as if you want to turn a micro sd output into something like the hdmi out due to the data coming into it (to the sd card). does that seem possible to you? get the stream that normally goes on the card and make a bridge to have it live? (I'm not in the business, so I have trouble expressing myself.)

    • @ArtsyEngineering
      @ArtsyEngineering  4 роки тому +1

      No worries! I'm not an electrical engineer either, we're all just trying to learn here. So you're saying you already have a drone with a video recorder that saves the video directly to an sd card right now, and you want to somehow tap into that and stream it somewhere else instead? I don't know that this would be totally impossible, but it may be VERY difficult.
      The first problem is the video recorder would be writing to the sd card using 4 or 8 bit MMC so you would need a really fast processor to read the signal and trans-code it back into something use-able.
      The next problem you'd have is going from that signal to hdmi, which would also require a lot of processing and work. I would think you'd have to use something like an fpga to get that done. In short, I would not attempt this, but it would be interesting to see if you do give it a try!

  • @WahidKhan-rx9jo
    @WahidKhan-rx9jo 4 роки тому +1

    Thnx mate , will try this hack!

    • @ArtsyEngineering
      @ArtsyEngineering  4 роки тому +1

      Hope it works out! I'd love to see what you make!

  • @estebeer
    @estebeer 4 роки тому +3

    I tried this code and it seems perfect for my little project, but only NULL values are saved. I tought that this happened because the buffer is declared with no specific values. Before writting the buffer in the sdcard I tried to fill the buffer with zeros but only nulls are saved in the memory. I had the same problem with the file.write() function with the SPI method, but it is the same. Only nulls. Somebody has had this problem too? :(

    • @ArtsyEngineering
      @ArtsyEngineering  4 роки тому +2

      Eder Esteban Reyes would you want to share the code you’re using to form the data you’re writing? I can try and take a look.!

    • @estebeer
      @estebeer 4 роки тому +1

      @@ArtsyEngineering I have not added this code to my main project. I checked before that the time of the implementation were the right one and it seems that it is perfect, but I check the data saved in the sdCard and it only has NULL. I am testing the code of the of the library examples and I tested the final code that I found on Github (github.com/espressif/arduino-esp32/issues/1117)
      In the Github code and the example I used a for cycle to set the values to zero
      //////////////////////// TestCode - TestFileIO//////////////////////////////
      file = fs.open(path, FILE_WRITE);
      if(!file){
      Serial.println("Failed to open file for writing");
      return;
      }
      size_t i;
      start = millis();
      // myCode
      for(int j = 0; j < 512; j++)
      {
      buf[j] = 0;
      }
      //
      for(i=0; i

  • @CreativeJE
    @CreativeJE 4 роки тому

    hey can we use 64 GB Sd cards with these Modules ?

    • @ArtsyEngineering
      @ArtsyEngineering  4 роки тому +1

      I find it a little hard to find good solid info on sd card limits online, but it appears that by default the esp32 only supports the fat file system which maxes out at 32gig (esp32.com/viewtopic.php?t=13880) this post does make mention of being able to enable exfat for larger cards but I can't find any information online about doing it. So without having tested this myself, it would appear that 32 gig would be the natural limit, assuming whatever library you're using (if it's non standard) doesn't impose some other limits on you.

  • @acatisfinetoo3018
    @acatisfinetoo3018 4 роки тому

    Where can i find the source code that you show in the video?

    • @ArtsyEngineering
      @ArtsyEngineering  4 роки тому

      Because I only edited the included examples a bit to make them work, I didn’t include any source. When you install the boards you should find the examples i point out in the video. Open those and pause the video to apply the minor tweaks and you should be all set!

  • @chimpofm
    @chimpofm 3 роки тому +1

    hey buddy get intouch, id love to pick your brain on using this for a crude WIFI flash storage device.

    • @ArtsyEngineering
      @ArtsyEngineering  3 роки тому

      My Instagram recently got banned for some reason, would you want to shoot me an email so we can chat about it? I’d love to help! Jeff at studiomyria . Com

    • @chimpofm
      @chimpofm 3 роки тому +1

      @@ArtsyEngineering facebook paul walsh ;)

  • @juliansanchezmares
    @juliansanchezmares 4 роки тому

    Mejor pago los $3 dólares que cuesta.

    • @ArtsyEngineering
      @ArtsyEngineering  4 роки тому

      If you bought a module for 3$ it's not going to support mmc, but it would certainly be safer to use on a 5v microcontroller so if you don't need the extra speed and want the extra safety, that's true. Although you'd also have to pay shipping and wait for your module to come in, so there are a lot of down sides to that considering you got an adapter for free with the microsd card in the first place.
      Thanks for checking out the video and commenting, though!