Bill Greiman
Well-known member
I have posted SdFat 2.0.0-beta.3 on GitHub. It supports SDIO on Teensy 4.0.
It has slightly faster read/write performance on T4 than T3 for larger transfers. This may improve in the future.
Here is the bench example for 512 byte transfers with a 50 MB file.
T4:
T3:
T4 is much faster for small writes such as print calls.
Here are results for 8 byte transfers. T4 is almost three times faster.
T4:
T3:
These results are for optimized FIFO programmed transfers. The SD card sees a single 50 MB transfer for T4. T3 requires two transfers due to an Errata.
DMA transfers are very slow since the SD sees 512 byte transfers. Modern SD cards emulate 512 byte transfers.
The Record Unit, RU, for a modern SDHC card is 512 KiB or 1024 time larger than a 512 byte sector. You only get full performance if you do transfers of multiple RUs.
I am currently using High Speed mode with 3.3V signaling and 49.5 MHz SD clock. This is the real performance limitation.
The T4 uSDHC supports the following modes.
I will try DDR50 or SDR50. The i.MX RT1060 documentation has very little programming info on these modes. The SDK for the chip is a nightmare but has some info. There is also a Linux driver for a NXP chip with a uSDHC module similar to the IMXRT1062.
It has slightly faster read/write performance on T4 than T3 for larger transfers. This may improve in the future.
Here is the bench example for 512 byte transfers with a 50 MB file.
T4:
Code:
FILE_SIZE_MB = 50
BUF_SIZE = 512 bytes
write speed and latency
speed,max,min,avg
KB/Sec,usec,usec,usec
22123.89,4573,22,23
22123.89,4030,22,23
read speed and latency
speed,max,min,avg
KB/Sec,usec,usec,usec
22665.46,748,22,22
22655.19,1085,22,22
T3:
Code:
FILE_SIZE_MB = 50
BUF_SIZE = 512 bytes
write speed and latency
speed,max,min,avg
KB/Sec,usec,usec,usec
18525.38,50086,26,27
18917.90,3028,26,26
read speed and latency
speed,max,min,avg
KB/Sec,usec,usec,usec
18719.58,251,27,27
18712.57,251,27,27
T4 is much faster for small writes such as print calls.
Here are results for 8 byte transfers. T4 is almost three times faster.
T4:
Code:
FILE_SIZE_MB = 50
BUF_SIZE = 8 bytes
write speed and latency
speed,max,min,avg
KB/Sec,usec,usec,usec
12124.15,3444,0,0
12124.15,3408,0,0
read speed and latency
speed,max,min,avg
KB/Sec,usec,usec,usec
12088.97,128,0,0
12088.97,127,0,0
T3:
Code:
FILE_SIZE_MB = 50
BUF_SIZE = 8 bytes
write speed and latency
speed,max,min,avg
KB/Sec,usec,usec,usec
4441.29,3004,1,1
4442.08,3033,1,1
read speed and latency
speed,max,min,avg
KB/Sec,usec,usec,usec
4293.32,218,1,1
4293.69,217,1,1
These results are for optimized FIFO programmed transfers. The SD card sees a single 50 MB transfer for T4. T3 requires two transfers due to an Errata.
DMA transfers are very slow since the SD sees 512 byte transfers. Modern SD cards emulate 512 byte transfers.
The Record Unit, RU, for a modern SDHC card is 512 KiB or 1024 time larger than a 512 byte sector. You only get full performance if you do transfers of multiple RUs.
I am currently using High Speed mode with 3.3V signaling and 49.5 MHz SD clock. This is the real performance limitation.
The T4 uSDHC supports the following modes.
Code:
DDR50 - DDR up to 50MHz 1.8V signaling
SDR50 - SDR up to 100MHz 1.8V signaling
SDR104 - SDR up to 208MHz 1.8V signaling
I will try DDR50 or SDR50. The i.MX RT1060 documentation has very little programming info on these modes. The SDK for the chip is a nightmare but has some info. There is also a Linux driver for a NXP chip with a uSDHC module similar to the IMXRT1062.