sdioio – Interface to an SD card via the SDIO bus

Available on these boards
  • Adafruit Camera
  • Adafruit Feather ESP32 V2
  • Adafruit Feather ESP32-S3 Reverse TFT
  • Adafruit Feather ESP32-S3 TFT
  • Adafruit Feather ESP32S3 4MB Flash 2MB PSRAM
  • Adafruit Feather ESP32S3 No PSRAM
  • Adafruit Feather HUZZAH32
  • Adafruit Feather STM32F405 Express
  • Adafruit Grand Central M4 Express
  • Adafruit HUZZAH32 Breakout
  • Adafruit ItsyBitsy ESP32
  • Adafruit MatrixPortal S3
  • Adafruit Metro ESP32S3
  • Adafruit Mini Sparkle Motion
  • Adafruit P4 GPIO
  • Adafruit QT Py ESP32 PICO
  • Adafruit QT Py ESP32-S3 4MB Flash 2MB PSRAM
  • Adafruit QT Py ESP32-S3 no psram
  • Adafruit Sparkle Motion
  • Adafruit Sparkle Motion Stick
  • Adafruit-Qualia-S3-RGB666
  • Ai Thinker ESP32-CAM
  • Arduino Nano ESP32
  • AutosportLabs-ESP32-CAN-X2
  • BARDUINO 4.0.2
  • BLING!
  • BPI-Leaf-S3
  • BPI-PicoW-S3
  • Bee-Data-Logger
  • Bee-Motion-S3
  • Bee-S3
  • BlizzardS3
  • CRCibernetica IdeaBoard
  • CircuitART Zero S3
  • ColumbiaDSL-Sensor-Board-V1
  • CrowPanel 4.2 EPaper
  • Cytron Maker Feather AIoT S3
  • DAISY_SEED
  • DFRobot FireBeetle 2 ESP32-S3
  • Deneyap Kart
  • Deneyap Kart 1A
  • Deneyap Kart 1A v2
  • Diodes Delight Piunora
  • EDGES3D
  • ES3ink
  • ESP32 Devkit V1
  • ESP32-P4 Stamp XL
  • ESP32-P4-Function-EV
  • ESP32-S3-Box-2.5
  • ESP32-S3-Box-Lite
  • ESP32-S3-DevKitC-1-N16
  • ESP32-S3-DevKitC-1-N32R8
  • ESP32-S3-DevKitC-1-N8
  • ESP32-S3-DevKitC-1-N8R2
  • ESP32-S3-DevKitC-1-N8R2 (ROS version)
  • ESP32-S3-DevKitC-1-N8R8
  • ESP32-S3-DevKitC-1-N8R8-with-HACKTABLET
  • ESP32-S3-DevKitM-1-N8
  • ESP32-S3-EYE
  • ESP32-S3-USB-OTG-N8
  • Elecrow CrowPanel
  • Espressif ESP32 DevKitc V4 WROOM-32E
  • Espressif ESP32 DevKitc V4 WROVER
  • Espressif ESP32 TTGO T8 v1.7
  • Espressif ESP32-EYE
  • Espressif ESP32-LyraT
  • Espressif-ESP32-S3-LCD-EV-Board
  • Espressif-ESP32-S3-LCD-EV-Board_v1.5
  • FeatherS3
  • FeatherS3 Neo
  • Freenove ESP32-WROVER-DEV-CAM
  • Hardkernel Odroid Go
  • Heltec ESP32-S3-WIFI-LoRa-V3
  • Heltec Vison Master E290
  • Heltec Wireless Paper
  • LILYGO T-DISPLAY S3 v1.2
  • LILYGO T-Deck (Plus)
  • LILYGO T-Display S3 Pro
  • LILYGO T-Dongle S3
  • LILYGO T-QT PRO NO PSRAM
  • LILYGO T-QT PRO PSRAM
  • LILYGO T-Watch-S3
  • LILYGO TEMBED ESP32S3
  • LILYGO TTGO T-DISPLAY v1.1
  • LILYGO TTGO T-DISPLAY v1.1 4M
  • LOLIN S3 16MB Flash 8MB PSRAM
  • LOLIN S3 MINI 4MB Flash 2MB PSRAM
  • LOLIN S3 MINI PRO 4MB Flash 2MB PSRAM
  • LOLIN S3 PRO 16MB Flash 8MB PSRAM
  • Lilygo T-watch 2020 V3
  • M5Stack Atom Echo
  • M5Stack Atom Lite
  • M5Stack Atom Matrix
  • M5Stack Atom U
  • M5Stack AtomS3
  • M5Stack AtomS3 Lite
  • M5Stack AtomS3U
  • M5Stack Cardputer
  • M5Stack Cardputer (ROS version)
  • M5Stack Core Basic
  • M5Stack Core Fire
  • M5Stack Core2
  • M5Stack CoreS3
  • M5Stack CoreS3 SE
  • M5Stack Dial
  • M5Stack DinMeter
  • M5Stack M5Paper
  • M5Stack Stamp-S3
  • M5Stack Stick C
  • M5Stack Stick C Plus
  • M5Stack Stick C Plus2
  • M5Stack Tab5
  • M5Stack Timer Camera X
  • MagiClick S3 N4R2
  • MakerFabs-ESP32-S3-Parallel-TFT-With-Touch-7inch
  • NanoS3
  • Neuron
  • OMGS3
  • Oxocard Artwork
  • Oxocard Connect
  • Oxocard Galaxy
  • Oxocard Science
  • ProS3
  • Prokyber Ai-On-The-Edge-Cam
  • PyboardV1_1
  • RGBTouch Mini
  • Raspberry Pi 4B
  • Raspberry Pi Compute Module 4
  • Raspberry Pi Compute Module 4 IO Board
  • Raspberry Pi Zero
  • Raspberry Pi Zero 2W
  • Raspberry Pi Zero W
  • SAM E54 Xplained Pro
  • SPRESENSE
  • SQFMI Watchy
  • STM32F4_DISCO
  • Seeed Xiao ESP32-S3 Sense
  • SparkFun STM32 MicroMod Processor
  • SparkFun Thing Plus - STM32
  • Sunton-ESP32-8048S050
  • Sunton-ESP32-8048S070
  • ThingPulse Pendrive S3
  • TinyPICO
  • TinyPICO Nano
  • TinyS3
  • TinyWATCH S3
  • VCC-GND YD-ESP32-S3 (N16R8)
  • VCC-GND YD-ESP32-S3 (N8R8)
  • VIDI X V1.1
  • Waveshare ESP32-S3 LCD 1.47
  • Waveshare ESP32-S3 Touch LCD 1.47
  • Waveshare ESP32-S3 Touch LCD 2.8
  • Waveshare ESP32-S3-ETH
  • Waveshare ESP32-S3-GEEK
  • Waveshare ESP32-S3-Matrix
  • Waveshare ESP32-S3-Pico
  • Waveshare ESP32-S3-Tiny
  • Waveshare ESP32-S3-Touch-AMOLED-2.41
  • Waveshare ESP32-S3-Zero
  • Waveshare ESP32S3 LCD 1.28
  • Waveshare ESP32S3 Touch LCD 2
  • WeMos LOLIN32 Lite
  • Yoto Mini 2024
  • Yoto Player V3
  • senseBox-eye ESP32S3
  • sunton_esp32_2432S024C
  • sunton_esp32_2432S028
  • sunton_esp32_2432S032C
  • uGame S3

class sdioio.SDCard(clock: microcontroller.Pin, command: microcontroller.Pin, data: Sequence[microcontroller.Pin], frequency: int)

SD Card Block Interface with SDIO

Controls an SD card over SDIO. SDIO is a parallel protocol designed for SD cards. It uses a clock pin, a command pin, and 1 or 4 data pins. It can be operated at a high frequency such as 25MHz. Usually an SDCard object is used with storage.VfsFat to allow file I/O to an SD card.

Construct an SDIO SD Card object with the given properties

Parameters:
  • clock (Pin) – the pin to use for the clock.

  • command (Pin) – the pin to use for the command.

  • data – A sequence of pins to use for data.

  • frequency – The frequency of the bus in Hz

Example usage:

import os

import board
import sdioio
import storage

sd = sdioio.SDCard(
    clock=board.SDIO_CLOCK,
    command=board.SDIO_COMMAND,
    # Note that board.SDIO_DATA is a tuple of four pins, not an individual pin.
    data=board.SDIO_DATA,
    # On some boards, the data pins are named individually. Use this line instead.
    #data=(board.SDIO_DATA0, board.SDIO_DATA1, board.SDIO_DATA2, board.SDIO_DATA3),
    frequency=25000000)
vfs = storage.VfsFat(sd)
storage.mount(vfs, '/sd')
os.listdir('/sd')
configure(frequency: int = 0, width: int = 0) None

Configures the SDIO bus.

Parameters:
  • frequency (int) – the desired clock rate in Hertz. The actual clock rate may be higher or lower due to the granularity of available clock settings. Check the frequency attribute for the actual clock rate.

  • width (int) – the number of data lines to use. Must be 1 or 4 and must also not exceed the number of data lines at construction

Note

Leaving a value unspecified or 0 means the current setting is kept

count() int

Returns the total number of sectors

Due to technical limitations, this is a function and not a property.

Returns:

The number of 512-byte blocks, as a number

readblocks(start_block: int, buf: circuitpython_typing.WriteableBuffer) None

Read one or more blocks from the card

Parameters:
  • start_block (int) – The block to start reading from

  • buf (WriteableBuffer) – The buffer to write into. Length must be multiple of 512.

Returns:

None

writeblocks(start_block: int, buf: circuitpython_typing.ReadableBuffer) None

Write one or more blocks to the card

Parameters:
  • start_block (int) – The block to start writing from

  • buf (ReadableBuffer) – The buffer to read from. Length must be multiple of 512.

Returns:

None

frequency: int

The actual SDIO bus frequency. This may not match the frequency requested due to internal limitations.

width: int

The actual SDIO bus width, in bits

deinit() None

Disable permanently.

Returns:

None

__enter__() SDCard

No-op used by Context Managers. Provided by context manager helper.

__exit__() None

Automatically deinitializes the hardware when exiting a context. See Lifetime and ContextManagers for more info.