Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ported to V2.2.2 modifications by PaufStoffregen to SdioTeensy.cpp #445

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

WMXZ-EU
Copy link

@WMXZ-EU WMXZ-EU commented Nov 1, 2023

@greiman
Copy link
Owner

greiman commented Nov 1, 2023

I wrote this assuming all microSD cards supported High Speed mode since the standard said this:

Version 1.10 and higher SD memory card can be placed in High-Speed mode.

I recently found this is actually optional for older V 1.10 cards.

Since this pull is already in the Teensy version of SdFat I will add it with other major changes to SDIO later.

I have developed a RP2040 SDIO controller using the PIO module. I am also experimenting with SDIO for other chips.

In experiments with the RP2040 controller I can overclock modern cards to over 30 MB/sec in Standard Speed mode.

I experimented with Teensy 4.1 and was able to get over 40 MB/sec in High Speed mode. I may add an optional overclock speed setting to SDIO.

@WMXZ-EU
Copy link
Author

WMXZ-EU commented Nov 1, 2023

I look forward to updated SDIO (especially Teeny4.x and RP2040)

@greiman
Copy link
Owner

greiman commented Nov 1, 2023

It appears Raspberry Pi has a new micro-controller that could replace the RP2040. A first version handles IO on the PI 5.

It is a dual core Cortex M3 with lots of interesting features.

Here is a draft datasheet.

It has an interesting SDIO controller and many other features, PCI Express, Ethernet, displays and cameras.

I hope they release a version as a RP2040 upgrade. The RP1 is clearly a support chips but:

The RP1 shares what Upton describes as "a certain amount of internal infrastructure" with the RP2040, including a programmable input/output (PIO) block.

@greiman
Copy link
Owner

greiman commented Nov 1, 2023

I look forward to updated SDIO (especially Teeny4.x and RP2040)

I probably won't do much with Teensy 4.x. I don't use it anymore.

@hattesen
Copy link

hattesen commented Nov 1, 2023

I have developed a RP2040 SDIO controller using the PIO module. I am also experimenting with SDIO for other chips.

In experiments with the RP2040 controller I can overclock modern cards to over 30 MB/sec in Standard Speed mode.

@greiman, where is this implementation located, and how stable is it?

I have noticed your comments in ZuluSCSI/ZuluSCSI-firmware#269 about SD performance.

@greiman
Copy link
Owner

greiman commented Nov 1, 2023

I have developed a RP2040 SDIO controller using the PIO module. I am also experimenting with SDIO for other chips.
In experiments with the RP2040 controller I can overclock modern cards to over 30 MB/sec in Standard Speed mode.

@greiman, where is this implementation located, and how stable is it?

I have noticed your comments in ZuluSCSI/ZuluSCSI-firmware#269 about SD performance.

I have a core version for SD Default Speed that seems reliable even with overclocking to 50 MHz. This is for a CPU clock of 200 MHz. Almost all cards even work with CPU clock 250 MHz for 62.5 MHz SD clock.

I know what needs to be done for High Speed mode. Basically SD output changes from data valid on clock high to data valid clock low. The timing was changed since 50 MHz was very fast 18 years ago when High Speed mode was specified.

Most modern cards have no problem with overclocking Default Speed timing but I want to provide a correct High Speed mode.

There is also the problem of providing options for GPIO pins. All of these options complicate managing PIO options and memory.

I also want to make it possible for users to add SDIO drivers. So I am trying to implement all of this and make backward compatible changes to the SdFat SDIO APIs.

Not sure when I will release this.

Here are the timing diagrams.
DefaultSpeed

HighSpeed

@greiman
Copy link
Owner

greiman commented Nov 2, 2023

I have also written a fast PIO SPI for RP2040. For many apps it will be fast enough. I also want to provide it with SdFat.

Here is a result with the bench example at 250 MHz CPU:

FreeStack: 253840
Type is FAT32
Card size: 32.01 GB (GB = 1E9 bytes)

Manufacturer ID: 0X1B
OEM ID: SM
Product: 00000
Revision: 1.0
Serial number: 0XE30F5501
Manufacturing date: 10/2015

FILE_SIZE_MB = 5
BUF_SIZE = 512 bytes
Starting write test, please wait.

write speed and latency
speed,max,min,avg
KB/Sec,usec,usec,usec
7173.60,91,70,71
7173.60,91,70,71

Starting read test, please wait.

read speed and latency
speed,max,min,avg
KB/Sec,usec,usec,usec
7142.86,108,70,71
7173.60,94,70,71

I attached the files used in this test.

PioSpiBench.zip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants