Reset/Boot of a DOIT ESP32 Dev Kit V1

944 views
Skip to first unread message

cve2022

unread,
Sep 7, 2022, 8:31:54 PM9/7/22
to thonny
Hello.

I am troubleshooting a problem with this board when running Thonny. If I press the Stop icon more than once, the board gets lost and a manual reset has to be performed. I have seen a workaround for this kind of issue that requires adding a capacitor (1 to 10uF) on the EN (nRST) line. I monitored the EN line and I found that there is a short pulse (less than 2us) whenever I press the Stop button. When a 10uF capacitor is added, the pulse is eliminated and the board stays responsive.

What happens is the RTS line of the is asserted (i.e., set to low level) before the DTR line so that the Reset/Boot control circuit generates that pulse on the EN/nRST line.4cf35b2e8c701cd975ea5206a917e97b316276a5.png
I have cloned the Thonny repository, but I could not find exactly where I should do a change to try fixing this behavior (by asserting DTR before RTS).
So I would appreciate any hints on how to do it.

Thanks in advance.



Aivar Annamaa

unread,
Sep 9, 2022, 3:18:09 PM9/9/22
to thonny
For MicroPython backend, the Stop/Restart first closes the serial connection, then reconnects, then tries to reach the REPL and sends up to three interrupts (b"\x03" a.k.a Ctrl+C byte) to the device to achieve this.

I think it would be easiest if you first tried to reproduce your problem by trying to write a Pyserial (https://pyserial.readthedocs.io/en/latest/) which does the same to your device. Then you would have more control with experimenting with different approaches. Thonny also uses Pyserial but there are more variables in play and the experiment may get confusing very soon.

Best regards,
Aivar

cve2022

unread,
Sep 15, 2022, 8:23:28 PM9/15/22
to thonny
Hello, Aivar.

First off, thank you very much for your comment.

Could you pinpoint where in Thonny's source code this sequence is done?

About your suggestion of trying to reproduce it in a controlled way with pyserial, it is quite a good idea and I will do it for sure. But I would like to test it in Thonny source code too. I consider myself very newbie in Python, so some things that may be obvious for seasoned python programmers are not obvious to me so any help is welcome.

Once more, thank you.

BR.

Aivar Annamaa

unread,
Sep 19, 2022, 5:10:57 AM9/19/22
to thonny
The creation of the connection happens here: https://github.com/thonny/thonny/blob/3450b1f91cb3816b1a3a54e3c995291778a4f910/thonny/plugins/micropython/serial_connection.py#L29


As you see, there are some comments regarding dtr and rst. Someone suggested tweaking these parameters but did not reply to my questions afterwards. Therefore I don't really understand the role of dtr/rst in this context. You could experiment with changing the code or by manually tweaking the configuration file's ESP32 block and setting dtr and rst variables (see https://github.com/thonny/thonny/wiki/MicroPython#advanced-configuration).

Best regards,
Aivar

Reply all
Reply to author
Forward
0 new messages