Skip to content

tools/mpremote: Add control for rts / dts running in linux. #17532

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

poWer4aiX
Copy link

Summary

mpremote is not working on my laptop running Ubuntu 24.04.2 LTS when trying to connect to an ESP32-CAM with the CAM-MB. This board has DTR connected to RST and requires DTR to be LOW for the ESP to be running. By adding the new options --dtr [0|1|off|on] and --rts [0|1|off|on] you can steer the logical level of the two lines.

In addition, many drivers seem to pull the signals up either when the device is closed or opened. This causes the ESP32 to perform a hard reset, which can take more than 1s. A special loop has been added if entering raw REPL mode is required.

The PR also solves #11451.

Testing

For the test I'm using the modified code since some weeks with an ESP32-CAM and MB, ESP32 NodeMCU Dev Kit C V2 and ESP8266 NodeMCU with ESP-12F module. I used it to copy files, install modules and with the REPL, or cause.

In addition, some of the tests in tools/mpremote/tests can be run as well, but not all. As the ESP will perform are hard reset in my case, the tests using the resume command will not work. To run the other tests, you need to provide the environment variable MPREMOTE to point to the mpremote.py while adding the required options:

cd .../tools/mpremote/tests
export MPREMOTE="$(pwd)/../mpremote.py connect --dtr 0 --rts 0 auto"
./run-mpremote-tests.sh ./test_eval_exec_run.sh
./test_eval_exec_run.sh: OK

Trade-offs and Alternatives

When running without providing one of the new options, the code runs as before.

Signed-off-by: Christian Zahl <cz@dcc-net.de>
Signed-off-by: Christian Zahl <cz@dcc-net.de>
Signed-off-by: Christian Zahl <cz@dcc-net.de>
Signed-off-by: Christian Zahl <cz@dcc-net.de>
To run tests with --dtr/--rts options we need to provide them
by either using a wrapper script or by adding them to variable, e.g.:
export MPREMOTE="$(pwd)/../mpremote.py connect --dtr 0 --rts 0 auto"

Signed-off-by: Christian Zahl <cz@dcc-net.de>
Copy link

codecov bot commented Jun 19, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.56%. Comparing base (09541b7) to head (7821cfd).
Report is 5 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master   #17532   +/-   ##
=======================================
  Coverage   98.56%   98.56%           
=======================================
  Files         169      169           
  Lines       21950    21950           
=======================================
  Hits        21636    21636           
  Misses        314      314           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link

Code size report:

   bare-arm:    +0 +0.000% 
minimal x86:    +0 +0.000% 
   unix x64:    +0 +0.000% standard
      stm32:    +0 +0.000% PYBV10
     mimxrt:    +0 +0.000% TEENSY40
        rp2:    +0 +0.000% RPI_PICO_W
       samd:    +0 +0.000% ADAFRUIT_ITSYBITSY_M4_EXPRESS
  qemu rv32:    +0 +0.000% VIRT_RV32

@poWer4aiX poWer4aiX changed the title Feat mpremote dtr rts tools/mpremote: Add control for rts / dts running in linux. Jun 20, 2025
@dpgeorge dpgeorge added the tools Relates to tools/ directory in source, or other tooling label Jun 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tools Relates to tools/ directory in source, or other tooling
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants