Hi,
=== ESP side
the ESP has several modes of operation:
* normal RUN (your code)
* RESET (halted, no code is executed)
* BOOTloader run (special code inisde the ESP is performed to communicate via UART and to write YOUR conde into the ESP .. to be run later)
Usually the ESP is in RUN mode
Now if you want to put new code on it the steps are
* RESET (for a short time, maybe 100ms)
* start BOOTloader
* communicate and program your code
* RESET (for a short time, maybe 100ms)
* RUN your code
==== UART side
UART is a serial communication.
In simplest case you need
* one signal line for [PC --> ESP] communication
* one signal line for [ESP --> PC] communication
* and GND
But there are additional signals for communication like DTR and RTS and the function is like you described.
These lines may be used or not.
And these signal states may be generated automatically be the UART hardware
...OR they may be controlled manually by PC software. And this is the case here.
And exactly this is the case here: These two signals are controlled manually in the PC by the ESP_programming_software.
But here they are NOT used in the original meaning of UART communication signals.
And - if I´m not mistaken - due to their wiring to the ESP, they can NOT be used in the meaning of UART_DTR and UART_RTS at all.
They use these two lines like GPIO signals ... just to be able to place the ESP into the desired operation modes:
(you may say they mis-use these lines)
==== Now ESP and control lines combined:
To put the ESP into RESET MODE, you need to get [EN = 0]
--> this is done by setting [DTR = 1] and [RTS = 0]. This is static.
To put the ESP into BOOTloader mode, you need to leave the RESET state [EN = 0 -> 1] while [GPIO0 = 0]
--> this is done by [DTR = 1-> 0] and [RTS = 0 ->1] (a small signal delay is generated with a capacitor on EN ... to be sure the signal at GPIO0 settled first)
To put the ESP into RUN mode, you need to leave the RESET state [EN = 0 -> 1] while [GPIO0 = 1]
(now you have two options you can randomly use)
--> this is done by [DTR = 1-> 0] while [RTS = 0] (a small signal delay is generated with a capacitor on EN ... to be sure the signal at GPIO0 settled first)
or
--> this is done by [DTR = 1] while [RTS = 0 -> 1] (a small signal delay is generated with a capacitor on EN ... to be sure the signal at GPIO0 settled first)
Note: [1 -> 0] means the edge, when the signal transitions from 1 to 0. Likewise [0 -> 1]
***
So your state table could be added with the ESP states information:
Code:
DTR | RTS --> EN | GPIO0 | --> MODE
1 1 1 1 RUN user code
0 0 1 1 RUN user code
1 0 0 1 RESET
0 1 1 0 BOOTloader
Klaus