Open davepruitt opened 2 years ago
There is 4-bit SDIO for Teensy 3.x and 4.x. The NXP SDIO controller is excellent and I get read/write rates of about 22 MB/sec. I personally developed the driver. See this example.
I have experimented with ESP32 and ESP32C. The controller is not capable of extended transfers and transfers must be aligned on 4-byte boundaries. The ESP driver often resorts to a series of 512 byte transfers in many cases and write is about 400 KB/sec. Shared SPI on a dedicated SPI port at 40 MHz is much faster for most apps.
I think there is a port of SdFat with an SDIO driver for some STM32 boards but not for the STMicroelectronics board package.
See this package:
https://github.com/rogerclarkmelbourne/Arduino_STM32
Most microprocessor chips have poor SDIO controllers. NXP uses technology from their Applications Processor series.
I was hoping to use 4-bit SDIO on the SAMD21 or SAMD51 if possible.
The SAMD21 has no SDIO controller.
The SAMD51 has a SDIO controller and is supported in CircuitPython 6.0 and above.
I have not located an Arduino SAMD51 SDIO driver to test with. Any tests I have found on the web give poor results. Here are examples:
https://www.alkgrove.com/articles/SAMD51_MicroSD_article.html
Also see page 38 here:
https://cdn-learn.adafruit.com/downloads/pdf/adafruit-microsd-spi-sdio.pdf
CircuitPython: sdcardio: For SD cards on SPI interfaces. sdioio: For SD cards on SDIO interfaces
SD card access with sdcardio on Grand Central: Reads up to 650kB/s Data logging at up to 700 of lines per second
SD card access with sdioio on Grand Central with SDIO breakout: Reads up to 1100kB/s Data logging at over 1000 lines per second
I can read at over 3000kB/sec on an old Due with SPI so I have no interest in writing an SDIO driver for SAMD51.
I did a bit of experimenting with Adafruit SAMD21 and SAMD51 boards. I am using the bench example.
It is possible to define a second SPI port so it can run in fast dedicated SPI mode.
I can easily add an option to use the Adafruit SAMD SPI DMA driver. The result for a Feather M0 board at 12 MHz is:
FILE_SIZE_MB = 5 BUF_SIZE = 512 bytes
write speed and latency speed,max,min,avg KB/Sec,usec,usec,usec 1117.07,1853,455,455 1117.32,1231,455,455
read speed and latency speed,max,min,avg KB/Sec,usec,usec,usec 1117.82,461,454,455 1118.07,461,454,455
For a Feather M4 board at12 MHz:
FILE_SIZE_MB = 5 BUF_SIZE = 512 bytes
write speed and latency speed,max,min,avg KB/Sec,usec,usec,usec 1437.61,9361,354,355 1440.92,1093,354,354
read speed and latency speed,max,min,avg KB/Sec,usec,usec,usec 1450.96,354,352,352 1451.38,354,352,352
The Feather M4 seems to work at 24 MHz which is often flaky for SAMD:
FILE_SIZE_MB = 5 BUF_SIZE = 512 bytes
write speed and latency speed,max,min,avg KB/Sec,usec,usec,usec 2796.42,979,182,182 2796.42,1591,182,182
read speed and latency speed,max,min,avg KB/Sec,usec,usec,usec 2823.26,182,180,180 2824.86,183,180,180
Adafruit DMA SPI is far better than the Arduino SPI driver. Here is an MRKZERO at 12 MHz:
FILE_SIZE_MB = 5 BUF_SIZE = 512 bytes
write speed and latency speed,max,min,avg KB/Sec,usec,usec,usec 468.56,8652,1087,1090 468.87,2449,1087,1089
read speed and latency speed,max,min,avg KB/Sec,usec,usec,usec 452.90,1136,1125,1127 452.98,1136,1125,1127
Is there any support for 4-bit SDIO, rather than just single-bit SPI? If not, can I make this a feature request?