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

ESP8266SdFat Performance vs Upstream SdFat #7772

Closed
6 tasks done
forkineye opened this issue Dec 16, 2020 · 0 comments · Fixed by #7779
Closed
6 tasks done

ESP8266SdFat Performance vs Upstream SdFat #7772

forkineye opened this issue Dec 16, 2020 · 0 comments · Fixed by #7779
Assignees

Comments

@forkineye
Copy link
Contributor

Basic Infos

  • This issue complies with the issue POLICY doc.
  • I have read the documentation at readthedocs and the issue is not addressed there.
  • I have tested that the issue is present in current master branch (aka latest git).
  • I have searched the issue tracker for a similar issue.
  • If there is a stack dump, I have decoded it.
  • I have filled out all fields below.

Platform

  • Hardware: Wemos D1 mini (ESP-12)
  • Core Version: 2.7.4 - 2843a5a
  • Development Env: Arduino IDE
  • Operating System: Windows

Settings in IDE

  • Module: Generic ESP8266 Module
  • Flash Mode: dio
  • Flash Size: 4MB
  • lwip Variant: v2 Lower Memory
  • Reset Method: nodemcu
  • Flash Frequency: 40Mhz
  • CPU Frequency: 160MHz
  • Upload Using: SERIAL
  • Upload Speed: 921600

Problem Description

SPI SD card usage utilizing SD or SDFS is much slower than expected. Testing utilizing the ESP8266SdFat->bench example sketch is showing write speeds of ~130 KB/s and read speeds of ~650 KB/s. Attempts to utilize ENABLE_EXTENDED_TRANSFER_CLASS and SdFatEx in the bench example fail to compile. Analysis with a logic analyzer show many pauses in SPI transactions while writing data. While troubleshooting, I decided to replace ESP8266SdFat with the upstream version which now supports ESP8266 and ESP32. Testing with the upstream SdFat->bench example showed write speeds of ~1.6MB/s and read speeds of 3.2MB/s, much faster than the current version included in ESP8266SdFat. This does seem to break the SD/SDFS wrappers due to changes in SdFat. Usage of ENABLE_DEDICATED_SPI in SdFat didn't cause any noticeable increase of performance which may warrant further analysis.

MCVE Sketch

2.7.4 ESP8266SdFat bench.ino
Upstream SdFat bench.ino

@earlephilhower earlephilhower self-assigned this Dec 21, 2020
earlephilhower added a commit that referenced this issue Dec 23, 2020
* Update to upstream SdFat 2.0.2

Increases the read/write performance for SD card accesses
by a significant amount, up to 5x (3+MB/s) in testing.

Fixes #7772 

* Add SDFS::availableForWrite handler

Peek into the sector cache to determine the maximum number of
bytes that can be written w/o needing a (slow) SD operation.

Fixes #7650
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 a pull request may close this issue.

2 participants