Go Down

Topic: DTR reset and timing (Read 325 times) previous topic - next topic

mikb55

Can the reset occur at the moment that the PC starts sending data, or does it have to be some number of milliseconds prior to that?

I only have a two channel scope so it's difficult to see what's going on with regards to the timing of the DTR, the Tx from the PC and response from the Arduino.

My goal is to use a serial -> ethernet -> serial converter for remote programming, but it doesn't pass the state of the hardware control lines, so I need to figure out how to generate a reset signal at the Arduino end just at the right moment so that the bootloader is running when the PC sends the program.


Budvar10

DTR is generated on HW or SW connection. Whenever you connect the device or open/connect the terminal etc. Persistent connection is without the change on DTR.
Arduino clone with ATmega1284P   http://forum.arduino.cc/index.php?topic=277260.0

mikb55

DTR is generated on HW or SW connection. Whenever you connect the device or open/connect the terminal etc. Persistent connection is without the change on DTR.
In my case there won't be a DTR at the Arduino end. Can I just use the first bit send by the PC to trigger a circuit that resets the Arduino, or will I need to buffer and delay the data from the PC so that the bootloader is in the right state to receive the data?

Budvar10

Which circuit for the reset? How do you want to distinguish between bit which have to reset and which not?
I do not understand clearly.
Arduino clone with ATmega1284P   http://forum.arduino.cc/index.php?topic=277260.0

gbafamily

Quote
serial -> ethernet -> serial converter for remote programming
This is not clear where the Arduino(s) are in the pipeline. Is one Arduino being used to program another Arduino? Is the goal something similar to esp-link but using Ethernet instead of WiFi?

avrdude has a network option -Pnet:<ip addr>:<port num> so the remote side does not require a serial port.

avrdude -Pnet:<ESP addr>:2323 -> network -> ESP8266(esp-link) -> Arduino board

mikb55

#5
Sep 21, 2019, 08:18 am Last Edit: Sep 21, 2019, 08:22 am by mikb55
This is not clear where the Arduino(s) are in the pipeline. Is one Arduino being used to program another Arduino? Is the goal something similar to esp-link but using Ethernet instead of WiFi?

avrdude has a network option -Pnet:<ip addr>:<port num> so the remote side does not require a serial port.

avrdude -Pnet:<ESP addr>:2323 -> network -> ESP8266(esp-link) -> Arduino board
I didn't know about the esp-link.

I have  the current setup:
PC with Eltima/USR-VCOM virtual com port -> wired Ethernet -> USR-TCP232-ED2 device -> Arduino being programmed
The USR-TCP232-ED2 product overview is here
https://www.usriot.com/products/triple-ttl-uart-to-ethernet-module.html
 
Documentation
https://www.usriot.com/download/User%20Manual/USR-TCP232-ED2-user-mannual-V1.1.2.pdf

When using the Arduino IDE, the virtual com port only sends the Tx Rx data from AVRdude through the ethernet. The DTR state isn't sent. This is a limitation of the driver.

At the USR-TCP232-ED2 receiving end, the ethernet data is turned back into TTL serial Tx Rx.
Currently I don't have a strategy for resetting the target Arduino so that the bootloader can receive the data sent from AVRdude.

I thought that perhaps I could use a second microcontroller or circuit to monitor the incoming AVRdude data and trigger the target Arduino to do a reset. Will this work, or does the reset have to occur some time before the program data reaches the target Arduino?

Also the USR-TCP232-ED2 device I'm using has 3 serial channels so in theory I could use one for the AVRdude data and another for triggering the hardware reset, that's assuming it's possible for AVRdude to somehow trigger another action before it starts sending the program data to the target. This is the first time I've looked at AVRdude outside of the Arduino IDE so I don't know much about it's capabilities and limitations.

Budvar10

Try to use RTS instead of DTR if it is possible. Normally, Arduino SW uses DTR and RTS same way.
Arduino clone with ATmega1284P   http://forum.arduino.cc/index.php?topic=277260.0

gbafamily

If DTR and RTS state are not sent from the VCOM driver, I do not see many options. Does DTR or RTS change when there is a TCP connection versus no TCP connection? You might be able to use a state change to trigger a reset pulse to the Arduino board.

Quote
I thought that perhaps I could use a second microcontroller or circuit to monitor the incoming AVRdude data and trigger the target Arduino to do a reset. Will this work, or does the reset have to occur some time before the program data reaches the target Arduino?
This link has details on two ways esp-link handles board reset.

https://github.com/jeelabs/esp-link/blob/master/UC-FLASHING.md

A second uC scanning for the programming start sequence might work. This is one method esp-link handles board reset. The only way to be sure is to try it.

Go Up