Problems with Ethermega and SD Card

Combining the power of the ATmega2560 MCU with onboard Ethernet, a microSD card slot, an efficient switchmode power supply, and a small prototyping area. [Product page]
The Doc
Posts:20
Joined:Fri Jul 12, 2013 10:57 pm
Problems with Ethermega and SD Card

Post by The Doc » Fri Jul 12, 2013 11:26 pm

Hi Everyone – my first post so bear with me if I’m asking a stupid question. I see something like this in a past post but can't see that it was resolved.

I have a new ethermega and new micro SD card (Transcend brand, 2G)

When I download the stock standard examples ‘cardinfo’, ‘files and ‘listfiles’ I get ‘Initialisation Failed’.

Suggested causes are :

* is a card is inserted? – all done – formatted FAT and has a file on it.

* Is your wiring correct? – all shields removed – no wiring other than on the board.

* did you change the chipSelect pin to match your shield or module? – left it as 4 as indicated on Freetronics quick start page.

Took the whole lot back to Jaycar at Warners Bay. Staff there were immensely helpful (as they always are). We swapped the Freetronics card and the sd card individually with new from the box, and the problem persisted.

Seems like incompatibility between Freetronics card and either library or Arduino example sketch.

Any suggestions ? Many thanks in anticipation.

The Doc
Posts:20
Joined:Fri Jul 12, 2013 10:57 pm

Re: Problems with Ethermega and SD Card

Post by The Doc » Sat Jul 13, 2013 10:40 pm

Thanks for the suggestions.

I check the cardinfo sketch again - it already sets chipselect to 4 so I have left it as is.

In case I was missing something, I copied your code, pasted it into a new sketch and got the same result - initialisation failed.

I re-checked the sd card in another computer (mine doesn't have a card reader).

It was pre-formatted when it came. I have saved a file on the card from that computer, opened the file, etc. - couldn't do that if it wasn't formatted.

Card properties show file system FAT. I ran error check under tools in properties and the scan found no problems.

I checked the seating of the card - definitely locked, but I found that the card can be slip out of the holder even after it has clicked into the locking mechanism, without unlocking.

Put the card back in, locked it and checked it hadn't slipped out again.

And then of course - all worked well ! Initialisation succeeded, name read well, files listed well.

So - seems to be an intermittent problem to do with seating of the card, though keep in mind that another sd card and ethermega board still in the store (probably same batch) also behaved badly.

Another observations suggests this board may be a bit shaky. Every time it is powered down and then powered up again I have serial port issues - typically the red led stays on and bright and the port is not listed in the list of ports. I disconnect and connect again and the port number (10) becomes available. The red led dims to the faintest glimmer. My Freetronics Eleven always uses port 9, always reconnects and I haven't noticed the red led staying on. Same USB socket on the computer has been used all the time, and state of other usb sockets has been unchanged.

I'll see how it goes, and look into an exchange if the sd card problem returns intermittently.

The Doc
Posts:20
Joined:Fri Jul 12, 2013 10:57 pm

Re: Problems with Ethermega and SD Card

Post by The Doc » Sun Jul 14, 2013 9:20 am

Apart from a trial with external power supply all use has been with usb power and appropriate jumper setting.

The led I'm talking about is the D13 led beside the blue pwr led.

Sounds like the serial port confusion is something I'm stuck with - just strange that it doesn't happen on the Uno when it's connected to the same system.

Thanks for your excellent support - I'll see how it goes.

andrew
Freetronics Staff
Freetronics Staff
Posts:978
Joined:Sun Jul 14, 2013 7:06 am
Location:Melbourne, Australia
Contact:

Re: Problems with Ethermega and SD Card

Post by andrew » Sun Jul 14, 2013 9:38 am

The Doc wrote:Apart from a trial with external power supply all use has been with usb power and appropriate jumper setting.

The led I'm talking about is the D13 led beside the blue pwr led.

Sounds like the serial port confusion is something I'm stuck with - just strange that it doesn't happen on the Uno when it's connected to the same system.

Thanks for your excellent support - I'll see how it goes.
Not sure what you're doing but if a sketch doesn't specifically set a pin as an output and HIGH/LOW - it can float, and thus D13 LED can waver a bit.

The Doc
Posts:20
Joined:Fri Jul 12, 2013 10:57 pm

Re: Problems with Ethermega and SD Card

Post by The Doc » Thu Aug 29, 2013 9:08 am

Really don't know where to go with this one.

The problem returned on the next attempted read.

Stripped all connections off the card so no confounding coming from there.

Reformatted the card using the official sd formatter so that's not a problem.

Re-seated the card - the holder is faulty and releases the card without unlocking, but that was the same on the other card off the shelf in the store, and it seems to be sitting in position.

Checked the pin number a million times - pin 4

Still get the same response using the cardinfo

Where do I go from there ?

andrew
Freetronics Staff
Freetronics Staff
Posts:978
Joined:Sun Jul 14, 2013 7:06 am
Location:Melbourne, Australia
Contact:

Re: Problems with Ethermega and SD Card

Post by andrew » Thu Aug 29, 2013 10:36 am

The Doc wrote:Really don't know where to go with this one.
Where do I go from there ?
I sent you a direct message.

drake250
Posts:19
Joined:Mon May 28, 2012 1:17 pm
Location:Adelaide

Re: Problems with Ethermega and SD Card

Post by drake250 » Thu Aug 29, 2013 11:03 am

I noticed in the example sketch you haven't set pin 53 as an output. The Arduino help mentions that (on a Mega) the SD library needs 53 (Hardware SS pin) to be set as an output, even though it's not connected to the SD card.
http://arduino.cc/en/Reference/SD
I bought a Mega last weekend and ran into the same problem until I saw the note about pin 53. (On the other boards it's pin 10) Since I did that it's worked perfectly, and the SD and Ethernet are getting along fine.

This may not be the cause of your problem, but I think it's something Mega users need to be aware of, especially since none of the example SD sketches are adjusted for the Mega (though it is mentioned in the comments).

The Doc
Posts:20
Joined:Fri Jul 12, 2013 10:57 pm

Re: Problems with Ethermega and SD Card

Post by The Doc » Fri Aug 30, 2013 6:08 am

Thanks for the thought, Drake. I had changed it but not again before copying to post. Just checked again, definitely set 53 to output but still not luck. Glad to hear yours is going well - shows that the product works and this one is just being quirky. Thanks again.

yudodis
Posts:2
Joined:Sun Dec 01, 2013 7:19 am

Re: Problems with Ethermega and SD Card

Post by yudodis » Sun Dec 01, 2013 7:31 am

I just had the same issues with my EtherMega (Freetronics EtherMega 2560 v3.0 is printed on the board), I tried every suggestion on a couple of forums (including this one) and I found the issue was with the SD card holder. It doesn't just slide in and click into place as it does with most other devices.

A closer inspection of the holder revealed how it really works.

1) Slide the little metal shield forward (towards the digital I/O pins) and then lift it up.
2) Place the SD card into the holder, making sure it sits in the little molded plastic holder.
3) Fold the metal shield back down and pull it back to lock it in place.

After that, all I did was run the cardinfo sketch without changing anything (and setting pin 53 to output) and it worked perfectly.

User avatar
jonoxer
Freetronics Staff
Freetronics Staff
Posts:298
Joined:Sat Oct 15, 2011 11:31 am
Location:Melbourne, Australia
Contact:

Re: Problems with Ethermega and SD Card

Post by jonoxer » Sun Dec 01, 2013 10:36 pm

It seems the top-loading card holders have caught a few people out - including me, the first couple of times I tried to use them. Sorry about that. I figured it would be best to switch to that holder for devices that have the holder trapped somewhere in the middle of the board with no access to an edge, and once you know how to use it it's definitely an improvement on the side-loading holder on the previous EtherMega.

I've just put up a page about it here:

http://www.freetronics.com/pages/using- ... rd-holders
--
Jon

Post Reply