ESP32 SD Card Speedup With a Couple of Lines of Code

Поделиться
HTML-код
  • Опубликовано: 9 окт 2023
  • The ESP32-S3 can act as a USB Mass Storage Class device (USBMSC) - but how well does it work? Once again we're using my custom PCB from www.PCBWay.com/?from=atomic
    It starts off pretty slow, but there's quite a few optimisations that we can make to get it quite a bit faster!
    I'm using the USBMSC class to mount the SD Card connected to the ESP32 to my PC. It does work - but it's a bit slow - but we can make it faster!
    The GitHub repo with my tests is here: github.com/atomic14/esp32-sdc...
    ---
    If you'd like to help support the channel and help me buy more nonsense - I have a Patreon page: / atomic14
    We've also got a shop now! shop.atomic14.com
    And if you're shopping on AliExpress or Amazon then if you click on these links I will get a little bit of affiliate money:
    Aliexpress - s.click.aliexpress.com/e/_Ac05mF
    Amazon - www.amazon.com/?tag=atomic14-20
    You can also join us on Discord here: / discord
    There's also the Atomic14 newsletter here: atomic14.substack.com/
    And don't forget about the MakerNews newsletter - makernews.substack.com/
  • НаукаНаука

Комментарии • 50

  • @atomic14
    @atomic14  8 месяцев назад

    If you'd like to help support the channel and help me buy more nonsense - I have a Patreon page: www.patreon.com/atomic14
    We've also got a shop now! shop.atomic14.com
    And if you're shopping on AliExpress or Amazon then if you click on these links I will get a little bit of affiliate money:
    Aliexpress - s.click.aliexpress.com/e/_Ac05mF
    Amazon - www.amazon.com/?tag=atomic14-20
    You can also join us on Discord here: discord.gg/h2DDnDdjD2
    There's also the Atomic14 newsletter here: atomic14.substack.com/
    And don't forget about the MakerNews newsletter - makernews.substack.com/

  • @raymondmichael4987
    @raymondmichael4987 8 месяцев назад +4

    😮 This was the hard one;
    That’s me “😊😊😊” when I hear “we built a new pcb”
    Thanks buddy

  • @neilomalley9887
    @neilomalley9887 8 месяцев назад +2

    Alot of this is over my head but I think I’m gaining an appreciation for possibilities and limitations of these MCs

  • @piconano
    @piconano 8 месяцев назад +6

    I see you found the rabbit-hole!

    • @atomic14
      @atomic14  8 месяцев назад +1

      Yep, down we go...

  • @Dinkleberg96
    @Dinkleberg96 8 месяцев назад

    I'm loving the project! The improvements made with a few changes on the code are tremendous, and that could also work but by adding a USB controller and a SD card slot the writting to the PCB the speeds will increase by significant ammounts. I'm really keen to see how this project goes

    • @atomic14
      @atomic14  8 месяцев назад +2

      I’ve got the new schematic. Working on the PCB layout. It’s a lot simpler than the idea i Gad in the video as I’ve got an IC (thanks to a viewer comment!) that will put everything in Hugh impedance when’s it’s held in reset. But there’s now a lot more to layout and I’m trying to avoid going to a four layer board as the cost jumps up a lot..

  • @Sogager
    @Sogager 7 месяцев назад

    Thanks for the helpful tips! Really appreciate the clear instructions, you made it so simple!

    • @atomic14
      @atomic14  7 месяцев назад

      Glad it was helpful!

  • @devcybiko
    @devcybiko 8 месяцев назад +1

    I'm still following with interest. The serial I/O bottlenecks are news to me, so this episode is really paying off. I follow with rapt attention. Continued Success!

  • @nikthefix8918
    @nikthefix8918 8 месяцев назад +2

    Using USBMSC on ESP32-S3 I've had good results writing and reading to/from Winbond flash chips instead of SD notwithstanding the USB1.1 limitations. I like the idea of a dedicated chip instead of a removable medium. I've also tried FRAM which is very fast - almost as fast as SRAM - but capacities at the time of writing are small. IDF and Adafruit libs are available to support serial Flash / Fram. Wear leveling for Flash is even supported.

    • @atomic14
      @atomic14  8 месяцев назад

      That's interesting, what kind of capacity do you get with the flash chips?

    • @nikthefix8918
      @nikthefix8918 8 месяцев назад

      @@atomic14 128Mbit so 16MB. There are larger capacities but I believe the addressing scheme changes above 128. The chips are NOR rather than NAND flash so there are further advantages there. Look up Winbond W25Q128JV.

    • @nikthefix8918
      @nikthefix8918 8 месяцев назад

      @@atomic14 There's also this chip: Adafruit SPI Flash SD Card - XTSD 512 MB
      I bought one but there were no real advantages over an SD card and the OEM silicon was still pretty expensive.

    • @nikthefix8918
      @nikthefix8918 8 месяцев назад

      @@atomic14 FRAM is definitely the way to go for fast lower capscity MCU storage. You don't read much about it but I think it has potential. Great endurance too so you don't have to worry about wear or implementing wear levelling. You just treat it as non-volatile SRAM. Reliably clocked at 80MHz SPI in my experiments.

    • @JS7457
      @JS7457 8 месяцев назад

      What library did you use to simulate an USB Mass storage with a Winbond flash chip?

  • @veheikko
    @veheikko 6 месяцев назад

    Thanks, this was very helpful

    • @atomic14
      @atomic14  6 месяцев назад

      Glad it helped!

  • @PsychogenicTechnologies
    @PsychogenicTechnologies 8 месяцев назад

    Whelp, that GL823K datasheet ain't great... but the status LED and GPIO might be ways to give you status and a way to do the switching after it's done. If you're doing a PCB to play with these things, I'd add in a couple of DNP resistor/jumpers to experiment with these, in addition to just keeping an eye on vbus. Curious to see how it works out with this IC.

  • @donatasismanus6056
    @donatasismanus6056 8 месяцев назад +1

    werry interesting, was also looking for solution how to switch sd card from any device to usb, and of course best to usb3 :) thanks for sharing !!

    • @atomic14
      @atomic14  8 месяцев назад +1

      Fingers crossed it actually works...

  • @AzaB2C
    @AzaB2C 8 месяцев назад +1

    Neat!

  • @sjetmand
    @sjetmand 8 месяцев назад

    Excellent!

    • @atomic14
      @atomic14  8 месяцев назад

      Thanks for your support!

  • @user-op3fd2ie2y
    @user-op3fd2ie2y 8 месяцев назад +1

    If ESP32 monitors the Presence of USB (5V + signal lines) then ESP32 can switch properly switch between computer reading/writing SD Card and ESP32 reading/writing SD card. It means finishing the ESP32 SC Card read/write cycle and enabling USB access to the SD Card. If ESP32 is not switched ON (by battery) then Logic is powered by USB 5V and access to SC Card via USB is enabled. If ESP32 is charged via charger (no USB signals are present) then Charging and reading/writing SC Card via ESP32 is enabled.

    • @user-op3fd2ie2y
      @user-op3fd2ie2y 8 месяцев назад

      As well, USB switch IC is not needed. :-)

  • @argentinomacrifuevidaltamb3772
    @argentinomacrifuevidaltamb3772 8 месяцев назад +1

    Excelente, magnifico trabajo.

  • @ArtiZirk
    @ArtiZirk 8 месяцев назад +3

    Maybe instead of a USB mux, just use a hub ic and automatically mux the SD card to the GL823 card reader when you sense that USB is connected.

    • @atomic14
      @atomic14  8 месяцев назад

      Interesting idea - I'll take a look at options.

    • @nikthefix8918
      @nikthefix8918 8 месяцев назад

      I think the upload speed via USB1.1 is acceptable but the SPI read speed of SD is not. A background copy of SD data to PSRAM might help in some circumstances - like a picture frame or gif player. At least then your display will populate quickly on demand 'cos the data are buffered in a much faster storage.

  • @davidealessandrini2235
    @davidealessandrini2235 Месяц назад

    Thank you for the very informative video. I have a problem with a software I'm developing: I read an Audio file from SD and play it via i2s. The reading is 3072 bytes at a time. It happens every now and then that the reading takes 500/600 ms instead of the 15ms it normally does. This behavior is not periodic but random. This ruins the audio streaming. Have you ever encountered this problem? I use esp32s3

  • @monahanz
    @monahanz 27 дней назад

    I'm looking for code to read/write individual sectors on an SD card.
    Can somebody point me to a download/code. They seem to be mentioned here but no reference

  • @marcoconfortidonati
    @marcoconfortidonati 3 месяца назад

    Gatchaman!!!!

  • @thomasbjrnsonlarsen7326
    @thomasbjrnsonlarsen7326 8 месяцев назад

    How about using RTOS to run two threads, one reading data from the USB and buffering, and another to write from the buffer to the SD-card?

    • @atomic14
      @atomic14  8 месяцев назад +1

      That’s what we end up doing really, the writes are pushed onto a queue and then written by a background task. While that’s happening more data is read from the USB.

  • @jespernoer5521
    @jespernoer5521 8 месяцев назад

    Using the GL823 is an excellent solution. I have used a similar setup in the past with GL835. GL835 has a power-saving mode so you don't need the second switch (PI3A27518), just put the ESP32 pins into Hi-Z mode when connecting USB. GL835 can go into sleep/standby mode when USB is not connected. I'm not sure this will work with GL823 though.

    • @atomic14
      @atomic14  8 месяцев назад

      Interesting! Getting rid of that switch would be ideal. When it's in power saving mode can it still be connected to the USB data lines? Ideally I'd like to be able to use the USB for programming and debugging when not in mass storage mode.

    • @atomic14
      @atomic14  8 месяцев назад

      The GL835 seems to be very hard to find - I guess USB2.0 is old tech nowadays.

    • @jespernoer5521
      @jespernoer5521 8 месяцев назад

      @@atomic14When the USB switch sends data to the ESP32, the lines are disconnected from the GL823 and you can use it for debug. I just don't know if GL823 will release the data lines to the SD card when the USB lines are disconnected.

    • @atomic14
      @atomic14  8 месяцев назад

      Gotcha - if it can be used like that it would be ideal. Or even if holding it reset will keep the GL823 pins in high z.

    • @atomic14
      @atomic14  8 месяцев назад

      @@jespernoer5521Looks like the USB224X will do what I need - it will definitely go into tristate when in reset mode. I think I might even be able to do away with the USB switch as when it's in reset mode the data pins are high Z as well.

  • @TheTurmanDreams
    @TheTurmanDreams 8 месяцев назад

    Great !!!

    • @atomic14
      @atomic14  8 месяцев назад +1

      Thanks - glad you liked it.

    • @TheTurmanDreams
      @TheTurmanDreams 8 месяцев назад

      @@atomic14 thanks to you !!!

  • @OLDNEWTECH
    @OLDNEWTECH 4 месяца назад

    how can i upload a code in esp32 dev board using Arduino IDE.... NEED HELP

  • @mortenmoulder
    @mortenmoulder 8 месяцев назад +1

    This for storage + the Linux "hack" on the ESP32-S3.. hmmmmmm

  • @raymondmichael4987
    @raymondmichael4987 8 месяцев назад

    😮 This was the hard one;
    That’s me “😊😊😊” when I hear “we built a new pcb”
    Thanks buddy

    • @atomic14
      @atomic14  8 месяцев назад

      No problem 👍