Pages: [1] 2   Go Down
Author Topic: SEEED SD Card Shield and the ardunio mega 2560  (Read 2430 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 9
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I'm trying to get the SEEED SD Card Shield to work with my ardunio mega 2560 and I'm not having any luck. Some of the example code won't compile from the get go giving random errors leading me to believe it doesn't have some library it needs the cardinfo script seems to run but even with a sandisk 2GB SD card in (the recommended on the SEEED wiki) it still reports the error.

"
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?
"
Others, for example the QuickStart script, give a whole host of errors


"QuickStart:135: error: redefinition of 'const uint8_t spiSpeed'
QuickStart:5: error: 'const uint8_t spiSpeed' previously defined here
QuickStart:139: error: redefinition of 'Sd2Card card'
QuickStart:9: error: 'Sd2Card card' previously declared here
QuickStart:140: error: redefinition of 'SdVolume volume'
QuickStart:10: error: 'SdVolume volume' previously declared here
QuickStart:141: error: redefinition of 'SdFile root'
QuickStart:11: error: 'SdFile root' previously declared here
QuickStart:144: error: redefinition of 'ArduinoOutStream cout'
QuickStart:14: error: 'ArduinoOutStream cout' previously declared here
QuickStart:147: error: redefinition of 'char cinBuf [40]'
QuickStart:17: error: 'char cinBuf [40]' previously declared here
QuickStart:148: error: redefinition of 'ArduinoInStream cin'
QuickStart:18: error: 'ArduinoInStream cin' previously declared here
QuickStart:151: error: redefinition of 'int chipSelect'
QuickStart:21: error: 'int chipSelect' previously declared here
QuickStart.cpp: In function 'void cardOrSpeed()':
QuickStart:153: error: redefinition of 'void cardOrSpeed()'
QuickStart:23: error: 'void cardOrSpeed()' previously defined here
QuickStart.cpp: In function 'void reformatMsg()':
QuickStart:163: error: redefinition of 'void reformatMsg()'
QuickStart:33: error: 'void reformatMsg()' previously defined here
QuickStart.cpp: In function 'void setup()':
QuickStart:169: error: redefinition of 'void setup()'
QuickStart:39: error: 'void setup()' previously defined here
QuickStart.cpp: At global scope:
QuickStart:179: error: redefinition of 'bool firstTry'
QuickStart:52: error: 'bool firstTry' previously defined here
QuickStart.cpp: In function 'void loop()':
QuickStart:180: error: redefinition of 'void loop()'
QuickStart:53: error: 'void loop()' previously defined here
"

Note that I didn't edit the script any from the basic so I'm not sure what the problem is. I've already gone through all the things i can find on this subject including this wiki page http://www.seeedstudio.com/wiki/SD_Card_Shield_V3.0 but I feel like I'm missing something really basic. The scripts I'd like to focus on are cardinfo and QuickStart since they are really basic and if we figure out whats wrong there it should fix the problems of the more complex programs. The downloads are on the page (http://code.google.com/p/beta-lib/downloads/detail?name=SdFatBeta20120327.zip&can=2&q=) I'm going to keep messing around with it but if I figure something out I'll let you know.

edit: Had some 4am grammar issues in the post sorry about that.
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 601
Posts: 48543
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Some of the example code won't compile from the get go giving random errors leading me to believe it doesn't have some library it needs the cardinfo script seems to run but even with a sandisk 2GB SD card in (the recommended on the SEEED wiki) it still reports the error.
If you are using the Arduino IDE to compile the code, there is nothing random about the error messages.

Incomprehensible, perhaps, but not random.

Quote
Others, for example the QuickStart script, give a whole host of errors
Where did this code come from, so we can try to understand/reproduce the issues?
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 9
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Some of the example code won't compile from the get go giving random errors leading me to believe it doesn't have some library it needs the cardinfo script seems to run but even with a sandisk 2GB SD card in (the recommended on the SEEED wiki) it still reports the error.
If you are using the Arduino IDE to compile the code, there is nothing random about the error messages.

Incomprehensible, perhaps, but not random.

Quote
Others, for example the QuickStart script, give a whole host of errors
Where did this code come from, so we can try to understand/reproduce the issues?

The code is available for download in the link I provided. I had a small break through last night. I tried removing the libraries from my computer completely then reinstalling. Can't tell you why that worked but it did now I'm getting a different error. This was from sdInfo it asks in the serial monitor "press any key to continue" it loads for a second after pressing a key and then gives

"card.init failed SD errorCode: 0X1 SD errorData: 0X0"

As a serial monitor error message I've found a few people that have had the same problem but if they ever figured out how to fix it they didn't share what the answer was. If I figure it out I'll let you all know.
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 601
Posts: 48543
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

There is a big difference in the types of messages you are discussing. The first were messages from the compiler telling you that there were problems with the code you were trying to compile.

Mostly, they seem to indicate that you had two copies of the source file in the libraries folder, in different directories, so the compiler was trying to compile/link both files (because they both had the right name). Having deleted and reinstalled, and recreated the libraries folder contents, that problem was eliminated.

Now, the program you compiled is providing messages. These indicate that the hardware that the code is accessing is not responding in the proper (that is, expected) manner. This could be because the hardware is wired incorrectly or because the card that is being read is corrupt/not formatted correctly.

Having moved beyond a programming issue, you need to repost now in the storage forum for help with the hardware side of things. fat16lib monitors that section, more than others, and is EXTREMELY helpful in getting people past the kinds of problems you are having.
Logged

Miramar Beach, Florida
Offline Offline
Faraday Member
**
Karma: 139
Posts: 5856
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

In this link you posted, it states specifically (under Features) this card is not Mega compatible.
http://www.seeedstudio.com/wiki/SD_Card_Shield_V3.0
You can probably "pin bend" a bit to get it to work, but it won't work "off the shelf".
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 601
Posts: 48543
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
In this link you posted, it states specifically (under Features) this card is not Mega compatible.

This is exactly why posting on the forum is much better than using PM to interact with one person. Each person that reads a message here will look at the problem from a slightly different perspective. I almost always assume, until I know that it has been ruled out, that you have a programming issue. That's my occupation, and, since this was posted in the programming section, I assumed a programming issue.

Other people, who know more about the peculiarities of hardware, will first look for hardware issues as the root cause.

Each person here brings a slightly different perspective, which is what makes this such a great place, in my opinion.
Logged

Miramar Beach, Florida
Offline Offline
Faraday Member
**
Karma: 139
Posts: 5856
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
This is exactly why posting on the forum is much better than using PM to interact with one person. Each person that reads a message here will look at the problem from a slightly different perspective. I almost always assume, until I know that it has been ruled out, that you have a programming issue.
I saw that post also. I normally use that reason to refuse helping a user sending a PM. I presume power supply or hardware first, because that was my first hobby-turned-job.  smiley
Logged

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 474
Posts: 18696
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

This is exactly why posting on the forum is much better than using PM to interact with one person. Each person that reads a message here will look at the problem from a slightly different perspective.

I totally agree with PaulS here. The help you get from a team will almost always be better than that from one person, no matter how talented. Hardware people overlook software issues, software people overlook hardware issues. Some issues (hardware or software) may be new to one person, but another may be an expert in that particular subject.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 9
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

In this link you posted, it states specifically (under Features) this card is not Mega compatible.
http://www.seeedstudio.com/wiki/SD_Card_Shield_V3.0
You can probably "pin bend" a bit to get it to work, but it won't work "off the shelf".


If you look at the code of the scripts I'm talking about however it specifically mentions that you can change a pin to make it mega compatible. So I don't know which to trust. I have seen people have gotten this work so I assume you can. I seriously doubt this a hardware issue particularly. This http://arduino.cc/en/Reference/SD seems to suggests that SD cards can work with it but need to use different pins. It could be that I need to actually rework the SD cards board for this yes but there is that option so with the script provided I think. Some people figured it out so there has to be a way that doesn't involve me taking the board apart to do this.

Now I realize the SD card related stuff was made universally so it could be the arrangement of this particular board is just not useable. Is there any reason that pins 51 52 and 53 have to be used on a mega that anyone can explain? Is this the only spot on the board that can do this? Is there something special about those spots? This seems like a software issue when you look at it that way. I'll look into an uno or one of the other ones mentioned but I have no real idea which ones will work if this is a hardware issue since the box of the SEEED Shield claims its "ardunio compatible" leading me to believe that any non compatible ardunios they would have excluded. In the very least I can say that the support from the SEEED forums has been non existent and much of the wiki seems to be down or incomplete inaccurate or outdated (I got a touch screen from them and it had similar misleading or inaccurate information on the site). I don't think I'll be buying more products from them. Though the touch screen they sold seems to be working fine despite requiring the same ports as the SD shield. I don't seriously see a reason that this has the be hardware I know I could take the thing apart and make it work that way but I don't see a reason why that's needed considering all I've said.
Logged

Pittsburgh, PA, USA
Offline Offline
Faraday Member
**
Karma: 94
Posts: 4751
I learn a bit every time I visit the forum.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Is the SD card you are using pre-formatted FAT, FAT-16 or FAT-32?

I bought SD modules from DealExtreme and took a chance and they work fine with the standard libraries though I like the SdFat library better than the standard SD library. I got 3 for $2.60 ea though they do need 8 jumpers and not a shield arrangement.

Logged

I find it harder to express logic in English than in Code.
Sometimes an example says more than many times as many words.

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 601
Posts: 48543
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Is there any reason that pins 51 52 and 53 have to be used on a mega that anyone can explain?
Yes. They are the hardware SPI pins.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 1
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I myself am also trying to get seeed sd card shield and the mega 2560 to work together.  I am fairly new to all of this and was wondering if anyone has a messenger account or facebook and would be able to help me out by answering some questions on how to get all of this stuff to work together.  I have the Arduino Mega 2560 and am trying to get it to work with the seeed sd shield and also the seeed 2.8"tft touch shield.  please send me a message if you are able to help me with this...
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 9
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I myself am also trying to get seeed sd card shield and the mega 2560 to work together.  I am fairly new to all of this and was wondering if anyone has a messenger account or facebook and would be able to help me out by answering some questions on how to get all of this stuff to work together.  I have the Arduino Mega 2560 and am trying to get it to work with the seeed sd shield and also the seeed 2.8"tft touch shield.  please send me a message if you are able to help me with this...

At this point I think they are right either we rewire the sdshield or get a different ardunio. I don't think there is a fix. They have a newer version of the SD card shield that works with the 2560 mega but that's the 4.0 not the 3.0 that we have. How you can tell which is which I don't know. I'm not happy about SEEED at all at this point.


edit: I forgot to add this link http://www.seeedstudio.com/forum/viewtopic.php?f=23&t=4145
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 1
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

This isn't really a clean solution, but it works as long as you don't plan to stack any additional shields on top of the SEEED SD shield:

There are two different options. a) is safer, b) will involve clipping some of the pins on the SD shield.

Here's a):

1) Connect all headers on the "analog side" (Analog and Power) using a separate set of headers to create space between the boards
2) use a jumper wire to connect Mega Pin 10 to SD pin 10   
3) use a jumper wire to connect Mega Pin 50 to SD pin 12
4) use a jumper wire to connect Mega Pin 51 to SD pin 11
5) use a jumper wire to connect Mega Pin 52 to SD pin 13
6) Upload the sketch and try it.

And here's b) (BEWARE! There's no way back if you mess up!):

1) Trim all digital pins off the SD shield EXCEPT pin 10
2) Stack the SD shield onto the Mega
3) use a jumper wire to connect Mega Pin 50 to SD pin 12
4) use a jumper wire to connect Mega Pin 51 to SD pin 11
5) use a jumper wire to connect Mega Pin 52 to SD pin 13
6) Upload the sketch and try it.


   
Logged

Pittsburgh, PA, USA
Offline Offline
Faraday Member
**
Karma: 94
Posts: 4751
I learn a bit every time I visit the forum.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

There are projects to roll-your-own using SD adapters or floppy edge connectors.

This guy goes to way too much work:
http://www.instructables.com/id/SDMMC-fits-in-floppy-edge-connector/

You don't need to pry any connector open. Cut the cable with the twist off one side of the floppy-now-SD connector. The next connector on the ribbon has just right for jumpers holes that go to matching wires on the ribbon. The only thing missing is voltage-leveling, SD wants 3.3V. That might be do-able with zener diodes or voltage dividers plugged right into the cable connectors.

One member here soldered wires to the fingers on a micro-SD adapter. You need leveling if you use it on a 5V Arduino but I think only for power and 3 SPI lines.


Logged

I find it harder to express logic in English than in Code.
Sometimes an example says more than many times as many words.

Pages: [1] 2   Go Up
Jump to: