Computers, Development Boards & Shields
Educational & Robotics Kits
Electronic Sensors
Motors & Controllers
Communication & Display
Electronic Components
Soldering & Lab Tools

0
SainSmart Mega 2560 and Virtuabotix SD card initialization failed with Arduino

I have the SainSmart mega2560 and now your SD card reader/writer. I bought it based totally on the reviews, not on price. I am have very little luck getting it to work with the standard Arduino “ReadWrite” sketch. I did changed the SD.begin to use 53. I verified the wiring is correct. I am good with embedded and new with Arduino. I keep getting Initializing SD card…initialization failed! Any help is appreciated. Bob Gage   I just responded to your open forum post, and if at all possible would appreciate it if you could post your problem details, and a picture of your wiring on the Virtuabotix Questions and Answers section. There I will check into your wiring and try to help you resolve the issue. Respectfully, Joseph Dattilo Founder Virtuabotix LLC   Thank you Joseph Dattilo, I tried attaching a couple of pictures using 3 different browsers, on two different computer and could not attach pictures.  Suggestions? I am including the actual code I am using and two code related changes.  My main sketch is almost identical to the standard Arduino sketch, with the changes below.  I tried two different SD cards. Note: I tried several times, it was hit or miss if I got a connection and that is the real problem.  Usually 90% of the time I got “Initializing SD card…initialization failed!”. When it did write, only twice, it was not able to read it back.  I looked at the file on my computer and it was strange ASCII characters, not the characters in the function. Then I commented out the write section and just read a small one line *.txt file I made.  I was successful maybe four times.  But this was hit or miss.  But then the connection problem popped up.  To retry I would press the reset button. BTW nice design to have two pins for each connection. 1). commented out: (also tried without commenting out) // while (!Serial) { // ; // wait for serial port to connect. Needed for Leonardo only // } 2). Changed if (!SD.begin(4)) to if (!SD.begin(53)) And wired CS accordingly. THE ACTUAL ARDUINO SKETCH /* SD card read/write This example shows how to read and write data to and from an SD card file The circuit: * SD card attached to SPI bus as follows: M256 UNO ** MOSI pin 51 – pin 11 ** MISO pin 50 – pin 12 ** CLK pin 52 – pin 13 ** CS pin 53 – pin 4 created Nov 2010 by David A. Mellis modified 9 Apr 2012 by Tom Igoe This example code is in the public domain. */ #include File myFile; 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(10, OUTPUT); pinMode(53, OUTPUT); // if (!SD.begin(4)) { original Arduino sketch if (!SD.begin(53)) { Serial.println(“initialization failed!”); return; } Serial.println(“initialization done.”); // open the file. note that only one file can be open at a time, // so you have to close this one before opening another. myFile = SD.open(“test.txt”, FILE_WRITE); // if the file opened okay, write to it: if (myFile) { Serial.print(“Writing to test.txt…”); myFile.println(“testing 1, 2, 3.”); // close the file: myFile.close(); Serial.println(“done.”); } else { // if the file didn’t open, print an error: Serial.println(“error opening test.txt”); } // re-open the file for reading: myFile = SD.open(“test.txt”); if (myFile) { Serial.println(“test.txt”); // read from the file until there’s nothing else in it: while (myFile.available()) { Serial.write(myFile.read()); } // close the file: myFile.close(); } else { // if the file didn’t open, print an error: Serial.println(“error opening test1.txt”); } } void loop() { // nothing happens after setup }

Let me know how things go, I look forward to working with you or hearing about how you got things working.

Joe

On Thu, Jun 12, 2014 at 4:31 PM, Bob Gager <paintbit@sbcglobal.net> wrote:
I am not sure if i should respond here or on the Virtuabotix website.  I am not sure if I should append to question on the website?
1). I tried three SD cards Kingston Elite pro 512mb, Kingston micro SD 2gig and a Cannon 32mb.
2). I got lucky n that one I am using Dupont wires.
3). I looked at the SainSmart under a lighted magnifier, the solder joints at the chips, components and connectors look good.  I usually use discrete Atmels and my own RTOS and chinese LCDs; but the Arduino clone was a b-day present.  If I decide to have another I will look at the originals.  I will write a simple program to blink LEDs using pins 50-53 as well as the same power pins and wires to verify the connections work.  I do not know anyone else who has a Arduino.  If I have time I can reverse engineer the SD library and use it on a discrete setup.  If you have any test code for the Arduino or discrete Atmels you can send it.
4). Lets hold off on replacing the SD card reader, I am not convinced it is the unit.
Bob   For a quick test of the same wires and pins 50, 51, 52, 53 I used to hook up SD card unit; I wrote a quick program to blink some LEDs.  Just to exercise the output pins and wire.  All worked good.  Now work does have a real Arduino Mega 2560, that I can do a checkout of the SD card unit.  Will let you know how that goes. Bob

 

 

Per one of your suggestions I got a hold of an actual Arduino from work.  I am including pictures of the assembly wired up.  Work was actually excited about the SD Card board; we use the Arduino for vehicle engine work.  But we never collected data.  So they let me borrow their Arduino mega 2560.

Now to the bad news the SD card did not work on the actual Arduino.  I get the same error.

I am concerned that I am missing something.  But I am using the standard sketch with the exception of changing the CS pin; “if (!SD.begin(53)) {“.  I am hoping that there is something more to change in the sketch than what I am doing.

Does your company have a standard sketch that you test your product on the Arduino mega2560?

Bob

 

51 Answers

0

I see the media upload feature is mis-behaving, if you can send me the pictures in a reply to our emails I will get them posted, and be able to check them out in depth.

Now there are several things that can cause the type of problems you are describing, and I will start with the easiest ones to fix first.

I didn’t catch if you tried a second SD card, sometimes there are corrupt sectors on an SD Card which can make it tough to work with an embedded system, and sometimes certain brands of SD Card have slightly different power or speed requirements. In general testing two different brands with your set up is a good practice (if possible).

The second thing to check is that your wires are high quality and not causing intermittent communication errors (I picked our line of Dupont cables because of their superior quality, and ability to retain a signal). I know that when I first started working with this SD Card reader we attempted to use the thin cheap jumper wires that are common-place out there, and there were some definite connectivity issues.

The third possibility is that there is a manufacturing quality issue with the Sainsmart Mega 2560, in our experience there are occasional bad solder points, or missing solder points all together, and the Chinese versions of Arduino boards have a tendency to use Atmel chips that have been discarded due to quality test failures in Atmel facilities (That is a big reason for their lower price). The best way to test for this is to find a friend with a genuine Arduino or Versalino and test to see if the same set-up works without issue.

Finally it is possible that there is a damaged component on the SD Card reader itself. This is a very rare occurance, but sometimes parts go bad early in their life cycle. Since the SD Card Reader has only static components, and you have been able to read/write at least intermittently I do not currently suspect that is the problem.

That said if it turns out your problem is related to the SD Card Reader itself I will make sure you get a replacement right away.

Check out whichever debug steps are easiest for you to accomplish, and let me know how it goes. I look forward to helping you get your system working.

0

This procedure is recommended for people with low visual disturbances including myopia.
コーチ ハンドバッグ [url=http://www.altmuehl09.de/js/coachshoesforkids.php]コーチ ハンドバッグ[/url]

0
0

pdf 15 Feb 2011 11:40 25K 040000CFAMAdventureT.
nike lopar skor

0
0

Revmanchan投资 均线:5线,10线交叉向上发散,看涨 2量学:平衡线原则,K线密集于平衡线.
nike free run sko

0
0

This website contains information about marketing drive.
mbt skor

0
0

7Domain Creation Date 01 Jan 1970Domain Age 45 years, 71 daysDomain Expiration Date 01 Jan 1970Hosting Country PortugalLoad Time Very Slow (3.
nike linne

0
0

为了说明什么是网站对搜索引擎友好,我们不妨看看对搜索引擎不友好的网站有哪些特征: · 网页中大量采用图片或者Flash等Rich Media形式,没有可以检索的文本信息.
nike skor online

0
0

757658 секунд с 5 запросами (99.
mbt skor

0
0

html 12 Mar 2015 02:07 20K Apache Server at www.
mbt sverige

0
0

png 01 Apr 2011 02:37 4k daily_usage_201104.
Billiga Hogan Skor

0
0

Вірусні гепатити в світі та Україні: проблеми та перспективи розвитку, Голубовська О.
nike free run sko

0
0

pdf 26 Dec 2009 10:57 47K 050300Vitae.
billigt mbt

0
0

Stream Australia Racing Preview QuickTopic free message board hosting 1 Users that saved this page: Save www.
nike air max sko

0
0

log 20 Nov 2014 15:52 58K access_141122.
Hogan Skor Rea

0
0

s tennis team saw its quest for the ITA National Indoor Championships title come up short Sunday afternoon as it.
toms sko

0
0

Benefit: 13+ years’ of great content across the spectrum of road cycling.
nike air max sko

0
0

I have an amazing life and want to share it with a great person.
rea nike

0
0

1 week 5 days Karachi University Workshop on Conflict.
mbt sverige

0
0

log 22 Dec 2014 15:58 26K access_141224.
nike jackor

0
0

com are referred by search engines.
nike outlet stock holm

0

Your Answer

No comments yet.

Leave a Reply