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

SdFat with SDIO support. #73

Open
greiman opened this issue Oct 25, 2024 · 6 comments
Open

SdFat with SDIO support. #73

greiman opened this issue Oct 25, 2024 · 6 comments

Comments

@greiman
Copy link

greiman commented Oct 25, 2024

This is not an issue, Just to let you know I finally posted a beta version of SdFat with RP2040/RP2350 support here.

My main goal was Arduino users with small transfers. Here are some results from the bench example.

Pico 2 small 64 byte transfers 150 MHz:

FILE_SIZE_MB = 100
BUF_SIZE = 64 bytes

write speed and latency
speed,max,min,avg
KB/Sec,usec,usec,usec
9980.04,11721,2,6
9984.03,8736,2,6

read speed and latency
speed,max,min,avg
KB/Sec,usec,usec,usec
10145.07,75,1,5
10145.07,76,1,5

Here is the result with 512 byte transfers that avoid cache copies:

Pico 2 512 byte transfers at 150 MHz

FILE_SIZE_MB = 5
BUF_SIZE = 512 bytes

write speed and latency
speed,max,min,avg
KB/Sec,usec,usec,usec
15526.96,38,32,32
15478.89,39,32,32

read speed and latency
speed,max,min,avg
KB/Sec,usec,usec,usec
15526.96,449,32,32
15526.96,452,32,32

Finally large transfers and overclocking.

Pico 2 large transfers at 250 MHz

FILE_SIZE_MB = 100
BUF_SIZE = 32768 bytes

write speed and latency
speed,max,min,avg
KB/Sec,usec,usec,usec
27263.48,11293,1197,1201
27256.04,11098,1197,1201

read speed and latency
speed,max,min,avg
KB/Sec,usec,usec,usec
27013.02,2400,1210,1212
26788.63,9307,1210,1222

@carlk3
Copy link
Owner

carlk3 commented Oct 27, 2024

Great! Good news for the Arduino / PlatformIO users. I've retrofitted Arduino compatibility to this library, but prior to that I had never used Arduino, so it was an afterthought.

@carlk3 carlk3 mentioned this issue Oct 27, 2024
@greiman
Copy link
Author

greiman commented Oct 27, 2024

I had never used Arduino

Arduino is not for serious projects. I have tried to isolate the core of SdFat so I can use it on systems like ChibiOS. I see you also have used STM32 chips also.

I had hope for Arduino in 2008 when I first tried it but it never evolved as I expected. The Arduino guys make lots of money catering to to their huge crowd so it makes good business sense.

@carlk3
Copy link
Owner

carlk3 commented Oct 28, 2024

I have tried to isolate the core of SdFat so I can use it on systems like ChibiOS.

I noticed the lib/SdFat_NoArduino used in ZuluSCSI-firmware.

I see you also have used STM32 chips also.

This library actually started as a port from a project on Cypress PSoC, followed by a port from FreeRTOS+FAT to FatFs, when the Pico first came out. Then the PSoC project migrated to STM32. I have learned a lot and found a lot of bugs by open sourcing the code and maintaining it multiple platforms.

When I started the PSoC project, years ago, PSoC Creator made it really difficult to use C++, so even though I previously had used C++ daily for 12 years I did everything in straight C. Also, that seemed appropriate for an embedded library; consistent with the Pico SDK. But, SdFat shows me what I was missing. Meanwhile, STM32CubeIDE makes it less painful to use C++, and some is creeping back into my larger applications.

@carlk3
Copy link
Owner

carlk3 commented Oct 28, 2024

I've been thinking that 1-bit SDIO could be a nice alternative for highly pin-constrained projects, like in Hardware design with RP2040. I'll have to study your PioSdioCard.pio. There is pico_sd_card, "but the code is very much a prototype".

You'd need no SPI and only three pins: SCK, CMD, and D0, and the pin assignments would be very flexible. I guess performance would be similar to SPI.

@greiman
Copy link
Author

greiman commented Oct 28, 2024

I've been thinking that 1-bit SDIO

I did a PIO SPI that I could clock at high MHz and got the same rates as 1-bit SDIO - it is really simple.

I will look for the code.

@greiman
Copy link
Author

greiman commented Oct 29, 2024

Here is an "as is" copy of my PIO SPI tests for SdFat for RP2040 from about a year ago. Very rough - in development.

The zip has the library and a version of bench setup for a Adafruit Metro 2040.

PioSpi.zip

I ran it today with this result:

AdaFruit Metro RP2040 at 250 MHz

FreeStack: 253840
Type is exFAT
Card size: 125.67 GB (GB = 1E9 bytes)

Manufacturer ID: 0XAD
OEM ID: LS
Product: LX128
Revision: 2.1
Serial number: 0X7009FE94
Manufacturing date: 4/2024

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

write speed and latency
speed,max,min,avg
KB/Sec,usec,usec,usec
7248.91,87,70,70
7251.54,73,70,70

Starting read test, please wait.

read speed and latency
speed,max,min,avg
KB/Sec,usec,usec,usec
7339.36,82,69,69
7339.36,745,69,69

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

No branches or pull requests

2 participants