Overview
- Object ID : 5048 (2025-02-26 22:42:57)
- Author : evanh
- Content : Code
- Microcontroller : Propeller 2
- Language : Generic
- Category : Data Storage
- Licence : MIT
- Tags : FAT16, FAT32, Filesystem, FlexProp, SD card
Content
4-bit SD mode SD card driver plug-in to Flexspin's FAT filesystem layer.
Can be used with Spin2, Basic, C and any languages supported by the Flexspin compiler. Propeller 2 only.
Highest performance is typically when the buffer size matches the FAT cluster size. Writes can easily exceed 10 MB/s on fast cards, and reads 20 MB/s. There is also the option of disabling block read CRC processing to allow reads at sysclock/2. Default is sysclock/4.
Requires Flexspin compiler version 7.0.0 or later. The example tester uses the newly added _vfs_open_fat_handle() API, replacing the older preset list of vfs device open functions. The driver itself uses newly added features around "inline" assembly.
Requires a 4-bit wired SD slot. Main restriction is the four DAT pins have to be in-order on 4-bit pin boundary. Pull-ups are also recommended. Example can be found here - https://forums.parallax.com/discussion/174988/new-sd-mode-p2-accessory-board/p1
I made a basic 4-bit SD slot, without power switch nor LED, by hand wiring a pillaged SD slot - https://forums.parallax.com/discussion/comment/1563018/#Comment_1563018
Also included is two other drivers, for 1-bit SPI mode. One is just a copy of Flexspin's built-in sdmm.cc driver repackaged to be a plugin. The other is rehash of the same that plainly bit-bashes the SPI instead of using any smartpins. At high sysclock frequencies, bit-bashed performance is on par with smartpins because the required SD-EEPROM collision resistor limits SPI clock rate to max 45 MHz (sysclock/8).
17 Feb 2025: v1.0 release.
26 Feb 2025: v1.1, bug fix to support multi-card mounting - Converted the static structures to regular instantiable structures.