I'm working over a sketch to enable uploading from an Android device to an Arduino board, and it works for Duemilanove (FTDI-based) and Arduino Uno (ATmega-based) when testing for PC/Arduino using rxtx (pure Java).
But it does not work when using the USB-Android library as the setDTR/setRTS methods are not yet implemented.
FTDI Android drivers allow the sending of setDTR/setRTS signals, but it fails to send/read data after it.
So the problem is in the Android USB API and I can't figure out what's wrong..
What happens for FTDI-based Arduino boards after DTR/RTS are toggled?
I believe that the device is reset and waits for bootloader commands (STK500) for ~50-250 ms. Am I right?
You are correct. The reason for this is the thing called Bootloader.
In their most barebones state, the microcontrollers (henceforth uCs) that Arduinos are built on can be programmed via In-System Programming (ISP) method, which is a particular implementation of SPI protocol. The only thing we need to know about that is that this isn't serial or USB.
To make AVR chips (and Arduino boards) programmable via Serial/USB we load a program called Bootloader (via ISP) onto the chip. The bootloader reads your program data over the serial link and writes it to flash. If there is no program to be loaded, the bootloader gives the loaded program the control. So the bootloader could only be active after turn on or reset: after that it runs the program you loaded and never becomes active again.
Most bootloaders are set up to look for programming data only after a reset, and the reason is that waiting for the serial data involves a timeout: you have to wait for some time (say 1/3/5/10 seconds) to see if there is program being uploaded and then load the program if it is being sent. If the bootloader looked for programming data every time an Arduino turned on, your Arduino would only activate with a delay, which was deemed to be undesirable. So the bootloader only activates after a reset.
It could be annoying to force the user to have to push the reset pin every time before they wanted to program their Arduino, and, moreover, to start sending the serial data immediately after reset (or they might miss the timeout window), so the clever folks at Arduino came up with a trick: use the DTS signal to trigger reset and after that send the data. So your Arduino (if it isn't ancient) is set up to reset on receiving DTS signal.
The answer is that the board resets. The schematic is made in the way it resets the board (RTD/DTR is wired to the microcontroller reset pin somehow).
来源:https://stackoverflow.com/questions/15499447/whats-going-on-after-dtr-rts-is-sent-to-an-ftdi-based-arduino-board