Comments (10)
I forgot to mention that the error is: it just cannot read the SD card.
Can't access SD card. Do not reformat.
No card, wrong chip select pin, or SPI problem?
SD errorCode: 0X1,0X0
from sdfat.
Your shields will not work with both Software SPI and hardware SPI. Both shields connect to the ISP connector so they use pins 50, 51, 52 for MISO, MOSI, SCK on the Mega.
The SD is not connected to pins 11, 12, 13.
You could use the SD only, not CAN or EtherNet at the same time with software SPI.
from sdfat.
Hi Greiman,
First of all, canbus shield does not have ISP connector like the ethernet. It is connected via pins 9-13. Pin 9 is CS for SD and 10 is CS for CAN. Also, I stack mega+ethernet+canbus and use sofware SPI for CAN on pins 10-13 and hardware SPI for ethernet on pins 50-53 without any problems. In the mean time I can also switch to hardware SPI for SD card on ethernet shield. I want to use CAN shield SD card with mega. Because I will not use Ethernet shield, and want to use CAN + SD from pins 9-13 both with software SPI.
from sdfat.
Just to verify connectivity of SD pins: I used SdFatSoftSpi with ethernet shield on pins 50-53. No problem. Then, plugged in only CAN shield. Did the same, no luck. I am sure about CAN shield SPI pins that they are 9-13.
from sdfat.
I have no idea whether you can run both the CAN and SD with software SPI on the CAN card.
You should be able to access the SD card alone if you disable the CAN by setting CAN_CS high.
Looks like CAN_CS is 10 and in your example code above you set 10 to output mode but don't set it high.
Looks like SD_CS on your CAN shield is pin 9.
I test software SPI on mega using an Adafruit Dataloging shield with pins 10-13. I use the SdFat SoftwareSpi example without modification for the test. The AdaFruit shield uses pin 10 for SD_CS.
Try making the following mods to the SoftwareSpi example.
Change the SD chip select pin like this
// Chip select may be constant or RAM variable.
const uint8_t SD_CHIP_SELECT_PIN = 9;
Disable CAN SPI like this
pinMode(10, OUTPUT); // <--- ADD THIS
digitalWrite(10, HIGH); // <<--- ADD THIS
if (!sd.begin(SD_CHIP_SELECT_PIN)) {
sd.initErrorHalt();
}
Try running the example.
from sdfat.
I edited the above. Make sure pin 10 is set high and only the CAN shield is on the Mega when you run the SoftwareSpi example.
from sdfat.
Here is the result;
2xWin7 PCs, 3xArduino IDEs with different versions with fresh install, Mega+CAN shield only, NO chance.
I switched CAN shield with another one. It worked!!!
However, I do not believe the first CAN shield is wrong because when I plug it on an UNO, with the same code above, it works in SdFatSoftSpi.
Do you have any idea?
from sdfat.
More confusing finding:
I switched mega with a new one. Plugged in the problematic CAN shield. It worked..... ????
from sdfat.
By the way there is no hardware switch or jumper setting available on CAN shield and of course on MEGA. So hardware are all the same and originals from Sparkfun.
from sdfat.
I see cases like this fairly often. Experienced users contact me when a problem doesn't make sense.
Often users finally understand the problem, like a bad solder joint on a board or different versions of a part on the board.
Sometimes you only know a board has a problem. Like your Mega could have a problem with one of the software SPI pin connectors. The new CAN shield might make connection because its pins are at a slightly different angle.
Sometimes it's a mystery why two boards don't work together when they work in other situations. If it is my hardware I can't rest until I understand this type problem.
from sdfat.
Related Issues (20)
- Pin selection for esp8266 HOT 1
- 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 9
- 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 3
- 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
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.