The same in French at (Le même en Français à) >> Résolu << : MEGA + lecteur de carte SD "LC studio" ne fonctionnent pas... - Français - Arduino Forum
Hi every body,
When I started to work on this SD card reader, I thought to have 15 minutes to start to learn all the functions of the library (SD in the case).
Perhaps is there something I don't understand but nothing is correctly going on.
I m working on MEGA with an "LC studio" SD card reader.
If you read French, U can see this post (in FRench) : http://arduino.cc/forum/index.php/topic,125710.0.html
I m tring now to expose the problem here.
At every time I open the serial monitor, MEGA send this message :
Initializing SD card...initialization failed. Things to check:
* is a card is inserted?
* Is your wiring correct?
* did you change the chipSelect pin to match your shield or module?
The program in the ATMEGA2560 of the MEGA is the one you can find by : Files/Exemples/SD/cardinfo of the 1.0.1 ARDUINO version. I modified it to fit well to MEGA.
#include <SD.h>
Sd2Card card;
SdVolume volume;
SdFile root;
const int chipSelect = 53;
void setup()
{
Serial.begin(9600);
while (!Serial) { ; // wait for serial port to connect. Needed for Leonardo only }
Serial.print("\nInitializing 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); // 10 change this to 53 on a mega
if (!card.init(SPI_HALF_SPEED, chipSelect)) { Serial.println("initialization failed. Things to check:");
...
etc
I tryed with another MEGA card,... with another SD card (64Mo and 32Go Fat formated by Windows 7)
I can see on oscilloscope the MOSI signal from the MEGA to the SD and the answer (I think) from SD to MEGA on MISO (see attached pictures) when CS is at low state. SCK seems to be correct too.
The connection is as follows:
MEGA pin 50 -> miso (Master in) Card Reader "LC studio"
MEGA pin 51 -> mosi (Master Out)
MEGA pin 52 -> sck (Serial Clock)
MEGA pin 53 -> CS (Chip Select)
In Final ... the perennial failure message above recalled.
I did a voltage matching on the outputs of the player to the MEGA (see diagram image)
Seeking an electrical problem on the SD card reader, I found that the ground pin of the regulator AMS1117 was not connected to the ground of the reader, then I fixed the error and voltages are stable and nominal. I found 52Ko and not 0 Ohms between the Voltage controler's ground and the reader's card ground, measured by Fluke 185. This is a problem, sometimes on this type of player because I found a post on this, once I had identified the problem and the components in question, providing the necessary keywords to search on the net... Chinese electronics... ( Arduino Forum )
I'm interested in any new info, result of experience or constructive idea and thank you in advance.
Cordially.