Interfacing with an SD Card

Поделиться
HTML-код
  • Опубликовано: 13 июл 2024
  • In this video, I take a look at how we can interface an SD card with a microcontroller using the SPI bus.
    I start by looking at the SD card pin assignments noting there are differences between a standard SD card and a micro CD card. Then by cross-referencing with an Adafruit design and carefully checking what components are required, I produce my own schematic in EasyEDA.
    I use the 74HC4050N voltage level shifter to convert 5V logic levels down to 3.3V.
    Finally I design a PCB layout and take a look at a 3D render.
  • НаукаНаука

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

  • @borg3000
    @borg3000 Год назад +2

    Great job! I really enjoyed watching you creat this board.

  • @vanhetgoor
    @vanhetgoor Год назад +4

    It surely is a nice PCB. I gave you a big thumbs-up! But if others have made almost the same board, then why not use the card that others made already, it would reduce the costs of the project I guess. I could imagine that a totally new design is necessary when extra features would be included, like a signal for card-ready, card-present, card-write protected or card-malfunction.
    Possibly there could also be a signal for card-full. And yes, I know that for a card-full signal there has to be intelligence to read the card first and analyse the data. And while fantasizing about what could have been done, a signal for "do not eject the card, still writing data" would be fine. Maybe that was the LED you removed for.

  • @ChrisSavageEngineer
    @ChrisSavageEngineer Год назад +1

    I believe the LED on the clock line is an SD access or activity indicator.

  • @PE4Doers
    @PE4Doers Год назад +1

    Nice project 🙂

  • @melkiorwiseman5234
    @melkiorwiseman5234 Год назад +1

    If I were going to try to interface a Z80 system with an SD card, I'd be inclined to go in one of two possible directions, although both directions would use a microcontroller as an intermediary. The reason for that is to free up the Z80 so that it can do other things if needed without having to devote all of its "attention" to the data transfer.
    1. DMA. I'd use at least two memory banks as buffers. The memory would hold the data either before it's written or after it's been read from the SD card. Having two banks would allow the CPU to work on data in one bank while the data in the second bank is being either written or read. Advantage: Speed. Disadvantage: Can't be moved easily to another computer system.
    2. GPIB (IEEE-488). I'd have the microcontroller use its own internal memory as the buffer and have the Z80 transmit and receive both data and commands through the GPIB interface. Advantage: The SD card and microcontroller can be easily moved to another computer system using a GPIB. Disadvantage: Slower than DMA.

    • @knghtbrd
      @knghtbrd 10 месяцев назад

      If I were to do that, I'd do it how Commodore/Atari did-a device interface with storage protocol that doesn't care about the details. I'd probably interface a "floppy drive" for the educational reasons, then switch to SD card for convenience and wider accessibility. Still cheating? Maybe, but I've got a good justification.
      You used to be able to get the VIC-20 video chip for about $6.50, but someone came out with a VIC-20 kit and now they're > $100. Turns out the low price wasn't wide availability but the fact that they don't fail often so few were needed. Now if you need one for repair … good luck! This has happened before and will again. Is the TMS9918A next? Maybe.
      I've got a couple of them, though, so using one is the path of least resistance. Once I do, though I'm likely to start programming a RP2040 to take its place. The F18A exists and is VGA, but it's expensive. The RP2040 is dirt cheap, though, and fast enough to simulate the 9918. With VGA or maybe even DVI output, we'll see.
      IBM used a µC for the keyboard before Windows was a thing. Fair to do? Sure. Fair to use something newer than they did? Maybe. Don't need to in order to bit-bang PS/2, but if I use something newer…
      Seems everyone wants to use NES/SNES controllers on their new retro machines. That was done reading bits off a shift register every frame. Can I do that? Sure. Don't really want to though. I'd probably do it, then implement some 74-series chips to read and latch the button state so I don't have to.
      I'll then replace that hardware with the same µC that is doing keyboard input without changing the code on the retro CPU at all. That code still won't change when I rewrite the code on the µC to use a USB interface. Because keyboards are now less than 50/50 for having PS/2 support, and while I can get a quality USB SNES-like controller for $15, Nintendo isn't making the original anymore and the clones suck.
      As far as I'm concerned, bit-banging PS/2 keyboards reading a SNES controller with a shift register, and talking to a "floppy drive" (Gotek) are extra enrichment activities.

  • @nadaehab263
    @nadaehab263 2 месяца назад

    thanks for this video it really helps, but should I use the level shifter if the microcontroller is STM32F103C6 since it's operating voltage ranging between 2.2 and 3.6 v and I have another question, it's written in the datasheet of the sd card connector that the operating voltage is 10v while it's vcc connected to 3.3v I didn't get that part hope you answer me and thank
    s for all

    • @SteveRaynerMakes
      @SteveRaynerMakes  2 месяца назад

      I would say that if your microcontroller operates at voltage of 2.2 to 3.6 then, no, you do not need the level shifter. This will simplify things for your design. The 10v is just a maximum rating for the physical connector. Not something you need to be concerned about because I doubt you would find an SD card that operates at higher voltages. But in theory anyone could design their own cards that operate at any voltage. So it's just the connector designer telling us don't use anything over 10volts.

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

    Can you play a short video with a SD card on a raspberry pi Pico but also have the audio playing? I want to create a drive-in theater for my train layout.

  • @vvtor
    @vvtor 6 месяцев назад +1

    Have you thought about making follow up video of setting all that up together?

    • @SteveRaynerMakes
      @SteveRaynerMakes  6 месяцев назад +1

      I would very much like to. Unfortunately I was unable to get it to work. However I'm unsure if it's a software problem or a hardware problem.

    • @travonray637
      @travonray637 4 месяца назад +1

      @@SteveRaynerMakes Do you plan on remaking it? or any update on it now

  • @brentroberson7211
    @brentroberson7211 Год назад +2

    Is the level shifter required for an esp32 since it is all 3.3 v logic anyways?

    • @SteveRaynerMakes
      @SteveRaynerMakes  Год назад

      I would say no.

    • @brentroberson7211
      @brentroberson7211 Год назад

      @@SteveRaynerMakes awesome thank you for the reply! do I need to add any resistors or can I just connect everything straight to the pins of the esp32?

    • @SteveRaynerMakes
      @SteveRaynerMakes  Год назад +1

      @@brentroberson7211 Should be fine to connect directly to the ESP32. I have a pull-up resistor on the CS line, but you probably don't even need that. As I believe the ESP32 can be configured to use its own internal pull-up resistors.