Bonsoir,
J'ai acheté une carte originale Adafruit Data Logger Shield et j'utilise une mega 2560 R3 originale.
J'ai un problème de lecture de ma carte sd de 4gb. La carte est formatée en fat16 et est reconnue sous ubuntu.
A noté que le RTC DS1307 fonctionne lui sans problème.
Sur la doc d'adafruit Data Logging Shield (Assembled) | Adafruit Shield Compatibility Guide | Adafruit Learning System
Arduino Mega 2560 R3 or Mega ADK
The RTC is compatible. For the SD card, the following may be tried, in decreasing order of recommendation:Use the Adafruit SD library, specifying pin 10 for chip select, 11 for MOSI, 12 for MISO and 13 for SCK.
Edit the file utility/Sd2Card.h in the default Arduino SD library, changing line 42 to read "#define MEGA_SOFT_SPI 1" (default is 0).
J'ai donc téléchargé la bonne librairie et adapté le fichier Sd2Card
Rien n'y fait
J'ai un peu tout essayé sauf ceci
http://www.isn.cligniez.fr/ressources/RTC_SD.pdf
A la page 8 :
branchez deux fils des broches 4 et 5 du shield vers les broches 20 (SDA) à 21(SCL) de
l’Arduino.
Après il faut brancher les broches 13, 12, 11, 10 du shield vers les broches 52, 50, 51, 53
Mais pour essayer, je dois dessouder car je n'ai pas utilisé des Headers EMPILABLES mais de simples pins
Voilà mon code
/*
SD card basic file example
This example shows how to create and destroy an SD card file
The circuit:
* SD card attached to SPI bus as follows:
** UNO: MOSI - pin 11, MISO - pin 12, CLK - pin 13, CS - pin 4 (CS pin can be changed)
and pin #10 (SS) must be an output
** Mega: MOSI - pin 51, MISO - pin 50, CLK - pin 52, CS - pin 4 (CS pin can be changed)
and pin #52 (SS) must be an output
** Leonardo: Connect to hardware SPI via the ICSP header
created Nov 2010
by David A. Mellis
modified 9 Apr 2012
by Tom Igoe
This example code is in the public domain.
*/
#include <SPI.h>
#include <SD.h>
File myFile;
// change this to match your SD shield or module;
// Arduino Ethernet shield: pin 4
// Adafruit SD shields and modules: pin 10
// Sparkfun SD shield: pin 8
const int chipSelect = 10;
void setup()
{
// Open serial communications and wait for port to open:
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for Leonardo only
}
Serial.print("Initializing SD card...");
// On the Ethernet Shield, CS is pin 4. It's set as an output by default.
// Note that even if it's not used as the CS pin, the hardware SS pin
// (10 on most Arduino boards, 53 on the Mega) must be left as an output
// or the SD library functions will not work.
pinMode(53, OUTPUT);
if (!SD.begin(chipSelect)) {
Serial.println("initialization failed!");
return;
}
Serial.println("initialization done.");
if (SD.exists("example.txt")) {
Serial.println("example.txt exists.");
}
else {
Serial.println("example.txt doesn't exist.");
}
// open a new file and immediately close it:
Serial.println("Creating example.txt...");
myFile = SD.open("example.txt", FILE_WRITE);
myFile.close();
// Check to see if the file exists:
if (SD.exists("example.txt")) {
Serial.println("example.txt exists.");
}
else {
Serial.println("example.txt doesn't exist.");
}
// delete the file:
Serial.println("Removing example.txt...");
SD.remove("example.txt");
if (SD.exists("example.txt")){
Serial.println("example.txt exists.");
}
else {
Serial.println("example.txt doesn't exist.");
}
}
void loop()
{
// nothing happens after setup finishes.
}
Une idée ? Merci d'avance et bonne nuit