Go Down

Topic: Issues connecting to ATMEGA2560 with USB to TTL Serial Cable Adapter (Read 354 times) previous topic - next topic

Chris19832

Hey Everyone,

I am brand new to all of this, so I apologize upfront if this is a really basic question. I wired a USB FTDI cable to my atmega2560 board and I can't upload sketches. It keeps timing out. When I connect RX, TX and GRD at 115200 baud rate, I can see messages from the board. As soon as I connect the RST (and the CTS) cable, I stop getting messages. As I understand it, I need RST in order to upload sketches. Here is how I currently have it wired:

RX                TX0
TX0               RX
5v               (left disconnected)
CTS                GRD
GRD               GRD
RTS                 RTS

Here is the cable:
https://www.amazon.com/gp/product/B014GZTCC6/ref=ppx_yo_dt_b_asin_title_o01_s00?ie=UTF8&psc=1

The board is powered separately, so I figured that I shouldn't connect the 5v wire. Since I don't have a CTS pin, I connected CTS to GRD (I read this tip in a forum thread). It seems like no matter what I do, I can't get proper communication after introducing the RTS wire.

I searched these forums for a few hours with no luck. Any help is appreciated.

Thanks,
Chris

Budvar10

What is GRD? GND? What is "your ATmega2560 board"? Arduino or your own design? In second case, is your ATmega bootloaded?
RTS should be connected to RESET on Arduino.
For any ATmega the minimal circuit is needed: power with decoupling, reset circuit and clock source (internal by default but...).
Arduino clone with ATmega1284P   http://forum.arduino.cc/index.php?topic=277260.0

Chris19832

Budvar10, thanks for the response. I meant GND, sorry. It's an existing product I purchased. The company that sells it went out of business. I am attempting to write my own firmware/software. It is currently bootloaded and has the original firmware, for which I am trying to overwrite.


I have RTS connected to RTS. My question is what do I do with the CTS and 5v wires on the USB cable? I have tried leaving CTS disconnected and connecting it to GND and neither works.

Budvar10

 Do not connect 5V if the board is powered separately but the voltage must be same 5V.
CTS not connected.

Try the loopback test on FTDI. Connect Rx to TX open terminal emulator try to write something, it must be received.
Also RTS - RESET signal test from FTDI. Whenever you open the terminal or at start of upload process, RTS should fall from 5v to 0. It is just about 200 ms but enough for observation on DMM or LED (LED needs serial resistor). FTDI is Ok if it will pass.
Arduino clone with ATmega1284P   http://forum.arduino.cc/index.php?topic=277260.0

pert

RTS needs to be connected to the reset pin via a 0.1 uF capacitor. It won't work to connect it directly. I have found that sometimes that still doesn't allow uploads without manually resetting the board, probably because the existing auto-reset circuit on the board interferes.

If you can't get the auto-reset to work, you can manually reset the Mega during uploads:

If you don't have an auto-reset circuit, you'll need to manually reset your Arduino during the upload. When you don't have that auto-reset, and 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:
Code: [Select]
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. The upload should now finish successfully.

Chris19832

Pert and Budvar10, thank you. I tried your suggestions. Here is what I came up with:

1. TX/RX loopback test was fine. When I connected the TX/RX wires on the USB, arduino mirrored every message I sent it.
2. I hooked up a DMM and saw that the voltage drops when starting the console. It doesn't increase back to 3.25 until I close the console and then I get some audible feedback that the board restarted (there are valves connected to the board that go through a test when powering on/restarting). When I hit "upload," the voltage drops and I get the following messages:

avrdude: ser_send(): write error: Device not configured
avrdude: stk500_send(): failed to send command to serial port
avrdude: ser_recv(): read error: Device not configured
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_getsync(): timeout communicating with programmer
the selected serial port avrdude: stk500v2_getsync(): timeout communicating with programmer
 does not exist or your board is not connected

I tried the following wiring configurations with pretty much the same result:

RX                TX0
TX0               RX
5v               (left disconnected)
CTS                GRD
GRD               GRD
RTS                 RTS

RX                TX0
TX0               RX
5v               (left disconnected)
CTS             (left disconnected)
GRD               GRD
RTS                 RTS

Any ideas on troubleshooting this further? Is it possible the existing bootloader is blocking me from updating the firmware somehow? A friend of mine suggested that I try programming it with an AVR programmer, but that seems complicated, especially for this board based on the research I have done.

Thanks,
Chris

pert

I guess you missed the part where I said you needed to connect RTS to the reset pin via a 0.1 uF capacitor?

Chris19832

Hey Pert, I did see that suggestion, but completely forgot to respond. I'll try that this weekend and report back.

pert

If you're trying the manual reset during upload, then just leave RTS disconnected.

Chris19832

Thanks for your help! It's finally uploading when I do a manual reset.

I ordered the capacitor so hopefully that will allow me to start uploading without manual intervention. This one should work, correct (see below)? Also, can I just connect this between the wire coming from the FTDI and wire coming from the board?

https://www.amazon.com/gp/product/B00E6PNOXU/ref=ppx_yo_dt_b_asin_image_o00_s00?ie=UTF8&psc=1

Thanks,
Chris

pert

I'm glad to hear it's working with a manual reset. That's a very good sign.

The capacitor looks good. You just need to connect it anywhere in series between the RTS and reset pin. It shouldn't matter where it's located on the wire.

As I said before, I've had no luck in my experiment with wiring an auto-reset circuit from an FTDI module on a board that already has a built-in USB chip, but others had luck with this. It might also depend on the status of the built-in USB chip on the board. Most would be doing this because the USB chip is damaged, so maybe that would cause it to not interfere. I tried it on a board with a perfectly working USB chip. Even if you can't get the auto-reset circuit to work, a collection of 0.1 uF ceramic capacitors is an extremely useful thing to have in your parts stash.

Chris19832

I just wanted to say thank you! The 0.1 uF capacitor did the trick and I can now upload with the automatic reset.

-Chris

pert

You're welcome. I'm glad to hear it's working now. Enjoy!
Per

Go Up