Cant upload sketch to mega 2560

Hi
I’m having a problem uploading a simple blink sketch to my Keyestudio Mega 2560 r3 with motor.
I also have a Uno board which uploads and runs the same sketch ok, using the same laptop and usb cable.

The Mega always gives an error :

Sketch uses 2642 bytes (1%) of program storage space. Maximum is 253952 bytes.
Global variables use 184 bytes (2%) of dynamic memory, leaving 8008 bytes for local variables. Maximum is 8192 bytes.

avrdude: ser_open(): can't open device "\\.\COM6": The semaphore timeout period has expired.


avrdude: ser_drain(): read error: The handle is invalid.


avrdude: ser_send(): write error: sorry no info avail
avrdude: stk500_send(): failed to send command to serial port
avrdude: ser_recv(): read error: The handle is invalid.


avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: ser_send(): write error: sorry no info avail
avrdude: stk500_send(): failed to send command to serial port
avrdude: ser_recv(): read error: The handle is invalid.


avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: ser_send(): write error: sorry no info avail
avrdude: stk500_send(): failed to send command to serial port
avrdude: ser_recv(): read error: The handle is invalid.


avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: ser_send(): write error: sorry no info avail
avrdude: stk500_send(): failed to send command to serial port
avrdude: ser_recv(): read error: The handle is invalid.


avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: ser_send(): write error: sorry no info avail
avrdude: stk500_send(): failed to send command to serial port
avrdude: ser_recv(): read error: The handle is invalid.


avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: ser_send(): write error: sorry no info avail
avrdude: stk500_send(): failed to send command to serial port
avrdude: ser_recv(): read error: The handle is invalid.


avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_getsync(): timeout communicating with programmer

When i connect the Uno I’m given choices of using Com3, Com5 or Com6 and I connect to Com3
But when I connect the Mega I’m given choices of Com5 or Com6.
I’ve tried both and all 3 USB ports on the laptop.
The Board I choose is “Arduino Mega or Mega 2560”

Any help would be appreciated thanks
Chris

Firstly, double check that you have selected the MEGA 2560 in the ‘Boards’ option of your IDE. That is always the place to start with downloading issues.

To confirm the port that the Mega uses, open Control Panel \ Device Manager and look in Ports (COM & LPT). Note the COM ports. Then plug in the MEGA and USB cable. A new port should show up. That’s the one you should use.

Given that you have ports 5 and 6 when the UNO is plugged in (as well as 3, the UNO port) then I suspect that the MEGA is not creating a COM port. That is, Windows is not recognising the MEGA as a USB device and installing the drivers needed to create the COM port that your IDE will use. The different Arduino boards use different USB interfaces and often require different drivers, even for the same board type (UNO or MEGA). You need to identify the USB interface type used by your MEGA and find and install the correct drivers for that USB. Does the manufacturer include a download link for a driver for that board?

2 Likes

Jeff105671

SOLVED

I contacted Keyestudio and downloaded a driver they recommended (CP2102). The board now communicates with my laptop (COM7) and my test sketch is working.

Thanks very much for your help

Chris

2 Likes

Thanks for letting us know that you solved it, and that Keyestudio was able to provide the drivers the board requires. Note that the port number (COM7) was assigned by Windows and that number could change, so if there is an issue in the future, check Device Manager to confirm the port number you are using.

1 Like

Check if the board is recognized and listed (e.g., COM5: Arduino Mega 2560)

Already SOLVED thanks