Comments (19)
Try the beta.
https://github.com/greiman/SdFat-beta
from sdfat.
Any word on the beta working for the Zero ?
from sdfat.
I don't have a Zero. How does the beta fail on Zero?
from sdfat.
Hi,
Sorry.
I was using the old library. (Aduino newbie with libs etc)
It seems to be just fine.
The lowlatencylogger example is awesome !
Thank you so much for all your work.
from sdfat.
I cannot get the simple Longnames example working on a Zero. I know the hardware is ok because SD.h can read the SD card. I run the same code on a Mega and it works fine. Anything specific I have to do for a Zero?
from sdfat.
The LongFileName example works on my Zero.
I only edited this line to use the correct chip select pin.
// SD card chip select pin.
const uint8_t SD_CS_PIN = SS;
Here is the compile/load:
Sketch uses 18216 bytes (6%) of program storage space. Maximum is 262144 bytes.
Open On-Chip Debugger 0.9.0-g932ec70 (2017-02-15-12:34)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
debug_level: 0
adapter speed: 500 kHz
adapter_nsrst_delay: 100
cortex_m reset_config sysresetreq
target state: halted
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x00000858 msp: 0x200023a0
** Programming Started **
auto erase enabled
wrote 24576 bytes from file C:\Users\bill\AppData\Local\Temp\arduino_build_543647/LongFileName.ino.bin in 2.671261s (8.985 KiB/s)
** Programming Finished **
** Verify Started **
verified 18488 bytes in 1.506024s (11.988 KiB/s)
** Verified OK **
** Resetting Target **
shutdown command invoked
I copied the test files to an 16 GB microSD and ran the example. Here is the output:
You can use test files located in
SdFat/examples/LongFileName/testFiles
FreeStack: 29371
0 With.Two dots.txt
1 A long name can be 255 characters.txt
2 LFN,NAME.TXT
3 lower.txt
4 MIXCASE.txt
5 mixed.TXT
6 Not_8_3.txt
7 OK%83.TXT
8 STD_8_3.TXT
9 With Blank.txt
Enter File Number: 9
With Blank.txt
Just another example of a Long File Name.
Enter File Number:
from sdfat.
I'm using this board which is a Zero compatible Nano board > https://wiki.protoneer.co.nz/NANO-ARM . Like I said I know SD card and files are ok because I SD.H can grab the files on the card. SdFat stops at begin()
from sdfat.
Can't help. There are hundreds of Arduino-like boards so I can't buy and test all.
from sdfat.
That's the problem... Mega == Work, Due == Work, Nano-ARM == not work... I have another SAMD21 en route from China so lets see that works.
from sdfat.
Add Nano to that list of working units... How frustrating. and weirdly SdInfo works using the default parameters. Where are you based Bill? I wonder if I can persuade the Nano-Arm guys to send you a board.
from sdfat.
SdInfo often works when other examples fail. The reason is SdInfo does not initialize the SD until a character is typed. This insures there is not a spurious restart related to the USB.
A real Zero has an extra chip associated with the USB.
Try adding the following to the LongFileName example.
void setup() {
Serial.begin(9600);
while (!Serial) {}
delay(1000);
Serial.println(F("Type any character to begin.")); // <<-- ADD THIS
while (!Serial.available()) {} // <<--ADD THIS
Also try the QuickStart example.
from sdfat.
Ok this is what tried:
- your added code above made no difference
- when I tried the quickstart I got different results. If I placed in a FAT16 128mb SD card I got some feedback but no files displayed. When I put in a FAT32 16GB SD card it errored. See the output below.
- these boards only have NativeUSB port so I have to change the Serial commands to SerialUSB < I wonder if your code is failing inside the library because it references Serial and not SerialUSB? clutching at straws but its an observation.
output from 128MB SD card
Enter the chip select pin number: 4
Assuming the SD is the only SPI device.
Edit DISABLE_CHIP_SELECT to disable another device.
Card successfully initialized.
Card size: 122 MB (MB = 1,000,000 bytes)
Volume is FAT16, Cluster size (bytes): 2048
Files found (date time size name):
output from 16GB SD card
SD initialization failed.
Do not reformat the card!
Is the card correctly inserted?
Is chipSelect set to the correct value?
Does another SPI device need to be disabled?
Is there a wiring/soldering problem?
errorCode: 0x43, errorData: 0xff
Restarting
Enter the chip select pin number:
from sdfat.
Bill. That was weird. I got it working.... I used SDformat to format the 128MB card. bear in mind that these cards worked no problem in Mega, Nano and Due... just not this NANO-ARM board... test the 16GB one next..
from sdfat.
Enough testing for 1 night...
Mega/Due/Nano = working both 128mb FAT16 and 16GB FAT32 cards
Nano-ARM (Zero) = only working on 128mb FAT16 ... now that is the strangest thing right?
from sdfat.
I wonder if your code is failing inside the library because it references Serial and not SerialUSB? clutching at straws but its an observation.
Serial is accessed in sd.intitErrorHalt() and sd.errorHalt(). You can add an argument to use SerialUSB. This should provide additional info about the failure. Change the calls like this.
sd.initErrorHalt(&SerialUSB);
sd.errorHalt(&SerialUSB, "open root failed");
Also ls has an argument for Print so no files are listed in QuickStart.
sd.ls(&SerialUSB, LS_R | LS_DATE | LS_SIZE);
The big difference between the ten year old version of SdFat used in SD.h and the current SdFat is the SPI clock rate. I used a very slow default rate in the first versions of SdFat since many SD modules had resistor level shifters for 5V to 3.3 V signal conversion and failed at higher speeds
SD.h still has a 4 MHz default rate. The LongFileName example uses the max rate supported by the SPI library. This is probably 12 MHz for the Nano Zero.
The SAMD implements SPI with the SERCOM interface so the signals may be marginal on the Nano Zero for some cards at 12 MHz.
Try 4 MHz in the examples. Here is the change for LongFileName.
// Limit SPI to 4 MHz clock
if (!sd.begin(SD_CS_PIN, SD_SCK_MHZ(4))) {
sd.initErrorHalt(&SerialUSB);
}
from sdfat.
Bill its not your library that is the problem... is this board... the clue was in that it could read from small Sd cards but not larger ones and it gave me an idea. What if that was caused by not enough current getting to the SD module so I attached a separate power source and boom it worked...
from sdfat.
You got it. I missed this on the board website.
Power Management
3.3V Regulation is done with a NCP551 Low-Dropout Voltage regulator.
Input Voltage 12V max Output currnet 150mA Very low quiescent current of 4.0uA(Typical)
150 mA is way too little to power the SAMD and any other serious device.
The Zero has a 1 amp LDO 3.3 V regulator so you can get about 500 mA from USB and even more with an external PS since it has an efficient 1 amp DC-DC step-down regulator for the external jack.
I also waste lots of time with poorly designed ebay and other Chinese boards and breakouts.
I now do more testing after being burned too often.
from sdfat.
Yeah I picked that board because it don't look like a badly built clone. I have a low powered OLED to replace the LCD and if I can find a low powered SD module I can make it work. Thanks for your help BTW... Much appreciated. I was almost at the point where I would have purchased one of these and shipped it to your home :)
from sdfat.
I can find a low powered SD module I can make it work.
That won't be easy. Modern SD cards use high current for short times during flash access. That's so they can be fast. Average current is low but you need high peak current.
from sdfat.
Related Issues (20)
- STM32l432kc Inizialization failed whe i do the SD.begin HOT 8
- Reading of same brand of card, only newer, fails with SD_CARD_ERROR_CMD18 HOT 4
- Seeedstudio W5500 Ethernet Shield HOT 6
- Achieving high write speeds HOT 18
- LowLatencyLogger compilation error with Arduino Mega HOT 2
- SDXC cards do not work in 2.2.2 HOT 1
- Noobs example HOT 6
- esp32 - shared spi - lowering 'no card' initialisation timeout HOT 4
- SdFat ESP32 HOT 7
- DebugMacro output is hardcoded to Serial HOT 2
- Strategy for dealing with a corrupted file or filesystem? HOT 2
- Refresh SD-Card !!! HOT 5
- Help needed with accessing files from SD flash from both the cores in esp32 HOT 2
- STM32L452 SPI2 port assignation not working HOT 17
- How to modify the timestamp of a folder1 HOT 2
- Get the full path or directory name of a File HOT 4
- Contribution, ESP32 + SdFat Recipe
- USB HOST SHIELD, USB Flash Drive support HOT 106
- SdFat SDIO on RP2040 with USB stick support HOT 5
- STM32duino and SdFat HOT 14
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.