Go Down

Topic: Arduino Mega2560 not recognized by computer (Read 67 times) previous topic - next topic

noamm91

Jul 25, 2016, 12:34 pm Last Edit: Jul 25, 2016, 12:49 pm by noamm91
Hi,
I've searched the forum for solutions before posting this but didn't find anything that was helpful to me, If I've missed something please just put the link.

I got a new Arduino Mega 2560, When I connected it to my computer running Windows 10 - nothing seem to happen: not in device manager (not as unknown device and not as a COM port) , not any kind of alert from windows and not even a sound.

The "only" thing that happens is that the 2 leds on the board lights up (one flashing and one is simply ON).

from my understanding, the fact that the L led is flashing means that there is a program in the microcontroller memory that runs and makes the led flash.

So I conclude from that that the board itself is basicly working.
So why windows doesn't recognize it? I thought maybe it because the Bootloader has been earased/deleted and therefore the a connection between the Arduino and the computer can't be established.

If so, then it means that all I need to do in order to restore the communication is to reprogram  the boolloader code, is that correct?

If it is correct then the only answer left is - how can I program it if I can't establish a connection to my IDE?

I understood that there is a way to do this if I have another Arduino and actually I do have another Arduino Uno (that works fine with my computer) so can anybody tell firstly if my thinking is correct and secondly what is the method of programing my Mega2560 via my Uno?

Thank you very much and I'm sorry for my bad English,
Noam

pert

Try it with a different USB cable. You might have a bad one.

noamm91

Try it with a different USB cable. You might have a bad one.
I'm using the same cable for UNO and Mega , it works with UNO.

pert

Ok, that proves the cable is good, well it's good to eliminate the more simple potential issues first anyway. So the only difference between your working Uno configuration and your non-working Mega configuration is the board? It's plugged into the same computer in the same USB port?

If it doesn't show up at all in Device Manager that indicates the problem is not with the bootloader on the ATmega2560. That problem would only show up once you attempted to upload a sketch to the board. The problem is more likely with the ATmega16U2 that handles the USB to serial conversion. You could try uploading the firmware to that chip.

noamm91

#4
Jul 25, 2016, 01:10 pm Last Edit: Jul 25, 2016, 01:18 pm by noamm91
Ok, that proves the cable is good, well it's good to eliminate the more simple potential issues first anyway. So the only difference between your working Uno configuration and your non-working Mega configuration is the board? It's plugged into the same computer in the same USB port?

If it doesn't show up at all in Device Manager that indicates the problem is not with the bootloader on the ATmega2560. That problem would only show up once you attempted to upload a sketch to the board. The problem is more likely with the ATmega16U2 that handles the USB to serial conversion. You could try uploading the firmware to that chip.
Same computer, same USB port.
The only difference is the board.

Ok, so the problem is with the ATmega16U2 , how can I upload the firmware to it?
and another question, if there is no connection to the board, how did they put the bootloader on the ATmega2560 chip?

pert

how did they put the bootloader on the ATmega2560 chip?
The bootloader is installed using the ICSP header. This is the 2x3 male header located between the ATmega2560 chip and the reset button:

There's another 2x3 header next to the USB jack. That's used for uploading firmware to the ATmega16U2.

As you said, you can do this using an Arduino with the ArduinoISP sketch loaded(File > Examples > 11.ArduinoISP) or you can use a dedicated programmer device(USBasp, etc.). The firmware for the ATmega16U2 is located in the hardware\arduino\avr\firmwares\atmegaxxu2 folder under your Arduino IDE installation folder. You'll need to use avrdude from the command line so it's a bit more complex process. Installing a bootloader is much easier because you can do it from the Arduino IDE.

noamm91

#6
Jul 25, 2016, 01:55 pm Last Edit: Jul 25, 2016, 02:05 pm by noamm91
The bootloader is installed using the ICSP header. This is the 2x3 male header located between the ATmega2560 chip and the reset button:

There's another 2x3 header next to the USB jack. That's used for uploading firmware to the ATmega16U2.

As you said, you can do this using an Arduino with the ArduinoISP sketch loaded(File > Examples > 11.ArduinoISP) or you can use a dedicated programmer device(USBasp, etc.). The firmware for the ATmega16U2 is located in the hardware\arduino\avr\firmwares\atmegaxxu2 folder under your Arduino IDE installation folder. You'll need to use avrdude from the command line so it's a bit more complex process. Installing a bootloader is much easier because you can do it from the Arduino IDE.
First of all, thank you for fast responding.
little question before starting with this whole firmware mess, if I see the L led that is connected to pin 13 of ATmega16U2 flashing on and off , isn't that mean that there is some sort of firmware on the chip? I mean what else would make the led flash? Are we assuming that this firmware is just bad/broken and we want to reprogram the chip?

Now I would really appreciate if you could help throught this process:
1. I've opened the firmware folder you said, my Mega2560 version is R3 so I guess I need the HEX file named: "Genuino-COMBINED-dfu-usbserial-atmega16u2-Mega2560-R3"?
2. I've also open the example code for ISP you mentioned.
3. Can you explain the steps needed from here? I have cables to connect any pins from my UNO to my Mega. How do I proceed?

pert

little question before starting with this whole firmware mess, if I see the L led that is connected to pin 13 of ATmega16U2 flashing on and off , isn't that mean that there is some sort of firmware on the chip?
That LED is connected to the ATmega2560, not the ATmega16U2. It just happens to be close to the ATmega16U2. The firmware blinking the LED is on the ATmega2560.

To be honest I've never updated the firmware on my ATmega16U2. I'll try to get back to you with some better info on how to do that but it might be a bit of a delay because it's Monday morning with all the fun stuff that entails. There ought to be a good tutorial on doing this but strangely I've never ran across one, of course I've never needed one either.

Maybe someone else will jump in with a suggestion of a much more simple solution to your problem or some help with the firmware update process.

noamm91

Alright man. I'll try exploring it some more by myself. Please let me know if you found something useful. Thanks

noamm91

I didn't find a good tutorial exactly for this issue, I did found something that is related and tried it by myself but it doesn't work. Here is what I did:

1. Conntected my UNO to my Mega SPI connector according to the table in this link https://www.arduino.cc/en/Hacking/Upgrading16U2Due


2. Uploaded my the ISP example from IDE to my UNO.

3. Tried to run this command from AVRDUDE: avrdude -C avrdude.conf -c arduino -P COM12 -b 19200 -p m16u2 -vvv -U flash:w:/home/USER/newFirmware/16u2.hex:i

but that didn't work. I got an error (picture at the end)

so I tried to run this using a diffrenet programmer, I tried:

avrdude -C avrdude.conf -c avrispmkii -P COM12 -b 19200 -p m16u2 -vvv -U flash:w:/home/USER/newFirmware/16u2.hex:i

and that also doesnt work (got a timeout).

Here are some photos of the connection a made between my 2 UNO to Mega.

I realy don't know how to proceed from here.
Any help will be realy appriciated.
Noam


Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy