Description
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: ESP-12
- Core Version: 559a286
- Development Env: Arduino IDE
- Operating System: Windows
Settings in IDE
- Module: Nodemcu
- Flash Mode: qio
- Flash Size: 4MB
- lwip Variant: v2 Lower Memory
- Reset Method: nodemcu
- Flash Frequency: 40Mhz
- CPU Frequency: 80Mhz
- Upload Using: [OTA|SERIAL]
- Upload Speed: 115200
Problem Description
The Sd2Card::init function expects the desired SPI speed to be passed in but then doesn't use it for hardware SPI, instead the speed is hard coded to '250000' (250KHz) on line 286:
settings = SPISettings(250000, MSBFIRST, SPI_MODE0);
This compiles and runs, however at such low speeds the SD.begin() call in the SD library that runs this init times out without exception. I found the issue after scoping the SPI clock speed.
Changing the line to use the passed in, desired SPI speed resulted in the Sd card initialising as expected:
settings = SPISettings(sckRateID, MSBFIRST, SPI_MODE0);
I was going to submit a fix, but as this has been there for the last 4 years I wanted to check if I've just interpreted something wrong before I did...
MCVE Sketch
No compile or runtime errors - just the timeout due to a slow network. I can add code if required.