Uploading a sketch over RS232

Does anybody know if it's possible to upload a sketch to Arduino Uno over a physical RS232?

I have no problems uploading a sketch from my PC (using Arduino IDE) over Arduino's USB COM port, but I would like to be able to do it over a physical RS232. I do have a RS232 adapter for Arduino that is connected to D0 (Rx) and D1 (Tx) Arduino pins. I have a test sketch that shows that RS232 communication with my PC works fine both ways. But uploading a sketch over RS232 does not work. Any idea and any help would be greatly appreciated.

Toly

You need to reset the Arduino at the right time to activate the bootloader. There is a small window of time between the reset and the bootloader timing out so you shouldn't do it too soon. When you upload over USB the reset is done automatically at the right time. I'm not sure whether it's possible to connect the RS232 adapter to the Arduino to do an automatic reset. The way it works with the standard USB-serial adapters is you have a DTR and a CTS pin that go low when the upload starts. One of those pins is connected to the reset pin of the microcontroller through a 0.1 uF capacitor, which generates a reset pulse.

Is there a way to reset Arduino in software by the running Arduino sketch?

There is a way to have the Arduino reset itself, but that won't help you with your case. The reset must happen at nearly the exact moment when the uploading process on the PC starts to send data.
Why must you use RS232 and not the USB-Adapter?
Are there more connections on your RS232 besides TX and RX? There might be something useful like DTR or CTS etc. that can be used to provide a reset signal

Select File:Preferences, and turn on Verbose outputs.
When the IDE shows "compiled xxx of 32xxx bytes", press reset. (Or press & hold reset, release it when you see the message).
Might take a couple tries to get the timing right.

Yes, manually resetting Arduino works, it's not an issue. But I would like to make an upload automatic. And, no, I don't have a DTR line in my RS232 connection between my host system and Arduino. I have only 2 lines: Tx and Rx.

So, my idea is to send a special character from the host to a running sketch over RS232, such as for example a Break. This would indicate to the sketch that the host wants to load a new sketch and so Arduino must reset. The running sketch receives the Break character and resets Arduino internally. That's the idea.

So, the question is: How to reset Arduino from the running sketch?