Issue with programming Arduino MEGA using FTDI cable

Hi, please bear with me as I'm reasonably new to Arduinos

I'm trying to program an Arduino MEGA 2560 using an FTDI cable. I tried doing it via USB but didn't get any blinking on the RX and TX pins and loopback test failed so I think it is a broken 16U2 chip. The previous code is still running on the board.

I have plugged the FTDI cable into the serial pins as per the datasheet but am getting timeout messages when I try and upload the code.

I have my programmer set as AVRISP mkll and the correct port and board chosen, can anyone help me with this?

Do you have the DTR pin of the FTDI connected to the reset pin of the ATmega2560 via a 0.1 uF capacitor? If not, you will need to manually reset the Mega just as the upload process starts (after the compilation finishes. If you need more information on the manual reset timing, I can provide more detailed instructions.

Thanks pert. Yes I do, although the data sheet called it a DTS pin, is that different? I have tried using the reset button as well and neither way is working.

Sorry that should say RTS...

You can use either DTR or RTS pins for the auto reset circuit. Either is fine. I should have mentioned RTS in my previous reply.

Are your connections as follows?:

FTDI | Mega

RX | TX0
TX | RX0
VCC | 5V (unless you are powering the Mega separately)
RTS | RESET (via a 0.1 uF capacitor)

Yes these are the connections I have, still just getting a timeout message. Could it be to do with the drivers on my laptop? I haven't touched them since trying to use the cable

If you see a new port appear under the Arduino IDE’s Tools > Port menu after you plug your FTDI cable into your computer then there is no problem with the driver.

Please do this:

  • (In the Arduino IDE) File > Preferences
  • Uncheck the checkbox next to “Show verbose output during: compilation”
  • Check the checkbox next to "Show verbose output during: upload
  • Click “OK”
  • Sketch > Upload
  • After the upload fails, you’ll see a button on the right side of the orange bar “Copy error messages” (or the icon that looks like two pieces of paper at the top right corner of the black console window in the Arduino Web Editor). Click that button.
  • In a forum reply here, click on the reply field.
  • Click the </> button on the forum toolbar. This will add the forum’s code tags markup to your reply.
  • Press “Ctrl + V”. This will paste the upload output between the code tags.
  • Move the cursor outside of the code tags before you add any additional text to your reply.
Arduino: 1.8.9 (Windows Store (Windows 10), Board: "Arduino/Genuino Mega or Mega 2560, ATmega2560 (Mega 2560)"

Sketch uses 4688 bytes (1%) of program storage space. Maximum is 253952 bytes.
Global variables use 413 bytes (5%) of dynamic memory, leaving 7779 bytes for local variables. Maximum is 8192 bytes.
C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.21.0_x86__mdqgnx93n4wtt\hardware\tools\avr/bin/avrdude -CC:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.21.0_x86__mdqgnx93n4wtt\hardware\tools\avr/etc/avrdude.conf -v -patmega2560 -cwiring -PCOM8 -b115200 -D -Uflash:w:C:\Users\HEND1412\AppData\Local\Temp\arduino_build_803491/ArduinoHallEffect_Relay_test.ino.hex:i 

avrdude: Version 6.3-20171130
         Copyright (c) 2000-2005 Brian Dean,
         Copyright (c) 2007-2014 Joerg Wunsch

         System wide configuration file is "C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.21.0_x86__mdqgnx93n4wtt\hardware\tools\avr/etc/avrdude.conf"

         Using Port                    : COM8
         Using Programmer              : wiring
         Overriding Baud Rate          : 115200
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_getsync(): timeout communicating with programmer

avrdude done.  Thank you.

An error occurred while uploading the sketch

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

Does the LED blink when you start uploading a sketch? If it does not, that indicates that the autoreset isn't working - I wouldn't be surprised if it didn't work, due to the 16u2 also having a pin connected to reset via it's own 0.1uF cap...

I'm currently trying to upload code onto another Arduino MEGA without the broken 16U2 chip, still getting the timeout message and yes the LED does blink twice.

Are you still using the FTDI on the other Mega, or are you just doing a normal upload via the ATmega16U2?

Still using the FTDI, the normal upload via USB works correctly

My advice is to try manually resetting the board during the upload to see if the problem is with the auto reset. When you are resetting manually, you need to get the timing right. If you press the reset button too early, the bootloader will have already timed out by the time the upload starts. The tricky thing is that when you press the "Upload" button in the Arduino IDE, it first compiles your sketch before starting the actual upload. So you need to wait until after the compilation finishes before pressing the reset button. The way to get the timing right is to watch the black console window at the bottom of the Arduino IDE window. As soon as you see something like this:

Sketch uses 444 bytes (1%) of program storage space. Maximum is 30720 bytes.
Global variables use 9 bytes (0%) of dynamic memory, leaving 2039 bytes for local variables. Maximum is 2048 bytes.

press and release the reset button.