Comments (8)
On the sdfat library folder there is .h file that have the error codes description. When i locate the file i will post here again. If someone finds it out please post here.
from sdfat.
SdInfo can't access the register with card size. This is the first access to the card so you may have a wiring problem.
What board are you using? What type SD module and card? How is it connected?
from sdfat.
Hi,
So I am using an micro sd card reader bought from this store:
https://www.dfrobot.com/product-875.html
the sd card is HC 1 from Scan Disk.
The default wiring is:
13->SCK
12->MISO
11->MOSI
4->Chip Silect
But i have another stuff connected to this ports. So what I had to do was I changed the wiring to another ports and the code that i uploaded to the arduino was this:
#include <SPI.h>
#include <SdFat.h>
/SD Card Congiguration***/
#if ENABLE_SOFTWARE_SPI_CLASS
const uint8_t SOFT_MISO_PIN = 7;
const uint8_t SOFT_MOSI_PIN = 6;
const uint8_t SOFT_SCK_PIN = 5;
const uint8_t SD_CHIP_SELECT_PIN = 4;
#else // ENABLE_SOFTWARE_SPI_CLASS
#error ENABLE_SOFTWARE_SPI_CLASS must be set non-zero in SdFat/SdFatConfig.h
#endif //ENABLE_SOFTWARE_SPI_CLASS
// SdFat software SPI template
SdFatSoftSpi<SOFT_MISO_PIN, SOFT_MOSI_PIN, SOFT_SCK_PIN> sd; // this ables to attribute aonther ports different of the default ports.
// Test file.
SdFile file;
SdFile hour;
File readFile;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
SPI.begin();
}
void loop(){
....
}
I hope this helps
from sdfat.
If you want to connect to the default wiring all you have to do is:
#include <SPI.h>
//#include <SD.h>
#include "SdFat.h"
SdFat SD; //default wiring
#define SD_CS_PIN SS
File myFile;
void setup() {
// Open serial communications and wait for port to open:
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for native USB port only
}
Serial.print("Initializing SD card...");
if (!SD.begin(SD_CS_PIN)) {
Serial.println("initialization failed!");
return;
}
Serial.println("initialization done.");
// open the file. note that only one file can be open at a time,
// so you have to close this one before opening another.
myFile = SD.open("test.txt", FILE_WRITE);
// if the file opened okay, write to it:
if (myFile) {
Serial.print("Writing to test.txt...");
myFile.println("testing 1, 2, 3.");
// close the file:
myFile.close();
Serial.println("done.");
} else {
// if the file didn't open, print an error:
Serial.println("error opening test.txt");
}
// re-open the file for reading:
myFile = SD.open("test.txt");
if (myFile) {
Serial.println("test.txt:");
// read from the file until there's nothing else in it:
while (myFile.available()) {
Serial.write(myFile.read());
}
// close the file:
myFile.close();
} else {
// if the file didn't open, print an error:
Serial.println("error opening test.txt");
}
}
void loop() {
// nothing happens after setup
}
this code is ReadWrite.ino example.
from sdfat.
pmdmartins123,
I can't help since I don't have your SD module. The module uses resistor voltage dividers instead of IC level shifters. This type SD module often causes problems.
from sdfat.
ok thanks
from sdfat.
I actually know mine is wired correctly because it was working with the built-in SD card libraries.
It turns out that it was a clock speed problem. When I changed it down to 1/2 clock speed everything seems to work just fine.
from sdfat.
built-in SD library use 4 MHz by default. You can use higher clock speed with this undocumented call.
boolean begin(uint32_t clock, uint8_t csPin);
from sdfat.
Related Issues (20)
- Did not work at ESP32-CAM HOT 6
- MMC_ERASE HOT 2
- Wrapper to fs::FS to use SDfat in ESPAsyncWebserver HOT 6
- pico-sdk only rp2040 implementation HOT 7
- ESP32 S3 always fails to mount card HOT 10
- Unable to format flat Spiflash module with ESP8266 HOT 4
- Mount issues for a Windows-formatted card HOT 35
- SD NAND XTSD01G (surface mounted chip) not formating HOT 1
- Unable to share the same SPI bus with TFT_eSPI on ESP32 HOT 1
- Problems with multiple SD card HOT 3
- Long timeout calling begin() on Teensy 4.1 when no card present HOT 5
- SdFat 2.22 with USER_SPI1 pin + another USER_SPI2 in SPI_Mode3 HOT 2
- Arduino-Pico: huge slowdown with v2.2.2 (vs.2.1.1) HOT 5
- Problem with SdFat and TwoWire instance. HOT 3
- sd.begin(SPI_CONFIG) breaks my DMA ADC datalogger on the SAMD51 HOT 5
- Issue after latest update. HOT 17
- exFat sd cards not working with Sdinfo.ino example, only FAT32 card HOT 7
- Allocating bin file with 0s HOT 2
- CS_Pin has to be driven high on ESP32 (to be low at the SDCARD) because of some logic inbetween HOT 3
- Initialization fails with ESP32 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sdfat.