I need to use a long RS232 cable for/ my arduino Uno so the USB connector is not usable. So I bough an Adafruit model 70 FTDI to RS232 adapter and wired it up to my arduino. It's working. I can send and receive data as needed.
BUT! How do I program the board over the RS232? Everything I read says to use the DTR line connected to the reset pin on the arduino except these FTDI to rs232 adapters do NOT seem to have DTR!
So, can it be done? Obviously not unless one can use CTS or RTS instead.
So can anyone recommend a FTDI to RS232 adapter that has DTR?
In order to upload, the bootloader needs to be activated. This is done by resetting the microcontroller. However, the bootloader only runs for a short time before timing out and switching to running your sketch so the reset has to be timed just right during the upload. Normally, we have an auto-reset circuit set up that resets the microcontroller at just the right time during the upload. The auto reset circuit consists of the DTR or RTS on the serial adapter connected to the reset pin via a 0.1 uF capacitor. You can use either DTR or RTS, it doesn't matter which. This converts the signal on the DTR or RTS pin into a reset pulse at the right moment of the upload.
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:
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.
Thanks. So I can use the RTS line from the adapter with the 0.1uF cap connected to the reset line and it will work the same as if I used the usual USB connection? No need for any software changes in the IDE?
Well I answered this myself. RTS does NOT work with the 0.1uF to upload a sketch. The IDE gets to uploading, and responds with programmer is not responding. Are you sure that a .1uF cap is all that is needed?
I tried a different rs232 to ttl by DF robots. IN this case, DTR is available on the rs232 connector.
So at first glance the latest IDE from Arduino, no longer supports RTS (with the included avrdude.)
I just did an experiment. What I found was that the FTDI with DIY auto reset circuit does not work on both an ATmega16U2 and a CH340 based “Uno” style board, no matter if I’m using DTR or RTS. I used the same DIY auto-reset circuit on a Pro Mini (which doesn’t have an on-board USB to TTL serial chip) and I was able to upload using either DTR or RTS. The Pro Mini is an ATmega328P on which I have installed the Uno bootloader so the only difference from the other boards is the lack of the USB chip.
This tells me that the on-board USB to TTL serial chip somehow interferes with the working of the DIY auto reset circuit. So my suspicion is that it was purely by chance that DTR works for you. If you end up starting to have problems with your DTR-based system, or you decide you want to give the RTS one another try, I would suggest cutting the RST-EN solder jumper on your Uno. That will disconnect the auto-reset circuit of the on-board USB chip and prevent it from interfering with the DIY auto reset. After that, I would expect RTS to work for you.