Mega showing up as Uno in IDE

I am running IDE 1.6.5 r2 and I have 2 identical Sainsmart Megas. Under 1.5.7 both used to show up as Mega COM ports.

A couple of weeks ago I added a LAN connection to a sketch. Up to then I was using IDE 1.5.7 and Mega #1 as a test unit. I could not make a LAN connection with Mega #1 and the Ethernet shield. I switched over to Mega #2 and was immediately able to make a LAN connection. I tried a few more times with Mega #1 and concluded there was a problem with Mega #1.

In the meantime I have upgraded to IDE 1.6.5 r2. I did note that I had to manually install the Arduino driver for my Uno the first time I used it. It normally shows up as COM 27 (Arduino Uno). After that when I used Mega #2 for the first time I did not have to do a manual driver install and it showed up as COM 11 (Arduino Mega). Today I thought I would try and determine what the problem was with Mega #1. So I plugged it in with the Ethernet shield and had trouble getting the IDE to recognise it. Eventually it showed up as COM 9 (Arduino Uno). I deleted/reinstalled/updated/rebooted etc etc but it always reverts to COM 9 (Arduino Uno).

I was able to upload to it with board selceted as Mega but port selected as COM 9 (Arduino Uno) and in fact the LAN connection is now also working!

My concern is I believe the compiler uses the IDE settings when compiling. So I am wondering if I will have compile issues due the port?

Anybody else experienced something similar to this?

And the plot thickens... Previously I used Mega #1 with an SD Card but could not make a LAN connection. A couple of days ago I could suddenly make a LAN connection.

I had in the meantime broken my SD card. Yes, literally broke it in half - by accident. Today I installed a new SD Card and it won't work.

Then it dawned on me... I now realize I could make the LAN connection because there was no SD Card.

A quick scour of the internet brought me to the W5100 bug-fix, which I have tried in accordance with that post, but no luck.

Anybody know of any other fixes?

The weird thing of course is that in my (supposedly) identical Mega #2 both SDCard and Ethernet work without any special tweaks.

I guess it could be from a different batch - lucky for me in a way.

Monologue going here...

Ok so from further research, that software fix should have worked. Since it did not, I gather the fact that the Mega showing up as an Uno may have something to do with it. My thinking is the SPI pins may need to be explicitly set for the Mega which I will try to out how/where to set.

Anyone else have any suggested solution?

I don't know why it is showing up as an Uno, but...

Then it dawned on me... I now realize I could make the LAN connection because there was no SD Card.

...this is what happens if you leave both the ethernet and SD card slave select lines floating.

If you want to use the SD card first, then set D10 to HIGH at the start of your setup function. That will activate the weak pullup and disable the w5100 slave select. I used to recommend setting the pinMode to OUTPUT on D10, but that causes problems on the Due.

If you want to use the ethernet first, set D4 to HIGH at the start of your setup.

SurferTim: I don't know why it is showing up as an Uno, but......this is what happens if you leave both the ethernet and SD card slave select lines floating.

If you want to use the SD card first, then set D10 to HIGH at the start of your setup function. That will activate the weak pullup and disable the w5100 slave select. I used to recommend setting the pinMode to OUTPUT on D10, but that causes problems on the Due.

If you want to use the ethernet first, set D4 to HIGH at the start of your setup.

D10? I am setting D53 High and as an ouput - it is a Mega?

Hmmm mind you since it is showing up as an Uno, I guess no harm in setting D10 high as well.

I will test.

It really doesn't matter about D53. That is the hardware SPI slave select. It is set to OUTPUT and HIGH when SPI.begin() is called.

There is no harm, but there could be hurt if you don't set D10 HIGH. The Mega SPI slave select is D53, not D10 like the Uno. The Uno sets D10 as OUTPUT and HIGH when SPI.begin() is called, so it disables the w5100 SPI "by accident" as I call it. The Mega leaves D10 as an INPUT and floating. That causes problems if you start the SD card first.

In either case, if you start the ethernet first, you should disable the SD SPI by setting D4 to HIGH.

I did all the D4/D10 settings, but it did not help. Methinks the problem lies elsewhere, so I took to checking some connections. I think I have located the problem.

Below are the resistance levels I get between D50 thru D53 and the ICSP header on each of the 2 Megas.

Mega ICSP Connections:

Resistance Levels.

Mega#1 ICSP 1 2 3 4 5 6 D50 0 1748 1 1 1 762 D51 1 1700 1 0 1 706 D52 1 1758 0 1 1 771 D53 1 1703 1 0 1 708

Mega#2 ICSP 1 2 3 4 5 6 D50 0 1738 1 1 1 760 D51 1 1733 1 0 1 758 D52 1 1730 0 1 1 756 D53 1 1728 1 1 1 708

The above shows a bridge between D51 and D53 on Mega#1 - the problem Mega.

aisc: The above shows a bridge between D51 and D53 on Mega#1 - the problem Mega.

How do you see that?

Zero resistance between D51 and ICSP Pin 4. Zero resistance between D53 and ICSP Pin 4. Therefore zero resistance between D51 and D53. I suppose I could actually measurer it to verify... Yes confirmed with direct measure between D51 and D53, the pins are bridged somewhere.

Edit : Sorry Pin 4 not 5.

So it basically means the CS pin and MOSI pins are connected. Any suggested easy software workaround - like using alternate pins?

Anyway at least I know the problem, so I am not going to waste too much time trying to get it to work. Probably best to just buy another - but NOT Sainsmart.

Looks like both Megas are the same. One shows 0 ohms and the other shows 1 ohm. ??

SurferTim: Looks like both Megas are the same. One shows 0 ohms and the other shows 1 ohm. ??

LOL - NOooooooo. Sorry I probably should have explained.... On the (my) multimeter when u (I) measure resistance: 1 = infinity i.e. no connection. 0 = no resistance i.e. a direct connection.

FWIW I thought all multimeters worked this way....no?

If u look at the fourth column of numbers (ICSP PIN 4) for Mega#1, you will see two zeros, indicating D51 and D53 are bridged.

I must be having rotten luck. I avoided Saintsmart and bought a Funduino Mega and again having problems making a LAN connection :( Anybody else have issues with Funduino Mega in making a LAN connection with SD card installed?

...and yes, I have all the correct settings.

Time to get out the multi-meter again...

The multimeter revealed I did not have same fault a with the Sainsmart Mega, so I decided it was worth to do some testing, and I learnt something new...

Aside from Pin 4 LOW, Funduino Mega specifically requires Pin 10 HIGH and Pin 53 LOW for a LAN connection.

I got caught out by not keeping Pin 10 high.