ESP32 Serial Terminal – Program Halts When Disconnected

esp32puttyserial

My platform is ESP32-wroom (Devkit v1 board). ESP-IDF 5.0 on Win10.

I've been using PuTTY to monitor the ESP32's serial log and output (the main serial where all the diagnostic info goes, not the optional ones). It worked just fine.

However, today I've noticed that upon closing PuTTY's terminal window (and clicking "ok" when it asks "Are you sure you want to close the session?") the ESP32 comes to a complete halt. The program running on it stops. Power, however, is still on.
Using ESP-IDF's VSCode extension "monitor" function does not cause this effect, however.

I've tried flashing the official blink example to see if the problem was in my code. But nope, the LED stops blinking the moment I disconnect the PuTTY terminal session. What may be the reason?

P.S: I'm aware that ESP32 may use RTS/DTR pins of the serial for some internal controls, i.e. every time serial connection is established, ESP32 soft-resets. Is that the case here too? I.e. maybe PuTTY sends some signal over serial that ESP32 interprets as "halt"?

Steps to recreate this:
1.Flash official blink example, connect an LED to a chosen pin.Confirm that the led blinks.
2. Connect to ESP32 with PuTTY (115200baud serial)
3. Close the PuTTY terminal window by clicking on the X then "Ok"
4. LED will stop blinking.

Best Answer

Using a terminal program to access a serial port will generally control DTR.

Closing a serial port will bring DTR to inactive level, and opening a serial port will bring DTR to active level.

Related Topic