DTR pin of ch340g

Go To Last Post
14 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

 

DTR pin of ch340g didn`t give auto reset to atmega8,but this circuit did the trick and it works flawlessly(Note:baud rate must be 57600).Can someone explain why this works?Resistor seems like pull-up but i can`t understand the purposes of cap and zener diode herelaugh

Last Edited: Tue. Apr 2, 2019 - 02:56 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The capacitor is 100nF (0.1uF)

IN4148 is a regular junction diode.   It is not a zener.

 

There is an internal pullup.   You don't need 10k pullup but it does no harm.

I don't see the point of the diode.

 

When DTR goes low,  it applies a short -ve pulse on the Reset pin.

This is how the Arduino bootloader starts.   i.e. the AVR receives the reset pulse.

 

David.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Before communication begins (resting state), both sides of the capacitor are at VCC.

When DTR goes low, the RESET side of the capacitor also goes low, because they are at the same potential. Then, the RESET side charges to VCC through the resistor. This corresponds to a negative pulse on RESET, that resets the MCU.

When DTR goes high again, since the capacitor is now charged to VCC, the RESET side of the capacitor would go to 2x VCC (i.e., like a charge pump circuit). The diode prevents this from happening, by discharging the capacitor to VCC.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

It is always good to read the replies to how simple circuits work.   I went to tech school 40 years ago when everything was different.  Most of the material covered in class I have forgotten, and about half of it, like transistor biasing, I've rarely or never used.  There was one microprocessor class taught in Intel 8086 assembly language.  The 8086 of the PC is the most confusing processor architecture ever devised. It used strange tricks to manipulate 20-bit addresses into 16-bit number values.

 

The DTR signal (Data Terminal Ready) was used in pre-internet days to start a modem-based connection between a remote computer and a local PC.  It was one of the four to six "hand-shaking" signals that was used to ensure that the data connection using telephone audio tones would be as reliable as possible.  It is included in the CH340 to make this new chip as compatable to older communcation protocols as possible.  But outside of modems, it is never used nor anything.

  The Arduino people needed a way to remotely trigger a reset on the AVR target board in order to activate the bootloader.  Avrdude is used to pull DTR low and keep it low.  The capacitor creates a pulse from the low-going DTR,

 

The number 104 on the cap refers to 0.1uF, not 0.01uF.  It is a 1 followed by 4 zeros in units of picoFarads [10000 picoFarads = 0.1 microFarad].

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Just to clarify, 104 means 10 followed by 4 more

zeroes, so 100,000pF.  This is the same value as

100nF or 0.1uF.

 

--Mike

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Simonetta wrote:
The DTR signal (Data Terminal Ready) was used in pre-internet days to start a modem-based connection between a remote computer and a local PC.  It was one of the four to six "hand-shaking" signals that was used to ensure that the data connection using telephone audio tones would be as reliable as possible.
You appear to be confusing DCD and DTR ?? DSR/DTR are simply to prove that the wire between the DTE and the DCE is plugged in ! It is DCD that shows that the modem has carrier tone - that is that there's now a connection across the phone wires.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

DSR means DATA SET READY, it is just a flag to the terminal (DTE) that the modem (DCE) is power up, checked its own circuits and it is ready to operate. 

 

DTR means DATA TERMINAL READY, it is just a flag to the modem, that the terminal is power up, checked all its own internal circuits and software and it is ready to operate.

 

RTS means REQUEST TO SEND, it is a flag the terminal send to the modem, asking the modem to confirm if the terminal can start to send data via TX pin, in old systems the modem operate in half-duplex style, it means it can or transmit or receive, not doing both things at once, since phone lines will carry information from one side to another or vice-versa.  In the modern full-duplex systems, RTS stay always on right before the first transmission.   Many years ago, in a previous versions of the famous Art of Electronics book, the autor made a mistake and wrote RTS as "READY TO SEND", I personally send a correction to that.

 

CTS means CLEAR TO SEND, it is a flag the modem send back to terminal, telling the communication medium is free to transmit terminal data, and it is a response to RTS.

 

DCD means Data Carrier Detected, it is a flag the modem send to the terminal, telling the carrier frequency is being sensed in the communication medium, and pretty soon data could be arriving modulating such carrier, then modem will deliver such data on RX pin.

 

The above is the RS232C standard recommendation, long ago it used DB-25 D-Sub connector, since it was also used for synchronous communications and used more circuits and pins, after a while it changed for only asynchronous communication and to DE-9 connector, yes, it is not "DB-9".

Just to make sure it is stated correctly for posterity.  laugh

 

By the way, the reversed diode on the OP schematic is to fast discharge the cap in case of power loss and allow it to recharge and reset the AVR quickly. Not really necessary, but... 

Wagner Lipnharski
Orlando Florida USA

Last Edited: Sat. Apr 13, 2019 - 11:55 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

wagnerlip wrote:

DE-9 connector, yes, it is not "DB-9".

 

Quite correct.  This is a DB-9:

 

Aston Martin DB-9

 

Source: Car and Driver Aston Martin DB-9

 

--Mike

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I agree that is a DB9 -- but it's also a connector

http://www.l-com.com/what-is-a-db9-connector

 

 

:)

 

hj

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Wikipedia disagrees!  D-subminiature

 

--Mike

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

DSR/DTR are simply to prove that the wire between the DTE and the DCE is plugged in ! It is DCD that shows that the modem has carrier tone

Quoting the standards as if anyone actually paid any attention to them?  :-)  Especially in a system that arguably lacks any "DCE" device...

 

The diode is explained here: https://code.google.com/archive/...

and http://forum.arduino.cc/index.ph...

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

 

ford2go wrote:

I agree that is a DB9 -- but it's also a connector

http://www.l-com.com/what-is-a-db9-connector

 

That is completely wrong, it is being wrong from years, it is being wrongly reproduced all over.

There is no such thing as DB-9  D-Sub connector, since the "B" designation means 19, 25, 44 or 52 pins, depending on connector pin density.  There is also an obscure DB13W3, with 10 regular and 3 coax pins.

A wrong thing does not becomes right just because people repeat and repeat thousands of times.

 

The correct ones below, if you say different, you probably also make mistakes with kW/kWh/kVA, etc.

 

 

Wagner Lipnharski
Orlando Florida USA

Last Edited: Mon. Apr 15, 2019 - 01:21 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

wagnerlip wrote:
obscure DB13W3

 

Obscure for some..... my Sun workstations use this connector for the monitor.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Kartman wrote:

wagnerlip wrote:
obscure DB13W3

 

Obscure for some..... my Sun workstations use this connector for the monitor.

 

I remember this connector!  Back when

cross-platform meant your code ran on

both SunOS and Solaris.  :-)

 

--Mike