Je n'arrive pas à lire les infos de ma carte SD depuis mon shield Ethernet ...
J'ai un shield "chinois" et un arduino nano
J'ai bien alimenté mon shield (depuis l'arduino)
j'ai relié le pin 4 du shield sur le pin 10 de l'arduino
coté code :
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for Leonardo only
}
Serial.print("\nInitializing SD card...");
pinMode(10, OUTPUT); // change this to 53 on a mega
digitalWrite(10, HIGH);
if (!card.init(SPI_HALF_SPEED, chipSelect)) {
Serial.println("initialization failed. Things to check:");
Serial.println("* is a card is inserted?");
Serial.println("* Is your wiring correct?");
Serial.println("* did you change the chipSelect pin to match your shield or module?");
return;
} else {
Serial.println("Wiring is correct and a card is present.");
}
..et donc je reste en failed .. qui peu m'aider ?
Merci !
ah oui, il y a bien une carte dessus (HC 8 Gb formatée en FAT32)
j'ai ce même matos. voici ton code ( modifié ) qui fonctionne chez moi. (moniteur en 57600)
pas de cablage extérieur, juste déclarer le "chipselect" comme dans le code
#include <SPI.h>
#include <SD.h>
// set up variables using the SD utility library functions:
Sd2Card card;
SdVolume volume;
SdFile root;
const int chipSelect = 4;
void setup()
{
Serial.begin(57600);
while (!Serial) {
; // wait for serial port to connect. Needed for Leonardo only
}
}
void loop()
{
// put your main code here, to run repeatedly:
Serial.print("\nInitializing SD card...");
pinMode(10, OUTPUT); // change this to 53 on a mega
digitalWrite(10, HIGH);
if (!card.init(SPI_HALF_SPEED, chipSelect))
{
Serial.println("initialization failed. Things to check:");
Serial.println("* is a card is inserted?");
Serial.println("* Is your wiring correct?");
Serial.println("* did you change the chipSelect pin to match your shield or module?");
return;
} else
{
Serial.println("Wiring is correct and a card is present.");
}
while(1){};
}
pepe:
Il n'y avait pas de raison de croiser les deux signaux MOSI et MISO. J'espère que tu n'as rien grillé en branchant deux sorties l'une sur l'autre.
Aurais-tu moyen de tester ta carte SD et ton shield avec un Arduino sur lequel il s'emboîte (Uno, Leonardo ou autre) ?
je ne pense pas que ca soit grillé ... je pourrais peut etre placer des led sur les mosi/miso histoire de voir si il y a des données qui sortent/rentrent ....
je viens de brancher mon shield en version "ethernet" les led TX/RX fonctionnent bien (ainsi que les autres) ... donc je pense que la connection nano/W5100 est ok ...