STM32 USB SD Card Mass Storage Device Tutorial - Phil's Lab

แชร์
ฝัง
  • เผยแพร่เมื่อ 12 ม.ค. 2025

ความคิดเห็น • 89

  • @mkenya_engineer
    @mkenya_engineer หลายเดือนก่อน +27

    God bless you Phil. You have done it again. Consider doing one for BLDC FOC motor control.

    • @PhilsLab
      @PhilsLab  หลายเดือนก่อน +2

      Thank you!

    • @rbtx99
      @rbtx99 หลายเดือนก่อน

      There is a ready project for development board B-G431B-ESC1

  • @THEELECTRICGUY
    @THEELECTRICGUY หลายเดือนก่อน +14

    I usually use a mux IC TS3A27518 with a card reader IC to read files directly when connected to PC. And when I need to interface STM32 with the SDCard again, I switch the SDIO pins using the mux. This way I was able to achieve around 20Mbps of speed while transferring files to my PC.

    • @mumbaiverve2307
      @mumbaiverve2307 หลายเดือนก่อน +2

      That's a great idea ! Can you mention which card reader IC you use ? TIA.

    • @THEELECTRICGUY
      @THEELECTRICGUY หลายเดือนก่อน

      @@mumbaiverve2307 gl823k-hcy04

    • @THEELECTRICGUY
      @THEELECTRICGUY หลายเดือนก่อน +1

      @@mumbaiverve2307 Thanks! Its gl823k-hcy04

  • @markhofmeister702
    @markhofmeister702 หลายเดือนก่อน

    I wish I had this video when I did my SD card projects! Thank you as always.

  • @12012004
    @12012004 หลายเดือนก่อน +1

    As always an amazing and inspiring video. Thank you very much Phil!

    • @PhilsLab
      @PhilsLab  หลายเดือนก่อน

      Thank you!

  • @jp-ny2pd
    @jp-ny2pd หลายเดือนก่อน +2

    I've gotten similar USB FS rates on the STM32H573 microcontroller as well. 300-700K/sec seems to be normal regardless of backend storage type. So it's just the USB FS limits. My understanding is it's a DMA controller limitation so you have to choose either Ethernet or USB HS on the silicon. STM32 does have USB HS chips, but you'll find they either don't have ethernet or you can only enable one or the other. USB HS and Ethernet are pretty much mutually exclusive on STM32 currently. It's not until you get into their MPU line you start to have options for both. I would love to have both Fast Ethernet and USB HS in STM32.

    • @vatterger
      @vatterger หลายเดือนก่อน +1

      He's using blocking SD and USB operations. Add some queues in between and you could do the USB-read and SD-write in parallel, instead of having them wait for each other to finish all the time.

    • @jp-ny2pd
      @jp-ny2pd หลายเดือนก่อน

      @@vatterger even if you double the throughput your still very slow. Plenty of data if you just need a serial console or log files or other relatively small bits of data. I'd hate to try and transfer gigs through it.

  • @gani2528
    @gani2528 หลายเดือนก่อน

    Hey Phil, amazing tutorial as always. I'd love to see you design an ESC board next.

    • @oliverer3
      @oliverer3 หลายเดือนก่อน

      It's not an indepth guide but he does have a video on ESC design if memory serves.

  • @hollyizza3672
    @hollyizza3672 หลายเดือนก่อน

    Hey Phil, great video. I was just wondering how did you plan for a project . For example your thought process, requirements for the project and proof of concept. I believe that there are many things that you have to go through before having the final product. Would love to have a dedicated video for that. Aspiring PCB design engineer would really benefit from it.

  • @Stabby666
    @Stabby666 หลายเดือนก่อน +1

    I had an idea a while back to make a custom storage device with a WiFi-enabled MCU inside to use with the cheap digital photo frames. It would serve images from an SDCard via USB to the frame, but every X image requests it would substitute information by generating images from live data like weather, stock prices, news, social media alerts etc :)

  • @Mintonperformance
    @Mintonperformance หลายเดือนก่อน +1

    I'm soo excited about this one!

    • @PhilsLab
      @PhilsLab  หลายเดือนก่อน

      Thanks, hope it doesn't disappoint!

  • @TheTimeRay
    @TheTimeRay หลายเดือนก่อน

    24:36 this might be related, that you are not running in Debug mode... Debug mode with breakpoints slows down everything significantly...

  • @andrew2004sydney
    @andrew2004sydney หลายเดือนก่อน

    Thank you. This was very educational. Love your videos.

    • @PhilsLab
      @PhilsLab  หลายเดือนก่อน

      Thanks, Andrew!

  • @neudyvielma
    @neudyvielma หลายเดือนก่อน

    Detailed and very clear explanation. How would things change if DMA and FreeRTOS were implemented?

  • @JonathanKayne
    @JonathanKayne หลายเดือนก่อน

    Something that would be interesting to show off is using the SD card to update the firmware of the stm32.
    I have seen some stm32 based hardware that allows someone to encrypt the bootloader and firmware file such that the firmware can be freely shared without it being used on counterfeit hardware (aka boards that aren't sold by the developer)
    Not sure how you pull that off on the stm32 though!

  • @casualnoises2808
    @casualnoises2808 หลายเดือนก่อน

    Thx Phil for sharing this very useful video.

    • @PhilsLab
      @PhilsLab  หลายเดือนก่อน

      Thanks for watching!

  • @universum2022
    @universum2022 หลายเดือนก่อน

    Amazing video. The timing of this video is impeccable since I decided to use SDMMC yesterday...
    I sadly forgot to pose a question when I met you at electronica. How do you estimate how much performance you require for your projects and wether you need additional, external ram/flash chips? I was not able to find a video about this topic, but please correct me if I missed something.

    • @PhilsLab
      @PhilsLab  หลายเดือนก่อน +1

      Thank you! Regarding your question: it's based on previous experience and also creating 'dummy/template' software projects to get estimates for RAM/flash usage.

  • @Sliceoflie
    @Sliceoflie หลายเดือนก่อน

    I've just been working on a project with this! I tested a dev board with an H750VBT6 (DevEBox thing), and 4 bit SD/MMC works fine at many MHz even without the weak stm pull ups enabled. I made a custom board using the F411VCT6 and for some reason I cannot under any circumstances get 4 bit SDIO working. The slot is a few cm more from the stm than on the dev board, so I tried slowing the clock down incrementally all the way to under 200k, enabled the pullups, still nothing. I've checked pins several dozen times and they are correct. Setting 1 bit mode works fine though. Tried starting over with blank CubeIDE projects for each chip, only doing that bare essentials of HSE clock and SD pin setup, same result. I'm starting to just give up on 4 bit, only difference I see left is the H7 calls it SD/MMC but F4 calls it SDIO, I'm not sure if it matters or if theres a bug in the CubeIDE initialization but its immensely frustrating.

    • @benhurst980
      @benhurst980 หลายเดือนก่อน +1

      When initializing SDIO or SDMMC I had to use 1 bit mode before Mounting then switch to 4 bit mode after Mounting.
      hsd1.Init.BusWide = SDMMC_BUS_WIDE_1B;
      HAL_Delay(1);
      RES = f_mount(&fs, "0:", 1);
      HAL_Delay(1);
      hsd1.Init.BusWide = SDMMC_BUS_WIDE_4B;
      HAL_Delay(1);

  • @qbitsday3438
    @qbitsday3438 หลายเดือนก่อน

    visiting the Genius Again !

  • @OmarZC06
    @OmarZC06 หลายเดือนก่อน

    Thanks for sharing your knowledge! I would like to know why is your favorite to use STM MCU (brand) for your devices/videos?

  • @marcopiovesan9153
    @marcopiovesan9153 หลายเดือนก่อน

    Hi Phil, a few years ago I made the same scheme as you but it didn't work well with all SD cards. So I had to put resistors in series on DAT0..DAT3 if I remember correctly 120 ohm.

    • @PhilsLab
      @PhilsLab  หลายเดือนก่อน

      Did you adjust drive strengths at all?

    • @marcopiovesan9153
      @marcopiovesan9153 หลายเดือนก่อน

      @@PhilsLabI did not make measures; I checked the schematic, 150 on all lines DAT0..3 CK, CMD. At the beginning I started without resistor like your scheme then testing with a dozen of card I had troubles; finally I saw these resistors on an old schematic and copied the solution discovering was effective.

  • @Kilohercas
    @Kilohercas หลายเดือนก่อน +1

    Can you make another video using 480Mbps connection ? You already have ULPI example, so this would give you 480Mbps.
    Also certain STM32F7x3 and STM32U5 has internal HS PHY so no external connections are needed. IT would be nice if you could show example how to do CDC class at ~40MBps to computer read and write.
    Thanks !

    • @PhilsLab
      @PhilsLab  หลายเดือนก่อน +2

      Yeah, I'm working on a board with JLC that has USB HS (STM32F7x3 part). Will test it out with that.

  • @EmbeddedEnigma
    @EmbeddedEnigma หลายเดือนก่อน +2

    I used it in one of the projects I did, with simple functionality st's usb library works fine but if you slightly try to do something else the library breaks quickly and needs alot of knowledge and modification to work it then.

    • @PhilsLab
      @PhilsLab  หลายเดือนก่อน +4

      Yeah, the audio USB driver one is quite fun as well..

    • @muaath_rifath
      @muaath_rifath หลายเดือนก่อน +1

      Where can I learn the basics?

  • @ruben_balea
    @ruben_balea หลายเดือนก่อน

    Opening a compressed PDF directly from WinRAR and looking for bad pages can be a way to visually prove that the file is actually intact but if you can open a file from WinRAR you already know it's good, by default WinRAR will stop decompressing if it finds any error and will delete any partially decompressed file before any other program can open it and then shows you a window explaining what was wrong. 7zip and WinZip do more or less the same.
    On the other hand some basic decompression programs used by some custom made installers can leave you with empty or partial files with no warning at all...

    • @PhilsLab
      @PhilsLab  หลายเดือนก่อน

      Good to know, thanks!

  • @marcocipriani01
    @marcocipriani01 หลายเดือนก่อน +1

    Is it possible to have USB Mass Storage and CDC at the same time? Also, why did you go with 3V instead of 3.3V?

    • @PhilsLab
      @PhilsLab  หลายเดือนก่อน +1

      Yes, those are 'composite' devices. 3V as I'll mainly be running the device from a battery and wanted to have a lower 'off-threshold'.

    • @marcocipriani01
      @marcocipriani01 หลายเดือนก่อน +1

      ​@@PhilsLab I've searched a bit and ST seems to recommend USBX from the ThreadX project for composite devices, instead of using their own libraries that CubeMX generates. ThreadX seems cool, maybe it's worth a shot. ST's USB libraries aren't always great.

  • @karistonf
    @karistonf หลายเดือนก่อน

    What is the threshold where it starts to make sense for the embedded system to run Linux?

  • @ElvianEmpire
    @ElvianEmpire หลายเดือนก่อน +1

    do you have a link to the pcb stand you use in the intro?

    • @PhilsLab
      @PhilsLab  หลายเดือนก่อน

      Those are PCBites from Sensepeek.

  • @ab7644
    @ab7644 หลายเดือนก่อน

    Great tutorial 🙂. I would like to know, if I want to design a USB device for sale, for example a storage class device or a uart converter, do I really need to buy a VID? Or can I use some generic VID PID?

    • @PhilsLab
      @PhilsLab  หลายเดือนก่อน +1

      Thanks! You can either purchase them through the USB org, or you often can get them through your MCU/processor/peripheral manufacturer (using their VID, but different PID) (e.g. community.st.com/t5/stm32-mcus-embedded-software/how-to-apply-for-a-usb-pid/td-p/53773). Lastly, there's also an option (if your project is open-source) to get them for free through: pid.codes/

    • @ab7644
      @ab7644 หลายเดือนก่อน

      ​@@PhilsLab Thanks. I've been watching your content for a while and it's always good quality. I can learn something new every time. 🙂

  • @prakashchandraaman7885
    @prakashchandraaman7885 หลายเดือนก่อน

    Fascinating and awesome video like always ... Lovefrom india

    • @PhilsLab
      @PhilsLab  หลายเดือนก่อน

      Thank you!

  • @radman999
    @radman999 หลายเดือนก่อน

    FatFS Supports up to 2 TB. You may have to available exFat in the header file

  • @dwagner6
    @dwagner6 หลายเดือนก่อน

    What font did you use on the schematic for labeling the sections (ie, SD Card, etc)

    • @PhilsLab
      @PhilsLab  หลายเดือนก่อน

      Century Gothic

  • @rwantare1
    @rwantare1 หลายเดือนก่อน

    I wonder how much of a leap it is to go from this, to using NAND with USB4 speeds.
    Thanks for the video.

    • @PhilsLab
      @PhilsLab  หลายเดือนก่อน +1

      Quite a bit of a leap with USB4!

  • @biswajit681
    @biswajit681 หลายเดือนก่อน

    Hi @phill ,Any black friday sale on courses or in new year ?

    • @PhilsLab
      @PhilsLab  หลายเดือนก่อน

      Send me a mail to phil@phils-lab.net and we can sort it out! :)

  • @perceptron9834
    @perceptron9834 หลายเดือนก่อน

    which tool do you use to draw block diagrams ?

    • @PhilsLab
      @PhilsLab  หลายเดือนก่อน

      draw.io

  • @pvc988
    @pvc988 หลายเดือนก่อน

    I really like clock configuration panel of this that IDE

  • @KofiAsare0
    @KofiAsare0 หลายเดือนก่อน

    Awesome work, this looks like a great way to implement storage devices in high vibe environments!

    • @PhilsLab
      @PhilsLab  หลายเดือนก่อน

      Thank you, Kofi!

  • @MohamedAfzal
    @MohamedAfzal หลายเดือนก่อน

    which feature makes the lines with different colours of highlights?

    • @PhilsLab
      @PhilsLab  หลายเดือนก่อน +1

      Altium, click on net, Properties, select a colour.

    • @MohamedAfzal
      @MohamedAfzal หลายเดือนก่อน

      @PhilsLab thanks 🙏

  • @saleh6820
    @saleh6820 หลายเดือนก่อน

    Nice Sir.From BD.

    • @PhilsLab
      @PhilsLab  หลายเดือนก่อน

      Thank you!

  • @pcbden
    @pcbden หลายเดือนก่อน

    I could not make this thing work on my stm32L4 device So used spi from scratch. It was painfull

  • @pasiunepepaine
    @pasiunepepaine หลายเดือนก่อน

    Cool! 💎

  • @tamojitsaha2830
    @tamojitsaha2830 หลายเดือนก่อน

    Hi Phil,
    Can you please do a series on any crypto IC like ATECC608 with STM32?
    Haven't found any tutorial with both practical and theoretical approach.
    Thanks in advance.

  • @kensamuel2.0
    @kensamuel2.0 หลายเดือนก่อน

    Can't help but comment Nice Video 😌🔥

    • @PhilsLab
      @PhilsLab  หลายเดือนก่อน

      Thanks a lot!

  • @tonygiguere2495
    @tonygiguere2495 หลายเดือนก่อน

    Nice!

    • @PhilsLab
      @PhilsLab  หลายเดือนก่อน

      Thanks, Tony!

  • @irmafezeu4239
    @irmafezeu4239 หลายเดือนก่อน

    Great!

    • @PhilsLab
      @PhilsLab  หลายเดือนก่อน

      Thanks, Irma :)

  • @تطويراللغة
    @تطويراللغة หลายเดือนก่อน

    good ❤

  • @9782ravi
    @9782ravi หลายเดือนก่อน

    Please upload bumble b micro quad copter files to github

  • @rusualexei716
    @rusualexei716 หลายเดือนก่อน

    First